2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
6 * Copyright (C) 2007 Maks Orlovich
7 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
31 #include "SourceCode.h"
32 #include "SymbolTable.h"
33 #include <wtf/ListRefPtr.h>
34 #include <wtf/MathExtras.h>
35 #include <wtf/OwnPtr.h>
36 #include <wtf/Vector.h>
38 #if PLATFORM(X86) && COMPILER(GCC)
39 #define KJS_FAST_CALL __attribute__((regparm(3)))
49 class PropertyListNode
;
91 struct DeclarationStacks
{
92 typedef Vector
<Node
*, 16> NodeStack
;
93 enum { IsConstant
= 1, HasInitializer
= 2 } VarAttrs
;
94 typedef Vector
<std::pair
<Identifier
, unsigned>, 16> VarStack
;
95 typedef Vector
<FuncDeclNode
*, 16> FunctionStack
;
97 DeclarationStacks(ExecState
* e
, NodeStack
& n
, VarStack
& v
, FunctionStack
& f
)
106 NodeStack
& nodeStack
;
108 FunctionStack
& functionStack
;
111 class ParserRefCounted
: Noncopyable
{
113 ParserRefCounted() KJS_FAST_CALL
;
114 ParserRefCounted(PlacementNewAdoptType
) KJS_FAST_CALL
119 void ref() KJS_FAST_CALL
;
120 void deref() KJS_FAST_CALL
;
121 unsigned refcount() KJS_FAST_CALL
;
123 static void deleteNewObjects() KJS_FAST_CALL
;
125 virtual ~ParserRefCounted();
128 class Node
: public ParserRefCounted
{
130 typedef DeclarationStacks::NodeStack NodeStack
;
131 typedef DeclarationStacks::VarStack VarStack
;
132 typedef DeclarationStacks::FunctionStack FunctionStack
;
134 Node() KJS_FAST_CALL
;
135 Node(PlacementNewAdoptType placementAdopt
) KJS_FAST_CALL
136 : ParserRefCounted(placementAdopt
)
140 UString
toString() KJS_FAST_CALL
;
141 int lineNo() const KJS_FAST_CALL
{ return m_line
; }
144 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
= 0;
145 virtual Precedence
precedence() const = 0;
146 virtual bool needsParensIfLeftmost() const { return false; }
148 // Used for iterative, depth-first traversal of the node tree. Does not cross function call boundaries.
149 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
{ }
152 JSValue
* setInterruptedCompletion(ExecState
*);
153 Node(JSType
) KJS_FAST_CALL
; // used by ExpressionNode
155 // for use in execute()
156 JSValue
* setErrorCompletion(ExecState
*, ErrorType
, const char* msg
) KJS_FAST_CALL
;
157 JSValue
* setErrorCompletion(ExecState
*, ErrorType
, const char* msg
, const Identifier
&) KJS_FAST_CALL
;
159 // for use in evaluate()
160 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
) KJS_FAST_CALL
;
161 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, const char*) KJS_FAST_CALL
;
162 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, Node
*) KJS_FAST_CALL
;
163 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, const Identifier
&) KJS_FAST_CALL
;
164 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, const Identifier
&) KJS_FAST_CALL
;
165 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, Node
*, Node
*) KJS_FAST_CALL
;
166 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, Node
*, const Identifier
&) KJS_FAST_CALL
;
168 JSValue
* throwUndefinedVariableError(ExecState
*, const Identifier
&) KJS_FAST_CALL
;
170 void handleException(ExecState
*) KJS_FAST_CALL
;
171 void handleException(ExecState
*, JSValue
*) KJS_FAST_CALL
;
173 // for use in execute()
174 JSValue
* rethrowException(ExecState
*) KJS_FAST_CALL
;
177 unsigned m_expectedReturnType
: 3; // JSType
180 class ExpressionNode
: public Node
{
182 ExpressionNode() KJS_FAST_CALL
: Node() {}
183 ExpressionNode(JSType expectedReturn
) KJS_FAST_CALL
184 : Node(expectedReturn
)
188 // Special constructor for cases where we overwrite an object in place.
189 ExpressionNode(PlacementNewAdoptType
) KJS_FAST_CALL
190 : Node(PlacementNewAdopt
)
194 virtual bool isNumber() const KJS_FAST_CALL
{ return false; }
195 virtual bool isLocation() const KJS_FAST_CALL
{ return false; }
196 virtual bool isResolveNode() const KJS_FAST_CALL
{ return false; }
197 virtual bool isBracketAccessorNode() const KJS_FAST_CALL
{ return false; }
198 virtual bool isDotAccessorNode() const KJS_FAST_CALL
{ return false; }
199 virtual bool isFuncExprNode() const KJS_FAST_CALL
{ return false; }
201 JSType
expectedReturnType() const KJS_FAST_CALL
{ return static_cast<JSType
>(m_expectedReturnType
); }
203 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
= 0;
204 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
205 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
206 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
207 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
209 // Used to optimize those nodes that do extra work when returning a result, even if the result has no semantic relevance
210 virtual void optimizeForUnnecessaryResult() { }
213 class StatementNode
: public Node
{
215 StatementNode() KJS_FAST_CALL
;
216 void setLoc(int line0
, int line1
) KJS_FAST_CALL
;
217 int firstLine() const KJS_FAST_CALL
{ return lineNo(); }
218 int lastLine() const KJS_FAST_CALL
{ return m_lastLine
; }
219 virtual JSValue
* execute(ExecState
*exec
) KJS_FAST_CALL
= 0;
220 void pushLabel(const Identifier
& ident
) KJS_FAST_CALL
{ m_labelStack
.push(ident
); }
221 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
222 virtual bool isEmptyStatement() const KJS_FAST_CALL
{ return false; }
223 virtual bool isExprStatement() const KJS_FAST_CALL
{ return false; }
226 LabelStack m_labelStack
;
232 class NullNode
: public ExpressionNode
{
234 NullNode() KJS_FAST_CALL
: ExpressionNode(NullType
) {}
235 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
236 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
237 virtual Precedence
precedence() const { return PrecPrimary
; }
240 class FalseNode
: public ExpressionNode
{
242 FalseNode() KJS_FAST_CALL
243 : ExpressionNode(BooleanType
)
247 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
248 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
{ return false; }
249 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
250 virtual Precedence
precedence() const { return PrecPrimary
; }
253 class TrueNode
: public ExpressionNode
{
255 TrueNode() KJS_FAST_CALL
256 : ExpressionNode(BooleanType
)
260 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
261 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
{ return true; }
262 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
263 virtual Precedence
precedence() const { return PrecPrimary
; }
266 class PlaceholderTrueNode
: public TrueNode
{
268 // Like TrueNode, but does not serialize as "true".
269 PlaceholderTrueNode() KJS_FAST_CALL
274 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
277 class NumberNode
: public ExpressionNode
{
279 NumberNode(double v
) KJS_FAST_CALL
280 : ExpressionNode(NumberType
)
285 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
286 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
287 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
288 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
289 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
290 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
291 virtual Precedence
precedence() const { return signbit(m_double
) ? PrecUnary
: PrecPrimary
; }
293 virtual bool isNumber() const KJS_FAST_CALL
{ return true; }
294 double value() const KJS_FAST_CALL
{ return m_double
; }
295 virtual void setValue(double d
) KJS_FAST_CALL
{ m_double
= d
; }
301 class ImmediateNumberNode
: public NumberNode
{
303 ImmediateNumberNode(JSValue
* v
, double d
) KJS_FAST_CALL
307 ASSERT(v
== JSImmediate::from(d
));
310 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
311 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
312 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
314 virtual void setValue(double d
) KJS_FAST_CALL
{ m_double
= d
; m_value
= JSImmediate::from(d
); ASSERT(m_value
); }
317 JSValue
* m_value
; // This is never a JSCell, only JSImmediate, thus no ProtectedPtr
320 class StringNode
: public ExpressionNode
{
322 StringNode(const UString
* v
) KJS_FAST_CALL
323 : ExpressionNode(StringType
)
328 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
329 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
330 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
331 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
332 virtual Precedence
precedence() const { return PrecPrimary
; }
338 class RegExpNode
: public ExpressionNode
{
340 RegExpNode(const UString
& pattern
, const UString
& flags
) KJS_FAST_CALL
341 : m_regExp(new RegExp(pattern
, flags
))
345 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
346 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
347 virtual Precedence
precedence() const { return PrecPrimary
; }
350 RefPtr
<RegExp
> m_regExp
;
353 class ThisNode
: public ExpressionNode
{
355 ThisNode() KJS_FAST_CALL
359 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
360 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
361 virtual Precedence
precedence() const { return PrecPrimary
; }
364 class ResolveNode
: public ExpressionNode
{
366 ResolveNode(const Identifier
& ident
) KJS_FAST_CALL
371 // Special constructor for cases where we overwrite an object in place.
372 ResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
373 : ExpressionNode(PlacementNewAdopt
)
374 , m_ident(PlacementNewAdopt
)
378 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
380 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
381 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
382 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
383 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
384 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
385 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
386 virtual Precedence
precedence() const { return PrecPrimary
; }
388 virtual bool isLocation() const KJS_FAST_CALL
{ return true; }
389 virtual bool isResolveNode() const KJS_FAST_CALL
{ return true; }
390 const Identifier
& identifier() const KJS_FAST_CALL
{ return m_ident
; }
393 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
395 size_t m_index
; // Used by LocalVarAccessNode.
398 class LocalVarAccessNode
: public ResolveNode
{
400 // Overwrites a ResolveNode in place.
401 LocalVarAccessNode(size_t i
) KJS_FAST_CALL
402 : ResolveNode(PlacementNewAdopt
)
404 ASSERT(i
!= missingSymbolMarker());
408 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
409 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
410 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
411 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
412 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
415 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
418 class ElementNode
: public Node
{
420 ElementNode(int elision
, ExpressionNode
* node
) KJS_FAST_CALL
426 ElementNode(ElementNode
* l
, int elision
, ExpressionNode
* node
) KJS_FAST_CALL
433 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
434 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
435 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
437 PassRefPtr
<ElementNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
439 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
442 friend class ArrayNode
;
443 ListRefPtr
<ElementNode
> m_next
;
445 RefPtr
<ExpressionNode
> m_node
;
448 class ArrayNode
: public ExpressionNode
{
450 ArrayNode(int elision
) KJS_FAST_CALL
456 ArrayNode(ElementNode
* element
) KJS_FAST_CALL
463 ArrayNode(int elision
, ElementNode
* element
) KJS_FAST_CALL
470 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
471 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
472 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
473 virtual Precedence
precedence() const { return PrecPrimary
; }
476 RefPtr
<ElementNode
> m_element
;
481 class PropertyNode
: public Node
{
483 enum Type
{ Constant
, Getter
, Setter
};
485 PropertyNode(const Identifier
& name
, ExpressionNode
* assign
, Type type
) KJS_FAST_CALL
492 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
493 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
494 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
496 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
497 const Identifier
& name() const { return m_name
; }
500 friend class PropertyListNode
;
502 RefPtr
<ExpressionNode
> m_assign
;
506 class PropertyListNode
: public Node
{
508 PropertyListNode(PropertyNode
* node
) KJS_FAST_CALL
513 PropertyListNode(PropertyNode
* node
, PropertyListNode
* list
) KJS_FAST_CALL
519 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
520 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
521 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
523 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
524 PassRefPtr
<PropertyListNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
527 friend class ObjectLiteralNode
;
528 RefPtr
<PropertyNode
> m_node
;
529 ListRefPtr
<PropertyListNode
> m_next
;
532 class ObjectLiteralNode
: public ExpressionNode
{
534 ObjectLiteralNode() KJS_FAST_CALL
538 ObjectLiteralNode(PropertyListNode
* list
) KJS_FAST_CALL
543 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
544 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
545 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
546 virtual Precedence
precedence() const { return PrecPrimary
; }
547 virtual bool needsParensIfLeftmost() const { return true; }
550 RefPtr
<PropertyListNode
> m_list
;
553 class BracketAccessorNode
: public ExpressionNode
{
555 BracketAccessorNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
557 , m_subscript(subscript
)
561 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
562 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
563 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
564 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
565 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
566 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
567 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
568 virtual Precedence
precedence() const { return PrecMember
; }
570 virtual bool isLocation() const KJS_FAST_CALL
{ return true; }
571 virtual bool isBracketAccessorNode() const KJS_FAST_CALL
{ return true; }
572 ExpressionNode
* base() KJS_FAST_CALL
{ return m_base
.get(); }
573 ExpressionNode
* subscript() KJS_FAST_CALL
{ return m_subscript
.get(); }
576 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
578 RefPtr
<ExpressionNode
> m_base
;
579 RefPtr
<ExpressionNode
> m_subscript
;
582 class DotAccessorNode
: public ExpressionNode
{
584 DotAccessorNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
590 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
591 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
592 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
593 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
594 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
595 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
596 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
597 virtual Precedence
precedence() const { return PrecMember
; }
599 virtual bool isLocation() const KJS_FAST_CALL
{ return true; }
600 virtual bool isDotAccessorNode() const KJS_FAST_CALL
{ return true; }
601 ExpressionNode
* base() const KJS_FAST_CALL
{ return m_base
.get(); }
602 const Identifier
& identifier() const KJS_FAST_CALL
{ return m_ident
; }
605 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
607 RefPtr
<ExpressionNode
> m_base
;
611 class ArgumentListNode
: public Node
{
613 ArgumentListNode(ExpressionNode
* expr
) KJS_FAST_CALL
618 ArgumentListNode(ArgumentListNode
* listNode
, ExpressionNode
* expr
) KJS_FAST_CALL
621 listNode
->m_next
= this;
624 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
625 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
626 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
628 void evaluateList(ExecState
*, List
&) KJS_FAST_CALL
;
629 PassRefPtr
<ArgumentListNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
632 friend class ArgumentsNode
;
633 ListRefPtr
<ArgumentListNode
> m_next
;
634 RefPtr
<ExpressionNode
> m_expr
;
637 class ArgumentsNode
: public Node
{
639 ArgumentsNode() KJS_FAST_CALL
643 ArgumentsNode(ArgumentListNode
* listNode
) KJS_FAST_CALL
644 : m_listNode(listNode
)
648 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
649 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
650 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
652 void evaluateList(ExecState
* exec
, List
& list
) KJS_FAST_CALL
{ if (m_listNode
) m_listNode
->evaluateList(exec
, list
); }
655 RefPtr
<ArgumentListNode
> m_listNode
;
658 class NewExprNode
: public ExpressionNode
{
660 NewExprNode(ExpressionNode
* expr
) KJS_FAST_CALL
665 NewExprNode(ExpressionNode
* expr
, ArgumentsNode
* args
) KJS_FAST_CALL
671 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
672 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
673 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
674 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
675 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
676 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
677 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
678 virtual Precedence
precedence() const { return PrecLeftHandSide
; }
681 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
683 RefPtr
<ExpressionNode
> m_expr
;
684 RefPtr
<ArgumentsNode
> m_args
;
687 class FunctionCallValueNode
: public ExpressionNode
{
689 FunctionCallValueNode(ExpressionNode
* expr
, ArgumentsNode
* args
) KJS_FAST_CALL
695 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
696 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
697 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
698 virtual Precedence
precedence() const { return PrecCall
; }
701 RefPtr
<ExpressionNode
> m_expr
;
702 RefPtr
<ArgumentsNode
> m_args
;
705 class FunctionCallResolveNode
: public ExpressionNode
{
707 FunctionCallResolveNode(const Identifier
& ident
, ArgumentsNode
* args
) KJS_FAST_CALL
713 FunctionCallResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
714 : ExpressionNode(PlacementNewAdopt
)
715 , m_ident(PlacementNewAdopt
)
716 , m_args(PlacementNewAdopt
)
720 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
721 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
722 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
723 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
724 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
725 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
726 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
727 virtual Precedence
precedence() const { return PrecCall
; }
730 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
733 RefPtr
<ArgumentsNode
> m_args
;
734 size_t m_index
; // Used by LocalVarFunctionCallNode.
737 class LocalVarFunctionCallNode
: public FunctionCallResolveNode
{
739 LocalVarFunctionCallNode(size_t i
) KJS_FAST_CALL
740 : FunctionCallResolveNode(PlacementNewAdopt
)
742 ASSERT(i
!= missingSymbolMarker());
746 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
747 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
748 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
749 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
750 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
753 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
756 class FunctionCallBracketNode
: public ExpressionNode
{
758 FunctionCallBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
, ArgumentsNode
* args
) KJS_FAST_CALL
760 , m_subscript(subscript
)
765 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
766 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
767 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
768 virtual Precedence
precedence() const { return PrecCall
; }
771 RefPtr
<ExpressionNode
> m_base
;
772 RefPtr
<ExpressionNode
> m_subscript
;
773 RefPtr
<ArgumentsNode
> m_args
;
776 class FunctionCallDotNode
: public ExpressionNode
{
778 FunctionCallDotNode(ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
) KJS_FAST_CALL
785 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
786 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
787 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
788 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
789 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
790 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
791 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
792 virtual Precedence
precedence() const { return PrecCall
; }
795 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
797 RefPtr
<ExpressionNode
> m_base
;
799 RefPtr
<ArgumentsNode
> m_args
;
802 class PrePostResolveNode
: public ExpressionNode
{
804 PrePostResolveNode(const Identifier
& ident
) KJS_FAST_CALL
805 : ExpressionNode(NumberType
)
810 PrePostResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
811 : ExpressionNode(PlacementNewAdopt
)
812 , m_ident(PlacementNewAdopt
)
818 size_t m_index
; // Used by LocalVarPostfixNode.
821 class PostIncResolveNode
: public PrePostResolveNode
{
823 PostIncResolveNode(const Identifier
& ident
) KJS_FAST_CALL
824 : PrePostResolveNode(ident
)
828 PostIncResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
829 : PrePostResolveNode(PlacementNewAdopt
)
833 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
834 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
835 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
836 virtual Precedence
precedence() const { return PrecPostfix
; }
837 virtual void optimizeForUnnecessaryResult();
840 class PostIncLocalVarNode
: public PostIncResolveNode
{
842 PostIncLocalVarNode(size_t i
) KJS_FAST_CALL
843 : PostIncResolveNode(PlacementNewAdopt
)
845 ASSERT(i
!= missingSymbolMarker());
849 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
850 virtual void optimizeForUnnecessaryResult();
853 class PostIncConstNode
: public PostIncResolveNode
{
855 PostIncConstNode(size_t i
) KJS_FAST_CALL
856 : PostIncResolveNode(PlacementNewAdopt
)
858 ASSERT(i
!= missingSymbolMarker());
862 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
865 class PostDecResolveNode
: public PrePostResolveNode
{
867 PostDecResolveNode(const Identifier
& ident
) KJS_FAST_CALL
868 : PrePostResolveNode(ident
)
872 PostDecResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
873 : PrePostResolveNode(PlacementNewAdopt
)
877 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
878 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
879 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
880 virtual Precedence
precedence() const { return PrecPostfix
; }
881 virtual void optimizeForUnnecessaryResult();
884 class PostDecLocalVarNode
: public PostDecResolveNode
{
886 PostDecLocalVarNode(size_t i
) KJS_FAST_CALL
887 : PostDecResolveNode(PlacementNewAdopt
)
889 ASSERT(i
!= missingSymbolMarker());
893 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
894 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
895 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
896 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
897 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
898 virtual void optimizeForUnnecessaryResult();
901 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
904 class PostDecConstNode
: public PostDecResolveNode
{
906 PostDecConstNode(size_t i
) KJS_FAST_CALL
907 : PostDecResolveNode(PlacementNewAdopt
)
909 ASSERT(i
!= missingSymbolMarker());
913 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
916 class PostfixBracketNode
: public ExpressionNode
{
918 PostfixBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
920 , m_subscript(subscript
)
924 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
925 virtual Precedence
precedence() const { return PrecPostfix
; }
928 RefPtr
<ExpressionNode
> m_base
;
929 RefPtr
<ExpressionNode
> m_subscript
;
932 class PostIncBracketNode
: public PostfixBracketNode
{
934 PostIncBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
935 : PostfixBracketNode(base
, subscript
)
939 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
940 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
943 class PostDecBracketNode
: public PostfixBracketNode
{
945 PostDecBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
946 : PostfixBracketNode(base
, subscript
)
950 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
951 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
954 class PostfixDotNode
: public ExpressionNode
{
956 PostfixDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
962 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
963 virtual Precedence
precedence() const { return PrecPostfix
; }
966 RefPtr
<ExpressionNode
> m_base
;
970 class PostIncDotNode
: public PostfixDotNode
{
972 PostIncDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
973 : PostfixDotNode(base
, ident
)
977 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
978 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
981 class PostDecDotNode
: public PostfixDotNode
{
983 PostDecDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
984 : PostfixDotNode(base
, ident
)
988 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
989 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
992 class PostfixErrorNode
: public ExpressionNode
{
994 PostfixErrorNode(ExpressionNode
* expr
, Operator oper
) KJS_FAST_CALL
1000 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1001 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1002 virtual Precedence
precedence() const { return PrecPostfix
; }
1005 RefPtr
<ExpressionNode
> m_expr
;
1006 Operator m_operator
;
1009 class DeleteResolveNode
: public ExpressionNode
{
1011 DeleteResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1016 DeleteResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1017 : ExpressionNode(PlacementNewAdopt
)
1018 , m_ident(PlacementNewAdopt
)
1022 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1023 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1024 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1025 virtual Precedence
precedence() const { return PrecUnary
; }
1031 class LocalVarDeleteNode
: public DeleteResolveNode
{
1033 LocalVarDeleteNode() KJS_FAST_CALL
1034 : DeleteResolveNode(PlacementNewAdopt
)
1038 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1041 class DeleteBracketNode
: public ExpressionNode
{
1043 DeleteBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1045 , m_subscript(subscript
)
1049 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1050 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1051 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1052 virtual Precedence
precedence() const { return PrecUnary
; }
1055 RefPtr
<ExpressionNode
> m_base
;
1056 RefPtr
<ExpressionNode
> m_subscript
;
1059 class DeleteDotNode
: public ExpressionNode
{
1061 DeleteDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1067 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1068 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1069 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1070 virtual Precedence
precedence() const { return PrecUnary
; }
1073 RefPtr
<ExpressionNode
> m_base
;
1077 class DeleteValueNode
: public ExpressionNode
{
1079 DeleteValueNode(ExpressionNode
* expr
) KJS_FAST_CALL
1084 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1085 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1086 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1087 virtual Precedence
precedence() const { return PrecUnary
; }
1090 RefPtr
<ExpressionNode
> m_expr
;
1093 class VoidNode
: public ExpressionNode
{
1095 VoidNode(ExpressionNode
* expr
) KJS_FAST_CALL
1100 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1101 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1102 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1103 virtual Precedence
precedence() const { return PrecUnary
; }
1106 RefPtr
<ExpressionNode
> m_expr
;
1109 class TypeOfResolveNode
: public ExpressionNode
{
1111 TypeOfResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1112 : ExpressionNode(StringType
)
1117 TypeOfResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1118 : ExpressionNode(PlacementNewAdopt
)
1119 , m_ident(PlacementNewAdopt
)
1121 m_expectedReturnType
= StringType
;
1124 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1126 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1127 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1128 virtual Precedence
precedence() const { return PrecUnary
; }
1130 const Identifier
& identifier() const KJS_FAST_CALL
{ return m_ident
; }
1134 size_t m_index
; // Used by LocalTypeOfNode.
1137 class LocalVarTypeOfNode
: public TypeOfResolveNode
{
1139 LocalVarTypeOfNode(size_t i
) KJS_FAST_CALL
1140 : TypeOfResolveNode(PlacementNewAdopt
)
1142 m_expectedReturnType
= StringType
;
1143 ASSERT(i
!= missingSymbolMarker());
1147 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1150 class TypeOfValueNode
: public ExpressionNode
{
1152 TypeOfValueNode(ExpressionNode
* expr
) KJS_FAST_CALL
1153 : ExpressionNode(StringType
)
1158 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1159 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1160 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1161 virtual Precedence
precedence() const { return PrecUnary
; }
1164 RefPtr
<ExpressionNode
> m_expr
;
1167 class PreIncResolveNode
: public PrePostResolveNode
{
1169 PreIncResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1170 : PrePostResolveNode(ident
)
1174 PreIncResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1175 : PrePostResolveNode(PlacementNewAdopt
)
1179 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1181 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1182 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1183 virtual Precedence
precedence() const { return PrecUnary
; }
1186 class PreIncLocalVarNode
: public PreIncResolveNode
{
1188 PreIncLocalVarNode(size_t i
) KJS_FAST_CALL
1189 : PreIncResolveNode(PlacementNewAdopt
)
1191 ASSERT(i
!= missingSymbolMarker());
1195 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1198 class PreIncConstNode
: public PreIncResolveNode
{
1200 PreIncConstNode(size_t i
) KJS_FAST_CALL
1201 : PreIncResolveNode(PlacementNewAdopt
)
1203 ASSERT(i
!= missingSymbolMarker());
1207 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1210 class PreDecResolveNode
: public PrePostResolveNode
{
1212 PreDecResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1213 : PrePostResolveNode(ident
)
1217 PreDecResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1218 : PrePostResolveNode(PlacementNewAdopt
)
1222 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1224 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1225 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1226 virtual Precedence
precedence() const { return PrecUnary
; }
1229 class PreDecLocalVarNode
: public PreDecResolveNode
{
1231 PreDecLocalVarNode(size_t i
) KJS_FAST_CALL
1232 : PreDecResolveNode(PlacementNewAdopt
)
1234 ASSERT(i
!= missingSymbolMarker());
1238 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1241 class PreDecConstNode
: public PreDecResolveNode
{
1243 PreDecConstNode(size_t i
) KJS_FAST_CALL
1244 : PreDecResolveNode(PlacementNewAdopt
)
1246 ASSERT(i
!= missingSymbolMarker());
1250 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1253 class PrefixBracketNode
: public ExpressionNode
{
1255 PrefixBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1257 , m_subscript(subscript
)
1261 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1262 virtual Precedence
precedence() const { return PrecUnary
; }
1265 RefPtr
<ExpressionNode
> m_base
;
1266 RefPtr
<ExpressionNode
> m_subscript
;
1269 class PreIncBracketNode
: public PrefixBracketNode
{
1271 PreIncBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1272 : PrefixBracketNode(base
, subscript
)
1276 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1277 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1280 class PreDecBracketNode
: public PrefixBracketNode
{
1282 PreDecBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1283 : PrefixBracketNode(base
, subscript
)
1287 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1288 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1291 class PrefixDotNode
: public ExpressionNode
{
1293 PrefixDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1299 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1300 virtual Precedence
precedence() const { return PrecPostfix
; }
1303 RefPtr
<ExpressionNode
> m_base
;
1307 class PreIncDotNode
: public PrefixDotNode
{
1309 PreIncDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1310 : PrefixDotNode(base
, ident
)
1314 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1315 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1318 class PreDecDotNode
: public PrefixDotNode
{
1320 PreDecDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1321 : PrefixDotNode(base
, ident
)
1325 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1326 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1329 class PrefixErrorNode
: public ExpressionNode
{
1331 PrefixErrorNode(ExpressionNode
* expr
, Operator oper
) KJS_FAST_CALL
1337 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1338 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1339 virtual Precedence
precedence() const { return PrecUnary
; }
1342 RefPtr
<ExpressionNode
> m_expr
;
1343 Operator m_operator
;
1346 class UnaryPlusNode
: public ExpressionNode
{
1348 UnaryPlusNode(ExpressionNode
* expr
) KJS_FAST_CALL
1349 : ExpressionNode(NumberType
)
1354 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1355 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1356 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1357 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1358 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1359 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1360 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1361 virtual Precedence
precedence() const { return PrecUnary
; }
1364 RefPtr
<ExpressionNode
> m_expr
;
1367 class NegateNode
: public ExpressionNode
{
1369 NegateNode(ExpressionNode
* expr
) KJS_FAST_CALL
1370 : ExpressionNode(NumberType
)
1375 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1376 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1377 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1378 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1379 virtual Precedence
precedence() const { return PrecUnary
; }
1382 RefPtr
<ExpressionNode
> m_expr
;
1385 class BitwiseNotNode
: public ExpressionNode
{
1387 BitwiseNotNode(ExpressionNode
* expr
) KJS_FAST_CALL
1388 : ExpressionNode(NumberType
)
1393 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1394 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1395 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1396 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1397 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1398 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1399 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1400 virtual Precedence
precedence() const { return PrecUnary
; }
1403 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1405 RefPtr
<ExpressionNode
> m_expr
;
1408 class LogicalNotNode
: public ExpressionNode
{
1410 LogicalNotNode(ExpressionNode
* expr
) KJS_FAST_CALL
1411 : ExpressionNode(BooleanType
)
1416 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1417 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1418 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1419 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1420 virtual Precedence
precedence() const { return PrecUnary
; }
1423 RefPtr
<ExpressionNode
> m_expr
;
1426 class MultNode
: public ExpressionNode
{
1428 MultNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1429 : ExpressionNode(NumberType
)
1435 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1436 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1437 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1438 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1439 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1440 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1441 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1442 virtual Precedence
precedence() const { return PrecMultiplicitave
; }
1445 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1447 RefPtr
<ExpressionNode
> m_term1
;
1448 RefPtr
<ExpressionNode
> m_term2
;
1451 class DivNode
: public ExpressionNode
{
1453 DivNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1454 : ExpressionNode(NumberType
)
1460 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1461 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1462 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1463 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1464 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1465 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1466 virtual Precedence
precedence() const { return PrecMultiplicitave
; }
1469 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1471 RefPtr
<ExpressionNode
> m_term1
;
1472 RefPtr
<ExpressionNode
> m_term2
;
1475 class ModNode
: public ExpressionNode
{
1477 ModNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1478 : ExpressionNode(NumberType
)
1484 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1485 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1486 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1487 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1488 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1489 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1490 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1491 virtual Precedence
precedence() const { return PrecMultiplicitave
; }
1494 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1496 RefPtr
<ExpressionNode
> m_term1
;
1497 RefPtr
<ExpressionNode
> m_term2
;
1500 class AddNode
: public ExpressionNode
{
1502 AddNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1508 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1509 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1510 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1511 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1512 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1513 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1514 virtual Precedence
precedence() const { return PrecAdditive
; }
1517 AddNode(ExpressionNode
* term1
, ExpressionNode
* term2
, JSType expectedReturn
) KJS_FAST_CALL
1518 : ExpressionNode(expectedReturn
)
1524 RefPtr
<ExpressionNode
> m_term1
;
1525 RefPtr
<ExpressionNode
> m_term2
;
1528 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1531 class AddNumbersNode
: public AddNode
{
1533 AddNumbersNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1534 : AddNode(term1
, term2
, NumberType
)
1538 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1539 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1540 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1541 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1544 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1547 class AddStringLeftNode
: public AddNode
{
1549 AddStringLeftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1550 : AddNode(term1
, term2
, StringType
)
1554 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1557 class AddStringRightNode
: public AddNode
{
1559 AddStringRightNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1560 : AddNode(term1
, term2
, StringType
)
1564 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1567 class AddStringsNode
: public AddNode
{
1569 AddStringsNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1570 : AddNode(term1
, term2
, StringType
)
1574 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1577 class SubNode
: public ExpressionNode
{
1579 SubNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1580 : ExpressionNode(NumberType
)
1586 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1587 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1588 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1589 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1590 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1591 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1592 virtual Precedence
precedence() const { return PrecAdditive
; }
1595 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1597 RefPtr
<ExpressionNode
> m_term1
;
1598 RefPtr
<ExpressionNode
> m_term2
;
1601 class LeftShiftNode
: public ExpressionNode
{
1603 LeftShiftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1604 : ExpressionNode(NumberType
)
1610 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1611 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1612 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1613 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1614 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1615 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1616 virtual Precedence
precedence() const { return PrecShift
; }
1619 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1621 RefPtr
<ExpressionNode
> m_term1
;
1622 RefPtr
<ExpressionNode
> m_term2
;
1625 class RightShiftNode
: public ExpressionNode
{
1627 RightShiftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1628 : ExpressionNode(NumberType
)
1634 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1635 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1636 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1637 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1638 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1639 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1640 virtual Precedence
precedence() const { return PrecShift
; }
1643 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1645 RefPtr
<ExpressionNode
> m_term1
;
1646 RefPtr
<ExpressionNode
> m_term2
;
1649 class UnsignedRightShiftNode
: public ExpressionNode
{
1651 UnsignedRightShiftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1652 : ExpressionNode(NumberType
)
1658 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1659 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1660 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1661 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1662 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1663 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1664 virtual Precedence
precedence() const { return PrecShift
; }
1666 ALWAYS_INLINE
uint32_t inlineEvaluateToUInt32(ExecState
*);
1668 RefPtr
<ExpressionNode
> m_term1
;
1669 RefPtr
<ExpressionNode
> m_term2
;
1672 class LessNode
: public ExpressionNode
{
1674 LessNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1675 : ExpressionNode(BooleanType
)
1681 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1682 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1683 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1684 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1685 virtual Precedence
precedence() const { return PrecRelational
; }
1688 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1691 RefPtr
<ExpressionNode
> m_expr1
;
1692 RefPtr
<ExpressionNode
> m_expr2
;
1695 class LessNumbersNode
: public LessNode
{
1697 LessNumbersNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1698 : LessNode(expr1
, expr2
)
1702 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1703 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1706 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1709 class LessStringsNode
: public LessNode
{
1711 LessStringsNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1712 : LessNode(expr1
, expr2
)
1716 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1717 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1720 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1723 class GreaterNode
: public ExpressionNode
{
1725 GreaterNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1731 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1732 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1733 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1734 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1735 virtual Precedence
precedence() const { return PrecRelational
; }
1738 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1740 RefPtr
<ExpressionNode
> m_expr1
;
1741 RefPtr
<ExpressionNode
> m_expr2
;
1744 class LessEqNode
: public ExpressionNode
{
1746 LessEqNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1752 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1753 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1754 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1755 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1756 virtual Precedence
precedence() const { return PrecRelational
; }
1759 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1761 RefPtr
<ExpressionNode
> m_expr1
;
1762 RefPtr
<ExpressionNode
> m_expr2
;
1765 class GreaterEqNode
: public ExpressionNode
{
1767 GreaterEqNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1773 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1774 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1775 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1776 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1777 virtual Precedence
precedence() const { return PrecRelational
; }
1780 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1782 RefPtr
<ExpressionNode
> m_expr1
;
1783 RefPtr
<ExpressionNode
> m_expr2
;
1786 class InstanceOfNode
: public ExpressionNode
{
1788 InstanceOfNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1789 : ExpressionNode(BooleanType
)
1795 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1796 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1797 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1798 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1799 virtual Precedence
precedence() const { return PrecRelational
; }
1802 RefPtr
<ExpressionNode
> m_expr1
;
1803 RefPtr
<ExpressionNode
> m_expr2
;
1806 class InNode
: public ExpressionNode
{
1808 InNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1814 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1815 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1816 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1817 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1818 virtual Precedence
precedence() const { return PrecRelational
; }
1821 RefPtr
<ExpressionNode
> m_expr1
;
1822 RefPtr
<ExpressionNode
> m_expr2
;
1825 class EqualNode
: public ExpressionNode
{
1827 EqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1828 : ExpressionNode(BooleanType
)
1834 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1835 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1836 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1837 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1838 virtual Precedence
precedence() const { return PrecEquality
; }
1841 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1843 RefPtr
<ExpressionNode
> m_expr1
;
1844 RefPtr
<ExpressionNode
> m_expr2
;
1847 class NotEqualNode
: public ExpressionNode
{
1849 NotEqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1850 : ExpressionNode(BooleanType
)
1856 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1857 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1858 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1859 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1860 virtual Precedence
precedence() const { return PrecEquality
; }
1863 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1865 RefPtr
<ExpressionNode
> m_expr1
;
1866 RefPtr
<ExpressionNode
> m_expr2
;
1869 class StrictEqualNode
: public ExpressionNode
{
1871 StrictEqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1872 : ExpressionNode(BooleanType
)
1878 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1879 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1880 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1881 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1882 virtual Precedence
precedence() const { return PrecEquality
; }
1885 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1887 RefPtr
<ExpressionNode
> m_expr1
;
1888 RefPtr
<ExpressionNode
> m_expr2
;
1891 class NotStrictEqualNode
: public ExpressionNode
{
1893 NotStrictEqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1894 : ExpressionNode(BooleanType
)
1900 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1901 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1902 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1903 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1904 virtual Precedence
precedence() const { return PrecEquality
; }
1907 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1909 RefPtr
<ExpressionNode
> m_expr1
;
1910 RefPtr
<ExpressionNode
> m_expr2
;
1913 class BitAndNode
: public ExpressionNode
{
1915 BitAndNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1916 : ExpressionNode(NumberType
)
1922 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1923 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1924 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1925 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1926 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1927 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1928 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1929 virtual Precedence
precedence() const { return PrecBitwiseAnd
; }
1932 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1934 RefPtr
<ExpressionNode
> m_expr1
;
1935 RefPtr
<ExpressionNode
> m_expr2
;
1938 class BitOrNode
: public ExpressionNode
{
1940 BitOrNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1941 : ExpressionNode(NumberType
)
1947 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1948 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1949 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1950 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1951 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1952 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1953 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1954 virtual Precedence
precedence() const { return PrecBitwiseOr
; }
1957 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1959 RefPtr
<ExpressionNode
> m_expr1
;
1960 RefPtr
<ExpressionNode
> m_expr2
;
1963 class BitXOrNode
: public ExpressionNode
{
1965 BitXOrNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1966 : ExpressionNode(NumberType
)
1972 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1973 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1974 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1975 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1976 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1977 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1978 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
1979 virtual Precedence
precedence() const { return PrecBitwiseXor
; }
1982 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1984 RefPtr
<ExpressionNode
> m_expr1
;
1985 RefPtr
<ExpressionNode
> m_expr2
;
1989 * m_expr1 && m_expr2, m_expr1 || m_expr2
1991 class LogicalAndNode
: public ExpressionNode
{
1993 LogicalAndNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1994 : ExpressionNode(BooleanType
)
2000 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2001 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2002 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
2003 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2004 virtual Precedence
precedence() const { return PrecLogicalAnd
; }
2007 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
2009 RefPtr
<ExpressionNode
> m_expr1
;
2010 RefPtr
<ExpressionNode
> m_expr2
;
2013 class LogicalOrNode
: public ExpressionNode
{
2015 LogicalOrNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2016 : ExpressionNode(BooleanType
)
2022 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2023 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2024 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
2025 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2026 virtual Precedence
precedence() const { return PrecLogicalOr
; }
2029 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
2031 RefPtr
<ExpressionNode
> m_expr1
;
2032 RefPtr
<ExpressionNode
> m_expr2
;
2036 * The ternary operator, "m_logical ? m_expr1 : m_expr2"
2038 class ConditionalNode
: public ExpressionNode
{
2040 ConditionalNode(ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2041 : m_logical(logical
)
2047 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2048 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2049 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
2050 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
2051 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
2052 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
2053 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2054 virtual Precedence
precedence() const { return PrecConditional
; }
2057 RefPtr
<ExpressionNode
> m_logical
;
2058 RefPtr
<ExpressionNode
> m_expr1
;
2059 RefPtr
<ExpressionNode
> m_expr2
;
2062 class ReadModifyResolveNode
: public ExpressionNode
{
2064 ReadModifyResolveNode(const Identifier
& ident
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2071 ReadModifyResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
2072 : ExpressionNode(PlacementNewAdopt
)
2073 , m_ident(PlacementNewAdopt
)
2074 , m_right(PlacementNewAdopt
)
2078 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2079 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2080 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2081 virtual Precedence
precedence() const { return PrecAssignment
; }
2085 Operator m_operator
;
2086 RefPtr
<ExpressionNode
> m_right
;
2087 size_t m_index
; // Used by ReadModifyLocalVarNode.
2090 class ReadModifyLocalVarNode
: public ReadModifyResolveNode
{
2092 ReadModifyLocalVarNode(size_t i
) KJS_FAST_CALL
2093 : ReadModifyResolveNode(PlacementNewAdopt
)
2095 ASSERT(i
!= missingSymbolMarker());
2099 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2102 class ReadModifyConstNode
: public ReadModifyResolveNode
{
2104 ReadModifyConstNode(size_t i
) KJS_FAST_CALL
2105 : ReadModifyResolveNode(PlacementNewAdopt
)
2107 ASSERT(i
!= missingSymbolMarker());
2111 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2114 class AssignResolveNode
: public ExpressionNode
{
2116 AssignResolveNode(const Identifier
& ident
, ExpressionNode
* right
) KJS_FAST_CALL
2122 AssignResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
2123 : ExpressionNode(PlacementNewAdopt
)
2124 , m_ident(PlacementNewAdopt
)
2125 , m_right(PlacementNewAdopt
)
2129 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2130 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2131 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2132 virtual Precedence
precedence() const { return PrecAssignment
; }
2136 RefPtr
<ExpressionNode
> m_right
;
2137 size_t m_index
; // Used by ReadModifyLocalVarNode.
2140 class AssignLocalVarNode
: public AssignResolveNode
{
2142 AssignLocalVarNode(size_t i
) KJS_FAST_CALL
2143 : AssignResolveNode(PlacementNewAdopt
)
2145 ASSERT(i
!= missingSymbolMarker());
2149 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2152 class AssignConstNode
: public AssignResolveNode
{
2154 AssignConstNode() KJS_FAST_CALL
2155 : AssignResolveNode(PlacementNewAdopt
)
2159 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2162 class ReadModifyBracketNode
: public ExpressionNode
{
2164 ReadModifyBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2166 , m_subscript(subscript
)
2172 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2173 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2174 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2175 virtual Precedence
precedence() const { return PrecAssignment
; }
2178 RefPtr
<ExpressionNode
> m_base
;
2179 RefPtr
<ExpressionNode
> m_subscript
;
2180 Operator m_operator
;
2181 RefPtr
<ExpressionNode
> m_right
;
2184 class AssignBracketNode
: public ExpressionNode
{
2186 AssignBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
, ExpressionNode
* right
) KJS_FAST_CALL
2188 , m_subscript(subscript
)
2193 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2194 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2195 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2196 virtual Precedence
precedence() const { return PrecAssignment
; }
2199 RefPtr
<ExpressionNode
> m_base
;
2200 RefPtr
<ExpressionNode
> m_subscript
;
2201 RefPtr
<ExpressionNode
> m_right
;
2204 class AssignDotNode
: public ExpressionNode
{
2206 AssignDotNode(ExpressionNode
* base
, const Identifier
& ident
, ExpressionNode
* right
) KJS_FAST_CALL
2213 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2214 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2215 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2216 virtual Precedence
precedence() const { return PrecAssignment
; }
2219 RefPtr
<ExpressionNode
> m_base
;
2221 RefPtr
<ExpressionNode
> m_right
;
2224 class ReadModifyDotNode
: public ExpressionNode
{
2226 ReadModifyDotNode(ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2234 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2235 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2236 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2237 virtual Precedence
precedence() const { return PrecAssignment
; }
2240 RefPtr
<ExpressionNode
> m_base
;
2242 Operator m_operator
;
2243 RefPtr
<ExpressionNode
> m_right
;
2246 class AssignErrorNode
: public ExpressionNode
{
2248 AssignErrorNode(ExpressionNode
* left
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2255 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2256 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2257 virtual Precedence
precedence() const { return PrecAssignment
; }
2260 RefPtr
<ExpressionNode
> m_left
;
2261 Operator m_operator
;
2262 RefPtr
<ExpressionNode
> m_right
;
2265 class CommaNode
: public ExpressionNode
{
2267 CommaNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2271 m_expr1
->optimizeForUnnecessaryResult();
2274 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2275 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2276 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2277 virtual Precedence
precedence() const { return PrecExpression
; }
2280 RefPtr
<ExpressionNode
> m_expr1
;
2281 RefPtr
<ExpressionNode
> m_expr2
;
2284 class VarDeclCommaNode
: public CommaNode
{
2286 VarDeclCommaNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2287 : CommaNode(expr1
, expr2
)
2290 virtual Precedence
precedence() const { return PrecAssignment
; }
2293 class ConstDeclNode
: public ExpressionNode
{
2295 ConstDeclNode(const Identifier
& ident
, ExpressionNode
* in
) KJS_FAST_CALL
;
2297 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2298 virtual KJS::JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2299 void evaluateSingle(ExecState
*) KJS_FAST_CALL
;
2300 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2301 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2302 PassRefPtr
<ConstDeclNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
2305 ListRefPtr
<ConstDeclNode
> m_next
;
2306 RefPtr
<ExpressionNode
> m_init
;
2309 void handleSlowCase(ExecState
*, const ScopeChain
&, JSValue
*) KJS_FAST_CALL NEVER_INLINE
;
2312 class ConstStatementNode
: public StatementNode
{
2314 ConstStatementNode(ConstDeclNode
* next
) KJS_FAST_CALL
2319 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2320 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2321 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2324 RefPtr
<ConstDeclNode
> m_next
;
2327 typedef Vector
<RefPtr
<StatementNode
> > StatementVector
;
2329 class SourceElements
: public ParserRefCounted
{
2331 void append(PassRefPtr
<StatementNode
>);
2332 void releaseContentsIntoVector(StatementVector
& destination
)
2334 ASSERT(destination
.isEmpty());
2335 m_statements
.swap(destination
);
2339 StatementVector m_statements
;
2342 class BlockNode
: public StatementNode
{
2344 BlockNode() KJS_FAST_CALL
;
2345 BlockNode(SourceElements
* children
) KJS_FAST_CALL
;
2347 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2348 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2349 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2352 StatementVector m_children
;
2355 class EmptyStatementNode
: public StatementNode
{
2357 EmptyStatementNode() KJS_FAST_CALL
// debug
2361 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2362 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2363 virtual bool isEmptyStatement() const KJS_FAST_CALL
{ return true; }
2366 class ExprStatementNode
: public StatementNode
{
2368 ExprStatementNode(ExpressionNode
* expr
) KJS_FAST_CALL
2373 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2374 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2375 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2376 virtual bool isExprStatement() const KJS_FAST_CALL
{ return true; }
2378 ExpressionNode
* expr() const { return m_expr
.get(); }
2381 RefPtr
<ExpressionNode
> m_expr
;
2384 class VarStatementNode
: public StatementNode
{
2386 VarStatementNode(ExpressionNode
* expr
) KJS_FAST_CALL
2391 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2392 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2393 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2396 RefPtr
<ExpressionNode
> m_expr
;
2399 class IfNode
: public StatementNode
{
2401 IfNode(ExpressionNode
* condition
, StatementNode
* ifBlock
) KJS_FAST_CALL
2402 : m_condition(condition
)
2403 , m_ifBlock(ifBlock
)
2407 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2408 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2409 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2412 RefPtr
<ExpressionNode
> m_condition
;
2413 RefPtr
<StatementNode
> m_ifBlock
;
2416 class IfElseNode
: public IfNode
{
2418 IfElseNode(ExpressionNode
* condtion
, StatementNode
* ifBlock
, StatementNode
* elseBlock
) KJS_FAST_CALL
2419 : IfNode(condtion
, ifBlock
)
2420 , m_elseBlock(elseBlock
)
2424 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2425 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2426 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2429 RefPtr
<StatementNode
> m_elseBlock
;
2432 class DoWhileNode
: public StatementNode
{
2434 DoWhileNode(StatementNode
* statement
, ExpressionNode
* expr
) KJS_FAST_CALL
2435 : m_statement(statement
)
2440 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2441 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2442 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2445 RefPtr
<StatementNode
> m_statement
;
2446 RefPtr
<ExpressionNode
> m_expr
;
2449 class WhileNode
: public StatementNode
{
2451 WhileNode(ExpressionNode
* expr
, StatementNode
* statement
) KJS_FAST_CALL
2453 , m_statement(statement
)
2457 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2458 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2459 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2462 RefPtr
<ExpressionNode
> m_expr
;
2463 RefPtr
<StatementNode
> m_statement
;
2466 class ForNode
: public StatementNode
{
2468 ForNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
, bool expr1WasVarDecl
) KJS_FAST_CALL
2469 : m_expr1(expr1
? expr1
: new PlaceholderTrueNode
)
2470 , m_expr2(expr2
? expr2
: new PlaceholderTrueNode
)
2471 , m_expr3(expr3
? expr3
: new PlaceholderTrueNode
)
2472 , m_statement(statement
)
2473 , m_expr1WasVarDecl(expr1
&& expr1WasVarDecl
)
2480 m_expr1
->optimizeForUnnecessaryResult();
2481 m_expr3
->optimizeForUnnecessaryResult();
2484 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2485 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2486 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2489 RefPtr
<ExpressionNode
> m_expr1
;
2490 RefPtr
<ExpressionNode
> m_expr2
;
2491 RefPtr
<ExpressionNode
> m_expr3
;
2492 RefPtr
<StatementNode
> m_statement
;
2493 bool m_expr1WasVarDecl
;
2496 class ForInNode
: public StatementNode
{
2498 ForInNode(ExpressionNode
*, ExpressionNode
*, StatementNode
*) KJS_FAST_CALL
;
2499 ForInNode(const Identifier
&, ExpressionNode
*, ExpressionNode
*, StatementNode
*) KJS_FAST_CALL
;
2501 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2502 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2503 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2507 RefPtr
<ExpressionNode
> m_init
;
2508 RefPtr
<ExpressionNode
> m_lexpr
;
2509 RefPtr
<ExpressionNode
> m_expr
;
2510 RefPtr
<StatementNode
> m_statement
;
2511 bool m_identIsVarDecl
;
2514 class ContinueNode
: public StatementNode
{
2516 ContinueNode() KJS_FAST_CALL
2520 ContinueNode(const Identifier
& ident
) KJS_FAST_CALL
2525 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2526 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2532 class BreakNode
: public StatementNode
{
2534 BreakNode() KJS_FAST_CALL
2538 BreakNode(const Identifier
& ident
) KJS_FAST_CALL
2543 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2544 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2550 class ReturnNode
: public StatementNode
{
2552 ReturnNode(ExpressionNode
* value
) KJS_FAST_CALL
2557 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2558 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2559 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2562 RefPtr
<ExpressionNode
> m_value
;
2565 class WithNode
: public StatementNode
{
2567 WithNode(ExpressionNode
* expr
, StatementNode
* statement
) KJS_FAST_CALL
2569 , m_statement(statement
)
2573 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2574 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2575 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2578 RefPtr
<ExpressionNode
> m_expr
;
2579 RefPtr
<StatementNode
> m_statement
;
2582 class LabelNode
: public StatementNode
{
2584 LabelNode(const Identifier
& label
, StatementNode
* statement
) KJS_FAST_CALL
2586 , m_statement(statement
)
2590 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2591 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2592 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2596 RefPtr
<StatementNode
> m_statement
;
2599 class ThrowNode
: public StatementNode
{
2601 ThrowNode(ExpressionNode
* expr
) KJS_FAST_CALL
2606 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2607 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2608 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2611 RefPtr
<ExpressionNode
> m_expr
;
2614 class TryNode
: public StatementNode
{
2616 TryNode(StatementNode
* tryBlock
, const Identifier
& exceptionIdent
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
) KJS_FAST_CALL
2617 : m_tryBlock(tryBlock
)
2618 , m_exceptionIdent(exceptionIdent
)
2619 , m_catchBlock(catchBlock
)
2620 , m_finallyBlock(finallyBlock
)
2624 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2625 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2626 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2629 RefPtr
<StatementNode
> m_tryBlock
;
2630 Identifier m_exceptionIdent
;
2631 RefPtr
<StatementNode
> m_catchBlock
;
2632 RefPtr
<StatementNode
> m_finallyBlock
;
2635 class ParameterNode
: public Node
{
2637 ParameterNode(const Identifier
& ident
) KJS_FAST_CALL
2642 ParameterNode(ParameterNode
* l
, const Identifier
& ident
) KJS_FAST_CALL
2648 Identifier
ident() KJS_FAST_CALL
{ return m_ident
; }
2649 ParameterNode
*nextParam() KJS_FAST_CALL
{ return m_next
.get(); }
2650 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2651 PassRefPtr
<ParameterNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
2652 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2655 friend class FuncDeclNode
;
2656 friend class FuncExprNode
;
2658 ListRefPtr
<ParameterNode
> m_next
;
2661 class ScopeNode
: public BlockNode
{
2663 ScopeNode() KJS_FAST_CALL
;
2664 ScopeNode(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2666 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2668 void setSource(const SourceCode
& source
) { m_source
= source
; }
2669 const SourceCode
& source() const { return m_source
; }
2670 const UString
& sourceURL() const KJS_FAST_CALL
{ return m_source
.provider()->url(); }
2671 intptr_t sourceID() const { return m_source
.provider()->asID(); }
2673 void setData(SourceElements
*, VarStack
*, FunctionStack
*);
2676 void optimizeVariableAccess(ExecState
*) KJS_FAST_CALL
;
2678 VarStack m_varStack
;
2679 FunctionStack m_functionStack
;
2682 SourceCode m_source
;
2685 class ProgramNode
: public ScopeNode
{
2687 static ProgramNode
* create(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2689 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2692 ProgramNode(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2694 void initializeSymbolTable(ExecState
*) KJS_FAST_CALL
;
2695 ALWAYS_INLINE
void processDeclarations(ExecState
*) KJS_FAST_CALL
;
2697 Vector
<size_t> m_varIndexes
; // Storage indexes belonging to the nodes in m_varStack. (Recorded to avoid double lookup.)
2698 Vector
<size_t> m_functionIndexes
; // Storage indexes belonging to the nodes in m_functionStack. (Recorded to avoid double lookup.)
2701 class EvalNode
: public ScopeNode
{
2703 static EvalNode
* create(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2705 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2708 EvalNode(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2710 ALWAYS_INLINE
void processDeclarations(ExecState
*) KJS_FAST_CALL
;
2713 class FunctionBodyNode
: public ScopeNode
{
2715 static FunctionBodyNode
* create() KJS_FAST_CALL
;
2716 static FunctionBodyNode
* create(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2717 static FunctionBodyNode
* create(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2719 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2720 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2722 SymbolTable
& symbolTable() KJS_FAST_CALL
{ return m_symbolTable
; }
2724 Vector
<Identifier
>& parameters() KJS_FAST_CALL
{ return m_parameters
; }
2725 UString
paramString() const KJS_FAST_CALL
;
2728 FunctionBodyNode() KJS_FAST_CALL
;
2729 FunctionBodyNode(const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2732 void initializeSymbolTable(ExecState
*) KJS_FAST_CALL
;
2733 ALWAYS_INLINE
void processDeclarations(ExecState
*) KJS_FAST_CALL
;
2736 Vector
<Identifier
> m_parameters
;
2737 SymbolTable m_symbolTable
;
2740 class FuncExprNode
: public ExpressionNode
{
2742 FuncExprNode(const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
= 0) KJS_FAST_CALL
2744 , m_parameter(parameter
)
2748 m_body
->setSource(source
);
2751 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2752 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2753 virtual Precedence
precedence() const { return PrecMember
; }
2754 virtual bool needsParensIfLeftmost() const { return true; }
2755 virtual bool isFuncExprNode() const KJS_FAST_CALL
{ return true; }
2758 void addParams() KJS_FAST_CALL
;
2760 // Used for streamTo
2761 friend class PropertyNode
;
2763 RefPtr
<ParameterNode
> m_parameter
;
2764 RefPtr
<FunctionBodyNode
> m_body
;
2767 class FuncDeclNode
: public StatementNode
{
2769 FuncDeclNode(const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
= 0) KJS_FAST_CALL
2771 , m_parameter(parameter
)
2775 m_body
->setSource(source
);
2778 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2779 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2780 ALWAYS_INLINE FunctionImp
* makeFunction(ExecState
*) KJS_FAST_CALL
;
2785 void addParams() KJS_FAST_CALL
;
2787 RefPtr
<ParameterNode
> m_parameter
;
2788 RefPtr
<FunctionBodyNode
> m_body
;
2791 class CaseClauseNode
: public Node
{
2793 CaseClauseNode(ExpressionNode
* expr
) KJS_FAST_CALL
2798 CaseClauseNode(ExpressionNode
* expr
, SourceElements
* children
) KJS_FAST_CALL
2802 children
->releaseContentsIntoVector(m_children
);
2805 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2806 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2807 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2809 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2810 JSValue
* executeStatements(ExecState
*) KJS_FAST_CALL
;
2813 RefPtr
<ExpressionNode
> m_expr
;
2814 StatementVector m_children
;
2817 class ClauseListNode
: public Node
{
2819 ClauseListNode(CaseClauseNode
* clause
) KJS_FAST_CALL
2824 ClauseListNode(ClauseListNode
* clauseList
, CaseClauseNode
* clause
) KJS_FAST_CALL
2827 clauseList
->m_next
= this;
2830 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2831 CaseClauseNode
* getClause() const KJS_FAST_CALL
{ return m_clause
.get(); }
2832 ClauseListNode
* getNext() const KJS_FAST_CALL
{ return m_next
.get(); }
2833 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2834 PassRefPtr
<ClauseListNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
2835 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2838 friend class CaseBlockNode
;
2839 RefPtr
<CaseClauseNode
> m_clause
;
2840 ListRefPtr
<ClauseListNode
> m_next
;
2843 class CaseBlockNode
: public Node
{
2845 CaseBlockNode(ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
) KJS_FAST_CALL
;
2847 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2848 JSValue
* executeBlock(ExecState
*, JSValue
*input
) KJS_FAST_CALL
;
2849 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2850 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2853 RefPtr
<ClauseListNode
> m_list1
;
2854 RefPtr
<CaseClauseNode
> m_defaultClause
;
2855 RefPtr
<ClauseListNode
> m_list2
;
2858 class SwitchNode
: public StatementNode
{
2860 SwitchNode(ExpressionNode
* expr
, CaseBlockNode
* block
) KJS_FAST_CALL
2866 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2867 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2868 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2871 RefPtr
<ExpressionNode
> m_expr
;
2872 RefPtr
<CaseBlockNode
> m_block
;
2875 class BreakpointCheckStatement
: public StatementNode
{
2877 BreakpointCheckStatement(PassRefPtr
<StatementNode
>) KJS_FAST_CALL
;
2879 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2880 virtual void streamTo(SourceStream
&) KJS_FAST_CALL
;
2881 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2884 RefPtr
<StatementNode
> m_statement
;
2887 struct ElementList
{
2892 struct PropertyList
{
2893 PropertyListNode
* head
;
2894 PropertyListNode
* tail
;
2897 struct ArgumentList
{
2898 ArgumentListNode
* head
;
2899 ArgumentListNode
* tail
;
2902 struct ConstDeclList
{
2903 ConstDeclNode
* head
;
2904 ConstDeclNode
* tail
;
2907 struct ParameterList
{
2908 ParameterNode
* head
;
2909 ParameterNode
* tail
;
2913 ClauseListNode
* head
;
2914 ClauseListNode
* tail
;