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 "SymbolTable.h"
32 #include <wtf/ListRefPtr.h>
33 #include <wtf/MathExtras.h>
34 #include <wtf/OwnPtr.h>
35 #include <wtf/Vector.h>
37 #if PLATFORM(X86) && COMPILER(GCC)
38 #define KJS_FAST_CALL __attribute__((regparm(3)))
48 class PropertyListNode
;
90 struct DeclarationStacks
{
91 typedef Vector
<Node
*, 16> NodeStack
;
92 enum { IsConstant
= 1, HasInitializer
= 2 } VarAttrs
;
93 typedef Vector
<std::pair
<Identifier
, unsigned>, 16> VarStack
;
94 typedef Vector
<FuncDeclNode
*, 16> FunctionStack
;
96 DeclarationStacks(ExecState
* e
, NodeStack
& n
, VarStack
& v
, FunctionStack
& f
)
105 NodeStack
& nodeStack
;
107 FunctionStack
& functionStack
;
110 class ParserRefCounted
: Noncopyable
{
112 ParserRefCounted() KJS_FAST_CALL
;
113 ParserRefCounted(PlacementNewAdoptType
) KJS_FAST_CALL
118 void ref() KJS_FAST_CALL
;
119 void deref() KJS_FAST_CALL
;
120 unsigned refcount() KJS_FAST_CALL
;
122 static void deleteNewObjects() KJS_FAST_CALL
;
124 virtual ~ParserRefCounted();
127 class Node
: public ParserRefCounted
{
129 typedef DeclarationStacks::NodeStack NodeStack
;
130 typedef DeclarationStacks::VarStack VarStack
;
131 typedef DeclarationStacks::FunctionStack FunctionStack
;
133 Node() KJS_FAST_CALL
;
134 Node(PlacementNewAdoptType placementAdopt
) KJS_FAST_CALL
135 : ParserRefCounted(placementAdopt
)
139 UString
toString() const KJS_FAST_CALL
;
140 int lineNo() const KJS_FAST_CALL
{ return m_line
; }
143 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
= 0;
144 virtual Precedence
precedence() const = 0;
145 virtual bool needsParensIfLeftmost() const { return false; }
147 // Used for iterative, depth-first traversal of the node tree. Does not cross function call boundaries.
148 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
{ }
151 JSValue
* setInterruptedCompletion(ExecState
*);
152 Node(JSType
) KJS_FAST_CALL
; // used by ExpressionNode
154 // for use in execute()
155 JSValue
* setErrorCompletion(ExecState
*, ErrorType
, const char* msg
) KJS_FAST_CALL
;
156 JSValue
* setErrorCompletion(ExecState
*, ErrorType
, const char* msg
, const Identifier
&) KJS_FAST_CALL
;
158 // for use in evaluate()
159 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
) KJS_FAST_CALL
;
160 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, const char*) KJS_FAST_CALL
;
161 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, Node
*) KJS_FAST_CALL
;
162 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, const Identifier
&) KJS_FAST_CALL
;
163 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, const Identifier
&) KJS_FAST_CALL
;
164 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, Node
*, Node
*) KJS_FAST_CALL
;
165 JSValue
* throwError(ExecState
*, ErrorType
, const char* msg
, JSValue
*, Node
*, const Identifier
&) KJS_FAST_CALL
;
167 JSValue
* throwUndefinedVariableError(ExecState
*, const Identifier
&) KJS_FAST_CALL
;
169 void handleException(ExecState
*) KJS_FAST_CALL
;
170 void handleException(ExecState
*, JSValue
*) KJS_FAST_CALL
;
172 // for use in execute()
173 JSValue
* rethrowException(ExecState
*) KJS_FAST_CALL
;
176 unsigned m_expectedReturnType
: 3; // JSType
179 class ExpressionNode
: public Node
{
181 ExpressionNode() KJS_FAST_CALL
: Node() {}
182 ExpressionNode(JSType expectedReturn
) KJS_FAST_CALL
183 : Node(expectedReturn
)
187 // Special constructor for cases where we overwrite an object in place.
188 ExpressionNode(PlacementNewAdoptType
) KJS_FAST_CALL
189 : Node(PlacementNewAdopt
)
193 virtual bool isNumber() const KJS_FAST_CALL
{ return false; }
194 virtual bool isLocation() const KJS_FAST_CALL
{ return false; }
195 virtual bool isResolveNode() const KJS_FAST_CALL
{ return false; }
196 virtual bool isBracketAccessorNode() const KJS_FAST_CALL
{ return false; }
197 virtual bool isDotAccessorNode() const KJS_FAST_CALL
{ return false; }
199 JSType
expectedReturnType() const KJS_FAST_CALL
{ return static_cast<JSType
>(m_expectedReturnType
); }
201 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
= 0;
202 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
203 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
204 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
205 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
207 // Used to optimize those nodes that do extra work when returning a result, even if the result has no semantic relevance
208 virtual void optimizeForUnnecessaryResult() { }
211 class StatementNode
: public Node
{
213 StatementNode() KJS_FAST_CALL
;
214 void setLoc(int line0
, int line1
) KJS_FAST_CALL
;
215 int firstLine() const KJS_FAST_CALL
{ return lineNo(); }
216 int lastLine() const KJS_FAST_CALL
{ return m_lastLine
; }
217 virtual JSValue
* execute(ExecState
*exec
) KJS_FAST_CALL
= 0;
218 void pushLabel(const Identifier
& ident
) KJS_FAST_CALL
{ m_labelStack
.push(ident
); }
219 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
220 virtual bool isEmptyStatement() const KJS_FAST_CALL
{ return false; }
223 LabelStack m_labelStack
;
229 class NullNode
: public ExpressionNode
{
231 NullNode() KJS_FAST_CALL
: ExpressionNode(NullType
) {}
232 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
233 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
234 virtual Precedence
precedence() const { return PrecPrimary
; }
237 class FalseNode
: public ExpressionNode
{
239 FalseNode() KJS_FAST_CALL
240 : ExpressionNode(BooleanType
)
244 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
245 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
{ return false; }
246 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
247 virtual Precedence
precedence() const { return PrecPrimary
; }
250 class TrueNode
: public ExpressionNode
{
252 TrueNode() KJS_FAST_CALL
253 : ExpressionNode(BooleanType
)
257 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
258 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
{ return true; }
259 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
260 virtual Precedence
precedence() const { return PrecPrimary
; }
263 class PlaceholderTrueNode
: public TrueNode
{
265 // Like TrueNode, but does not serialize as "true".
266 PlaceholderTrueNode() KJS_FAST_CALL
271 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
274 class NumberNode
: public ExpressionNode
{
276 NumberNode(double v
) KJS_FAST_CALL
277 : ExpressionNode(NumberType
)
282 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
283 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
284 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
285 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
286 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
287 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
288 virtual Precedence
precedence() const { return signbit(m_double
) ? PrecUnary
: PrecPrimary
; }
290 virtual bool isNumber() const KJS_FAST_CALL
{ return true; }
291 double value() const KJS_FAST_CALL
{ return m_double
; }
292 virtual void setValue(double d
) KJS_FAST_CALL
{ m_double
= d
; }
298 class ImmediateNumberNode
: public NumberNode
{
300 ImmediateNumberNode(JSValue
* v
, double d
) KJS_FAST_CALL
304 ASSERT(v
== JSImmediate::from(d
));
307 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
308 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
309 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
311 virtual void setValue(double d
) KJS_FAST_CALL
{ m_double
= d
; m_value
= JSImmediate::from(d
); ASSERT(m_value
); }
314 JSValue
* m_value
; // This is never a JSCell, only JSImmediate, thus no ProtectedPtr
317 class StringNode
: public ExpressionNode
{
319 StringNode(const UString
* v
) KJS_FAST_CALL
320 : ExpressionNode(StringType
)
325 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
326 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
327 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
328 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
329 virtual Precedence
precedence() const { return PrecPrimary
; }
335 class RegExpNode
: public ExpressionNode
{
337 RegExpNode(const UString
& pattern
, const UString
& flags
) KJS_FAST_CALL
338 : m_regExp(new RegExp(pattern
, flags
))
342 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
343 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
344 virtual Precedence
precedence() const { return PrecPrimary
; }
347 RefPtr
<RegExp
> m_regExp
;
350 class ThisNode
: public ExpressionNode
{
352 ThisNode() KJS_FAST_CALL
356 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
357 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
358 virtual Precedence
precedence() const { return PrecPrimary
; }
361 class ResolveNode
: public ExpressionNode
{
363 ResolveNode(const Identifier
& ident
) KJS_FAST_CALL
368 // Special constructor for cases where we overwrite an object in place.
369 ResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
370 : ExpressionNode(PlacementNewAdopt
)
371 , m_ident(PlacementNewAdopt
)
375 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
377 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
378 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
379 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
380 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
381 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
382 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
383 virtual Precedence
precedence() const { return PrecPrimary
; }
385 virtual bool isLocation() const KJS_FAST_CALL
{ return true; }
386 virtual bool isResolveNode() const KJS_FAST_CALL
{ return true; }
387 const Identifier
& identifier() const KJS_FAST_CALL
{ return m_ident
; }
390 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
392 size_t m_index
; // Used by LocalVarAccessNode.
395 class LocalVarAccessNode
: public ResolveNode
{
397 // Overwrites a ResolveNode in place.
398 LocalVarAccessNode(size_t i
) KJS_FAST_CALL
399 : ResolveNode(PlacementNewAdopt
)
401 ASSERT(i
!= missingSymbolMarker());
405 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
406 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
407 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
408 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
409 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
412 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
415 class ElementNode
: public Node
{
417 ElementNode(int elision
, ExpressionNode
* node
) KJS_FAST_CALL
423 ElementNode(ElementNode
* l
, int elision
, ExpressionNode
* node
) KJS_FAST_CALL
430 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
431 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
432 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
434 PassRefPtr
<ElementNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
436 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
439 friend class ArrayNode
;
440 ListRefPtr
<ElementNode
> m_next
;
442 RefPtr
<ExpressionNode
> m_node
;
445 class ArrayNode
: public ExpressionNode
{
447 ArrayNode(int elision
) KJS_FAST_CALL
453 ArrayNode(ElementNode
* element
) KJS_FAST_CALL
460 ArrayNode(int elision
, ElementNode
* element
) KJS_FAST_CALL
467 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
468 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
469 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
470 virtual Precedence
precedence() const { return PrecPrimary
; }
473 RefPtr
<ElementNode
> m_element
;
478 class PropertyNode
: public Node
{
480 enum Type
{ Constant
, Getter
, Setter
};
482 PropertyNode(const Identifier
& name
, ExpressionNode
* assign
, Type type
) KJS_FAST_CALL
489 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
490 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
491 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
493 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
494 const Identifier
& name() const { return m_name
; }
497 friend class PropertyListNode
;
499 RefPtr
<ExpressionNode
> m_assign
;
503 class PropertyListNode
: public Node
{
505 PropertyListNode(PropertyNode
* node
) KJS_FAST_CALL
510 PropertyListNode(PropertyNode
* node
, PropertyListNode
* list
) KJS_FAST_CALL
516 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
517 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
518 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
520 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
521 PassRefPtr
<PropertyListNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
524 friend class ObjectLiteralNode
;
525 RefPtr
<PropertyNode
> m_node
;
526 ListRefPtr
<PropertyListNode
> m_next
;
529 class ObjectLiteralNode
: public ExpressionNode
{
531 ObjectLiteralNode() KJS_FAST_CALL
535 ObjectLiteralNode(PropertyListNode
* list
) KJS_FAST_CALL
540 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
541 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
542 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
543 virtual Precedence
precedence() const { return PrecPrimary
; }
544 virtual bool needsParensIfLeftmost() const { return true; }
547 RefPtr
<PropertyListNode
> m_list
;
550 class BracketAccessorNode
: public ExpressionNode
{
552 BracketAccessorNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
554 , m_subscript(subscript
)
558 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
559 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
560 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
561 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
562 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
563 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
564 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
565 virtual Precedence
precedence() const { return PrecMember
; }
567 virtual bool isLocation() const KJS_FAST_CALL
{ return true; }
568 virtual bool isBracketAccessorNode() const KJS_FAST_CALL
{ return true; }
569 ExpressionNode
* base() KJS_FAST_CALL
{ return m_base
.get(); }
570 ExpressionNode
* subscript() KJS_FAST_CALL
{ return m_subscript
.get(); }
573 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
575 RefPtr
<ExpressionNode
> m_base
;
576 RefPtr
<ExpressionNode
> m_subscript
;
579 class DotAccessorNode
: public ExpressionNode
{
581 DotAccessorNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
587 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
588 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
589 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
590 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
591 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
592 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
593 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
594 virtual Precedence
precedence() const { return PrecMember
; }
596 virtual bool isLocation() const KJS_FAST_CALL
{ return true; }
597 virtual bool isDotAccessorNode() const KJS_FAST_CALL
{ return true; }
598 ExpressionNode
* base() const KJS_FAST_CALL
{ return m_base
.get(); }
599 const Identifier
& identifier() const KJS_FAST_CALL
{ return m_ident
; }
602 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
604 RefPtr
<ExpressionNode
> m_base
;
608 class ArgumentListNode
: public Node
{
610 ArgumentListNode(ExpressionNode
* expr
) KJS_FAST_CALL
615 ArgumentListNode(ArgumentListNode
* listNode
, ExpressionNode
* expr
) KJS_FAST_CALL
618 listNode
->m_next
= this;
621 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
622 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
623 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
625 void evaluateList(ExecState
*, List
&) KJS_FAST_CALL
;
626 PassRefPtr
<ArgumentListNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
629 friend class ArgumentsNode
;
630 ListRefPtr
<ArgumentListNode
> m_next
;
631 RefPtr
<ExpressionNode
> m_expr
;
634 class ArgumentsNode
: public Node
{
636 ArgumentsNode() KJS_FAST_CALL
640 ArgumentsNode(ArgumentListNode
* listNode
) KJS_FAST_CALL
641 : m_listNode(listNode
)
645 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
646 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
647 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
649 void evaluateList(ExecState
* exec
, List
& list
) KJS_FAST_CALL
{ if (m_listNode
) m_listNode
->evaluateList(exec
, list
); }
652 RefPtr
<ArgumentListNode
> m_listNode
;
655 class NewExprNode
: public ExpressionNode
{
657 NewExprNode(ExpressionNode
* expr
) KJS_FAST_CALL
662 NewExprNode(ExpressionNode
* expr
, ArgumentsNode
* args
) KJS_FAST_CALL
668 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
669 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
670 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
671 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
672 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
673 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
674 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
675 virtual Precedence
precedence() const { return PrecLeftHandSide
; }
678 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
680 RefPtr
<ExpressionNode
> m_expr
;
681 RefPtr
<ArgumentsNode
> m_args
;
684 class FunctionCallValueNode
: public ExpressionNode
{
686 FunctionCallValueNode(ExpressionNode
* expr
, ArgumentsNode
* args
) KJS_FAST_CALL
692 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
693 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
694 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
695 virtual Precedence
precedence() const { return PrecCall
; }
698 RefPtr
<ExpressionNode
> m_expr
;
699 RefPtr
<ArgumentsNode
> m_args
;
702 class FunctionCallResolveNode
: public ExpressionNode
{
704 FunctionCallResolveNode(const Identifier
& ident
, ArgumentsNode
* args
) KJS_FAST_CALL
710 FunctionCallResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
711 : ExpressionNode(PlacementNewAdopt
)
712 , m_ident(PlacementNewAdopt
)
713 , m_args(PlacementNewAdopt
)
717 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
718 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
719 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
720 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
721 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
722 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
723 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
724 virtual Precedence
precedence() const { return PrecCall
; }
727 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
730 RefPtr
<ArgumentsNode
> m_args
;
731 size_t m_index
; // Used by LocalVarFunctionCallNode.
734 class LocalVarFunctionCallNode
: public FunctionCallResolveNode
{
736 LocalVarFunctionCallNode(size_t i
) KJS_FAST_CALL
737 : FunctionCallResolveNode(PlacementNewAdopt
)
739 ASSERT(i
!= missingSymbolMarker());
743 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
744 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
745 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
746 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
747 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
750 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
753 class FunctionCallBracketNode
: public ExpressionNode
{
755 FunctionCallBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
, ArgumentsNode
* args
) KJS_FAST_CALL
757 , m_subscript(subscript
)
762 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
763 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
764 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
765 virtual Precedence
precedence() const { return PrecCall
; }
768 RefPtr
<ExpressionNode
> m_base
;
769 RefPtr
<ExpressionNode
> m_subscript
;
770 RefPtr
<ArgumentsNode
> m_args
;
773 class FunctionCallDotNode
: public ExpressionNode
{
775 FunctionCallDotNode(ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
) KJS_FAST_CALL
782 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
783 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
784 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
785 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
786 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
787 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
788 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
789 virtual Precedence
precedence() const { return PrecCall
; }
792 ALWAYS_INLINE JSValue
* inlineEvaluate(ExecState
*);
794 RefPtr
<ExpressionNode
> m_base
;
796 RefPtr
<ArgumentsNode
> m_args
;
799 class PrePostResolveNode
: public ExpressionNode
{
801 PrePostResolveNode(const Identifier
& ident
) KJS_FAST_CALL
802 : ExpressionNode(NumberType
)
807 PrePostResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
808 : ExpressionNode(PlacementNewAdopt
)
809 , m_ident(PlacementNewAdopt
)
815 size_t m_index
; // Used by LocalVarPostfixNode.
818 class PostIncResolveNode
: public PrePostResolveNode
{
820 PostIncResolveNode(const Identifier
& ident
) KJS_FAST_CALL
821 : PrePostResolveNode(ident
)
825 PostIncResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
826 : PrePostResolveNode(PlacementNewAdopt
)
830 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
831 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
832 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
833 virtual Precedence
precedence() const { return PrecPostfix
; }
834 virtual void optimizeForUnnecessaryResult();
837 class PostIncLocalVarNode
: public PostIncResolveNode
{
839 PostIncLocalVarNode(size_t i
) KJS_FAST_CALL
840 : PostIncResolveNode(PlacementNewAdopt
)
842 ASSERT(i
!= missingSymbolMarker());
846 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
847 virtual void optimizeForUnnecessaryResult();
850 class PostIncConstNode
: public PostIncResolveNode
{
852 PostIncConstNode(size_t i
) KJS_FAST_CALL
853 : PostIncResolveNode(PlacementNewAdopt
)
855 ASSERT(i
!= missingSymbolMarker());
859 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
862 class PostDecResolveNode
: public PrePostResolveNode
{
864 PostDecResolveNode(const Identifier
& ident
) KJS_FAST_CALL
865 : PrePostResolveNode(ident
)
869 PostDecResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
870 : PrePostResolveNode(PlacementNewAdopt
)
874 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
875 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
876 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
877 virtual Precedence
precedence() const { return PrecPostfix
; }
878 virtual void optimizeForUnnecessaryResult();
881 class PostDecLocalVarNode
: public PostDecResolveNode
{
883 PostDecLocalVarNode(size_t i
) KJS_FAST_CALL
884 : PostDecResolveNode(PlacementNewAdopt
)
886 ASSERT(i
!= missingSymbolMarker());
890 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
891 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
892 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
893 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
894 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
895 virtual void optimizeForUnnecessaryResult();
898 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
901 class PostDecConstNode
: public PostDecResolveNode
{
903 PostDecConstNode(size_t i
) KJS_FAST_CALL
904 : PostDecResolveNode(PlacementNewAdopt
)
906 ASSERT(i
!= missingSymbolMarker());
910 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
913 class PostfixBracketNode
: public ExpressionNode
{
915 PostfixBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
917 , m_subscript(subscript
)
921 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
922 virtual Precedence
precedence() const { return PrecPostfix
; }
925 RefPtr
<ExpressionNode
> m_base
;
926 RefPtr
<ExpressionNode
> m_subscript
;
929 class PostIncBracketNode
: public PostfixBracketNode
{
931 PostIncBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
932 : PostfixBracketNode(base
, subscript
)
936 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
937 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
940 class PostDecBracketNode
: public PostfixBracketNode
{
942 PostDecBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
943 : PostfixBracketNode(base
, subscript
)
947 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
948 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
951 class PostfixDotNode
: public ExpressionNode
{
953 PostfixDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
959 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
960 virtual Precedence
precedence() const { return PrecPostfix
; }
963 RefPtr
<ExpressionNode
> m_base
;
967 class PostIncDotNode
: public PostfixDotNode
{
969 PostIncDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
970 : PostfixDotNode(base
, ident
)
974 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
975 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
978 class PostDecDotNode
: public PostfixDotNode
{
980 PostDecDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
981 : PostfixDotNode(base
, ident
)
985 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
986 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
989 class PostfixErrorNode
: public ExpressionNode
{
991 PostfixErrorNode(ExpressionNode
* expr
, Operator oper
) KJS_FAST_CALL
997 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
998 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
999 virtual Precedence
precedence() const { return PrecPostfix
; }
1002 RefPtr
<ExpressionNode
> m_expr
;
1003 Operator m_operator
;
1006 class DeleteResolveNode
: public ExpressionNode
{
1008 DeleteResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1013 DeleteResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1014 : ExpressionNode(PlacementNewAdopt
)
1015 , m_ident(PlacementNewAdopt
)
1019 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1020 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1021 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1022 virtual Precedence
precedence() const { return PrecUnary
; }
1028 class LocalVarDeleteNode
: public DeleteResolveNode
{
1030 LocalVarDeleteNode() KJS_FAST_CALL
1031 : DeleteResolveNode(PlacementNewAdopt
)
1035 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1038 class DeleteBracketNode
: public ExpressionNode
{
1040 DeleteBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1042 , m_subscript(subscript
)
1046 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1047 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1048 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1049 virtual Precedence
precedence() const { return PrecUnary
; }
1052 RefPtr
<ExpressionNode
> m_base
;
1053 RefPtr
<ExpressionNode
> m_subscript
;
1056 class DeleteDotNode
: public ExpressionNode
{
1058 DeleteDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1064 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1065 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1066 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1067 virtual Precedence
precedence() const { return PrecUnary
; }
1070 RefPtr
<ExpressionNode
> m_base
;
1074 class DeleteValueNode
: public ExpressionNode
{
1076 DeleteValueNode(ExpressionNode
* expr
) KJS_FAST_CALL
1081 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1082 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1083 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1084 virtual Precedence
precedence() const { return PrecUnary
; }
1087 RefPtr
<ExpressionNode
> m_expr
;
1090 class VoidNode
: public ExpressionNode
{
1092 VoidNode(ExpressionNode
* expr
) KJS_FAST_CALL
1097 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1098 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1099 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1100 virtual Precedence
precedence() const { return PrecUnary
; }
1103 RefPtr
<ExpressionNode
> m_expr
;
1106 class TypeOfResolveNode
: public ExpressionNode
{
1108 TypeOfResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1109 : ExpressionNode(StringType
)
1114 TypeOfResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1115 : ExpressionNode(PlacementNewAdopt
)
1116 , m_ident(PlacementNewAdopt
)
1118 m_expectedReturnType
= StringType
;
1121 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1123 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1124 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1125 virtual Precedence
precedence() const { return PrecUnary
; }
1127 const Identifier
& identifier() const KJS_FAST_CALL
{ return m_ident
; }
1131 size_t m_index
; // Used by LocalTypeOfNode.
1134 class LocalVarTypeOfNode
: public TypeOfResolveNode
{
1136 LocalVarTypeOfNode(size_t i
) KJS_FAST_CALL
1137 : TypeOfResolveNode(PlacementNewAdopt
)
1139 m_expectedReturnType
= StringType
;
1140 ASSERT(i
!= missingSymbolMarker());
1144 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1147 class TypeOfValueNode
: public ExpressionNode
{
1149 TypeOfValueNode(ExpressionNode
* expr
) KJS_FAST_CALL
1150 : ExpressionNode(StringType
)
1155 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1156 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1157 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1158 virtual Precedence
precedence() const { return PrecUnary
; }
1161 RefPtr
<ExpressionNode
> m_expr
;
1164 class PreIncResolveNode
: public PrePostResolveNode
{
1166 PreIncResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1167 : PrePostResolveNode(ident
)
1171 PreIncResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1172 : PrePostResolveNode(PlacementNewAdopt
)
1176 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1178 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1179 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1180 virtual Precedence
precedence() const { return PrecUnary
; }
1183 class PreIncLocalVarNode
: public PreIncResolveNode
{
1185 PreIncLocalVarNode(size_t i
) KJS_FAST_CALL
1186 : PreIncResolveNode(PlacementNewAdopt
)
1188 ASSERT(i
!= missingSymbolMarker());
1192 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1195 class PreIncConstNode
: public PreIncResolveNode
{
1197 PreIncConstNode(size_t i
) KJS_FAST_CALL
1198 : PreIncResolveNode(PlacementNewAdopt
)
1200 ASSERT(i
!= missingSymbolMarker());
1204 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1207 class PreDecResolveNode
: public PrePostResolveNode
{
1209 PreDecResolveNode(const Identifier
& ident
) KJS_FAST_CALL
1210 : PrePostResolveNode(ident
)
1214 PreDecResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
1215 : PrePostResolveNode(PlacementNewAdopt
)
1219 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1221 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1222 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1223 virtual Precedence
precedence() const { return PrecUnary
; }
1226 class PreDecLocalVarNode
: public PreDecResolveNode
{
1228 PreDecLocalVarNode(size_t i
) KJS_FAST_CALL
1229 : PreDecResolveNode(PlacementNewAdopt
)
1231 ASSERT(i
!= missingSymbolMarker());
1235 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1238 class PreDecConstNode
: public PreDecResolveNode
{
1240 PreDecConstNode(size_t i
) KJS_FAST_CALL
1241 : PreDecResolveNode(PlacementNewAdopt
)
1243 ASSERT(i
!= missingSymbolMarker());
1247 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1250 class PrefixBracketNode
: public ExpressionNode
{
1252 PrefixBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1254 , m_subscript(subscript
)
1258 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1259 virtual Precedence
precedence() const { return PrecUnary
; }
1262 RefPtr
<ExpressionNode
> m_base
;
1263 RefPtr
<ExpressionNode
> m_subscript
;
1266 class PreIncBracketNode
: public PrefixBracketNode
{
1268 PreIncBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1269 : PrefixBracketNode(base
, subscript
)
1273 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1274 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1277 class PreDecBracketNode
: public PrefixBracketNode
{
1279 PreDecBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
) KJS_FAST_CALL
1280 : PrefixBracketNode(base
, subscript
)
1284 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1285 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1288 class PrefixDotNode
: public ExpressionNode
{
1290 PrefixDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1296 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1297 virtual Precedence
precedence() const { return PrecPostfix
; }
1300 RefPtr
<ExpressionNode
> m_base
;
1304 class PreIncDotNode
: public PrefixDotNode
{
1306 PreIncDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1307 : PrefixDotNode(base
, ident
)
1311 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1312 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1315 class PreDecDotNode
: public PrefixDotNode
{
1317 PreDecDotNode(ExpressionNode
* base
, const Identifier
& ident
) KJS_FAST_CALL
1318 : PrefixDotNode(base
, ident
)
1322 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1323 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1326 class PrefixErrorNode
: public ExpressionNode
{
1328 PrefixErrorNode(ExpressionNode
* expr
, Operator oper
) KJS_FAST_CALL
1334 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1335 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1336 virtual Precedence
precedence() const { return PrecUnary
; }
1339 RefPtr
<ExpressionNode
> m_expr
;
1340 Operator m_operator
;
1343 class UnaryPlusNode
: public ExpressionNode
{
1345 UnaryPlusNode(ExpressionNode
* expr
) KJS_FAST_CALL
1346 : ExpressionNode(NumberType
)
1351 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1352 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1353 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1354 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1355 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1356 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1357 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1358 virtual Precedence
precedence() const { return PrecUnary
; }
1361 RefPtr
<ExpressionNode
> m_expr
;
1364 class NegateNode
: public ExpressionNode
{
1366 NegateNode(ExpressionNode
* expr
) KJS_FAST_CALL
1367 : ExpressionNode(NumberType
)
1372 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1373 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1374 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1375 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1376 virtual Precedence
precedence() const { return PrecUnary
; }
1379 RefPtr
<ExpressionNode
> m_expr
;
1382 class BitwiseNotNode
: public ExpressionNode
{
1384 BitwiseNotNode(ExpressionNode
* expr
) KJS_FAST_CALL
1385 : ExpressionNode(NumberType
)
1390 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1391 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1392 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1393 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1394 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1395 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1396 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1397 virtual Precedence
precedence() const { return PrecUnary
; }
1400 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1402 RefPtr
<ExpressionNode
> m_expr
;
1405 class LogicalNotNode
: public ExpressionNode
{
1407 LogicalNotNode(ExpressionNode
* expr
) KJS_FAST_CALL
1408 : ExpressionNode(BooleanType
)
1413 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1414 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1415 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1416 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1417 virtual Precedence
precedence() const { return PrecUnary
; }
1420 RefPtr
<ExpressionNode
> m_expr
;
1423 class MultNode
: public ExpressionNode
{
1425 MultNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1426 : ExpressionNode(NumberType
)
1432 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1433 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1434 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1435 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1436 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1437 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1438 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1439 virtual Precedence
precedence() const { return PrecMultiplicitave
; }
1442 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1444 RefPtr
<ExpressionNode
> m_term1
;
1445 RefPtr
<ExpressionNode
> m_term2
;
1448 class DivNode
: public ExpressionNode
{
1450 DivNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1451 : ExpressionNode(NumberType
)
1457 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1458 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1459 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1460 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1461 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1462 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1463 virtual Precedence
precedence() const { return PrecMultiplicitave
; }
1466 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1468 RefPtr
<ExpressionNode
> m_term1
;
1469 RefPtr
<ExpressionNode
> m_term2
;
1472 class ModNode
: public ExpressionNode
{
1474 ModNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1475 : ExpressionNode(NumberType
)
1481 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1482 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1483 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1484 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1485 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1486 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1487 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1488 virtual Precedence
precedence() const { return PrecMultiplicitave
; }
1491 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1493 RefPtr
<ExpressionNode
> m_term1
;
1494 RefPtr
<ExpressionNode
> m_term2
;
1497 class AddNode
: public ExpressionNode
{
1499 AddNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1505 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1506 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1507 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1508 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1509 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1510 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1511 virtual Precedence
precedence() const { return PrecAdditive
; }
1514 AddNode(ExpressionNode
* term1
, ExpressionNode
* term2
, JSType expectedReturn
) KJS_FAST_CALL
1515 : ExpressionNode(expectedReturn
)
1521 RefPtr
<ExpressionNode
> m_term1
;
1522 RefPtr
<ExpressionNode
> m_term2
;
1525 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1528 class AddNumbersNode
: public AddNode
{
1530 AddNumbersNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1531 : AddNode(term1
, term2
, NumberType
)
1535 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1536 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1537 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1538 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1541 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1544 class AddStringLeftNode
: public AddNode
{
1546 AddStringLeftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1547 : AddNode(term1
, term2
, StringType
)
1551 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1554 class AddStringRightNode
: public AddNode
{
1556 AddStringRightNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1557 : AddNode(term1
, term2
, StringType
)
1561 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1564 class AddStringsNode
: public AddNode
{
1566 AddStringsNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1567 : AddNode(term1
, term2
, StringType
)
1571 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1574 class SubNode
: public ExpressionNode
{
1576 SubNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1577 : ExpressionNode(NumberType
)
1583 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1584 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1585 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1586 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1587 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1588 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1589 virtual Precedence
precedence() const { return PrecAdditive
; }
1592 ALWAYS_INLINE
double inlineEvaluateToNumber(ExecState
*);
1594 RefPtr
<ExpressionNode
> m_term1
;
1595 RefPtr
<ExpressionNode
> m_term2
;
1598 class LeftShiftNode
: public ExpressionNode
{
1600 LeftShiftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1601 : ExpressionNode(NumberType
)
1607 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1608 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1609 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1610 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1611 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1612 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1613 virtual Precedence
precedence() const { return PrecShift
; }
1616 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1618 RefPtr
<ExpressionNode
> m_term1
;
1619 RefPtr
<ExpressionNode
> m_term2
;
1622 class RightShiftNode
: public ExpressionNode
{
1624 RightShiftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1625 : ExpressionNode(NumberType
)
1631 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1632 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1633 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1634 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1635 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1636 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1637 virtual Precedence
precedence() const { return PrecShift
; }
1640 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1642 RefPtr
<ExpressionNode
> m_term1
;
1643 RefPtr
<ExpressionNode
> m_term2
;
1646 class UnsignedRightShiftNode
: public ExpressionNode
{
1648 UnsignedRightShiftNode(ExpressionNode
* term1
, ExpressionNode
* term2
) KJS_FAST_CALL
1649 : ExpressionNode(NumberType
)
1655 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1656 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1657 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1658 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1659 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1660 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1661 virtual Precedence
precedence() const { return PrecShift
; }
1663 ALWAYS_INLINE
uint32_t inlineEvaluateToUInt32(ExecState
*);
1665 RefPtr
<ExpressionNode
> m_term1
;
1666 RefPtr
<ExpressionNode
> m_term2
;
1669 class LessNode
: public ExpressionNode
{
1671 LessNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1672 : ExpressionNode(BooleanType
)
1678 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1679 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1680 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1681 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1682 virtual Precedence
precedence() const { return PrecRelational
; }
1685 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1688 RefPtr
<ExpressionNode
> m_expr1
;
1689 RefPtr
<ExpressionNode
> m_expr2
;
1692 class LessNumbersNode
: public LessNode
{
1694 LessNumbersNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1695 : LessNode(expr1
, expr2
)
1699 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1700 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1703 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1706 class LessStringsNode
: public LessNode
{
1708 LessStringsNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1709 : LessNode(expr1
, expr2
)
1713 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1714 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1717 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1720 class GreaterNode
: public ExpressionNode
{
1722 GreaterNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1728 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1729 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1730 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1731 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1732 virtual Precedence
precedence() const { return PrecRelational
; }
1735 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1737 RefPtr
<ExpressionNode
> m_expr1
;
1738 RefPtr
<ExpressionNode
> m_expr2
;
1741 class LessEqNode
: public ExpressionNode
{
1743 LessEqNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1749 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1750 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1751 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1752 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1753 virtual Precedence
precedence() const { return PrecRelational
; }
1756 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1758 RefPtr
<ExpressionNode
> m_expr1
;
1759 RefPtr
<ExpressionNode
> m_expr2
;
1762 class GreaterEqNode
: public ExpressionNode
{
1764 GreaterEqNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1770 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1771 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1772 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1773 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1774 virtual Precedence
precedence() const { return PrecRelational
; }
1777 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1779 RefPtr
<ExpressionNode
> m_expr1
;
1780 RefPtr
<ExpressionNode
> m_expr2
;
1783 class InstanceOfNode
: public ExpressionNode
{
1785 InstanceOfNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1786 : ExpressionNode(BooleanType
)
1792 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1793 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1794 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1795 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1796 virtual Precedence
precedence() const { return PrecRelational
; }
1799 RefPtr
<ExpressionNode
> m_expr1
;
1800 RefPtr
<ExpressionNode
> m_expr2
;
1803 class InNode
: public ExpressionNode
{
1805 InNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1811 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1812 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1813 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1814 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1815 virtual Precedence
precedence() const { return PrecRelational
; }
1818 RefPtr
<ExpressionNode
> m_expr1
;
1819 RefPtr
<ExpressionNode
> m_expr2
;
1822 class EqualNode
: public ExpressionNode
{
1824 EqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1825 : ExpressionNode(BooleanType
)
1831 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1832 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1833 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1834 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1835 virtual Precedence
precedence() const { return PrecEquality
; }
1838 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1840 RefPtr
<ExpressionNode
> m_expr1
;
1841 RefPtr
<ExpressionNode
> m_expr2
;
1844 class NotEqualNode
: public ExpressionNode
{
1846 NotEqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1847 : ExpressionNode(BooleanType
)
1853 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1854 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1855 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1856 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1857 virtual Precedence
precedence() const { return PrecEquality
; }
1860 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1862 RefPtr
<ExpressionNode
> m_expr1
;
1863 RefPtr
<ExpressionNode
> m_expr2
;
1866 class StrictEqualNode
: public ExpressionNode
{
1868 StrictEqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1869 : ExpressionNode(BooleanType
)
1875 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1876 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1877 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1878 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1879 virtual Precedence
precedence() const { return PrecEquality
; }
1882 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1884 RefPtr
<ExpressionNode
> m_expr1
;
1885 RefPtr
<ExpressionNode
> m_expr2
;
1888 class NotStrictEqualNode
: public ExpressionNode
{
1890 NotStrictEqualNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1891 : ExpressionNode(BooleanType
)
1897 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1898 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1899 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1900 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1901 virtual Precedence
precedence() const { return PrecEquality
; }
1904 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
1906 RefPtr
<ExpressionNode
> m_expr1
;
1907 RefPtr
<ExpressionNode
> m_expr2
;
1910 class BitAndNode
: public ExpressionNode
{
1912 BitAndNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1913 : ExpressionNode(NumberType
)
1919 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1920 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1921 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1922 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1923 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1924 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1925 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1926 virtual Precedence
precedence() const { return PrecBitwiseAnd
; }
1929 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1931 RefPtr
<ExpressionNode
> m_expr1
;
1932 RefPtr
<ExpressionNode
> m_expr2
;
1935 class BitOrNode
: public ExpressionNode
{
1937 BitOrNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1938 : ExpressionNode(NumberType
)
1944 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1945 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1946 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1947 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1948 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1949 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1950 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1951 virtual Precedence
precedence() const { return PrecBitwiseOr
; }
1954 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1956 RefPtr
<ExpressionNode
> m_expr1
;
1957 RefPtr
<ExpressionNode
> m_expr2
;
1960 class BitXOrNode
: public ExpressionNode
{
1962 BitXOrNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1963 : ExpressionNode(NumberType
)
1969 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1970 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1971 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
1972 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
1973 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
1974 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
1975 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
1976 virtual Precedence
precedence() const { return PrecBitwiseXor
; }
1979 ALWAYS_INLINE
int32_t inlineEvaluateToInt32(ExecState
*);
1981 RefPtr
<ExpressionNode
> m_expr1
;
1982 RefPtr
<ExpressionNode
> m_expr2
;
1986 * m_expr1 && m_expr2, m_expr1 || m_expr2
1988 class LogicalAndNode
: public ExpressionNode
{
1990 LogicalAndNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
1991 : ExpressionNode(BooleanType
)
1997 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
1998 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
1999 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
2000 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2001 virtual Precedence
precedence() const { return PrecLogicalAnd
; }
2004 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
2006 RefPtr
<ExpressionNode
> m_expr1
;
2007 RefPtr
<ExpressionNode
> m_expr2
;
2010 class LogicalOrNode
: public ExpressionNode
{
2012 LogicalOrNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2013 : ExpressionNode(BooleanType
)
2019 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2020 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2021 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
2022 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2023 virtual Precedence
precedence() const { return PrecLogicalOr
; }
2026 ALWAYS_INLINE
bool inlineEvaluateToBoolean(ExecState
*);
2028 RefPtr
<ExpressionNode
> m_expr1
;
2029 RefPtr
<ExpressionNode
> m_expr2
;
2033 * The ternary operator, "m_logical ? m_expr1 : m_expr2"
2035 class ConditionalNode
: public ExpressionNode
{
2037 ConditionalNode(ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2038 : m_logical(logical
)
2044 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2045 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2046 virtual bool evaluateToBoolean(ExecState
*) KJS_FAST_CALL
;
2047 virtual double evaluateToNumber(ExecState
*) KJS_FAST_CALL
;
2048 virtual int32_t evaluateToInt32(ExecState
*) KJS_FAST_CALL
;
2049 virtual uint32_t evaluateToUInt32(ExecState
*) KJS_FAST_CALL
;
2050 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2051 virtual Precedence
precedence() const { return PrecConditional
; }
2054 RefPtr
<ExpressionNode
> m_logical
;
2055 RefPtr
<ExpressionNode
> m_expr1
;
2056 RefPtr
<ExpressionNode
> m_expr2
;
2059 class ReadModifyResolveNode
: public ExpressionNode
{
2061 ReadModifyResolveNode(const Identifier
& ident
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2068 ReadModifyResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
2069 : ExpressionNode(PlacementNewAdopt
)
2070 , m_ident(PlacementNewAdopt
)
2071 , m_right(PlacementNewAdopt
)
2075 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2076 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2077 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2078 virtual Precedence
precedence() const { return PrecAssignment
; }
2082 Operator m_operator
;
2083 RefPtr
<ExpressionNode
> m_right
;
2084 size_t m_index
; // Used by ReadModifyLocalVarNode.
2087 class ReadModifyLocalVarNode
: public ReadModifyResolveNode
{
2089 ReadModifyLocalVarNode(size_t i
) KJS_FAST_CALL
2090 : ReadModifyResolveNode(PlacementNewAdopt
)
2092 ASSERT(i
!= missingSymbolMarker());
2096 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2099 class ReadModifyConstNode
: public ReadModifyResolveNode
{
2101 ReadModifyConstNode(size_t i
) KJS_FAST_CALL
2102 : ReadModifyResolveNode(PlacementNewAdopt
)
2104 ASSERT(i
!= missingSymbolMarker());
2108 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2111 class AssignResolveNode
: public ExpressionNode
{
2113 AssignResolveNode(const Identifier
& ident
, ExpressionNode
* right
) KJS_FAST_CALL
2119 AssignResolveNode(PlacementNewAdoptType
) KJS_FAST_CALL
2120 : ExpressionNode(PlacementNewAdopt
)
2121 , m_ident(PlacementNewAdopt
)
2122 , m_right(PlacementNewAdopt
)
2126 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2127 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2128 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2129 virtual Precedence
precedence() const { return PrecAssignment
; }
2133 RefPtr
<ExpressionNode
> m_right
;
2134 size_t m_index
; // Used by ReadModifyLocalVarNode.
2137 class AssignLocalVarNode
: public AssignResolveNode
{
2139 AssignLocalVarNode(size_t i
) KJS_FAST_CALL
2140 : AssignResolveNode(PlacementNewAdopt
)
2142 ASSERT(i
!= missingSymbolMarker());
2146 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2149 class AssignConstNode
: public AssignResolveNode
{
2151 AssignConstNode() KJS_FAST_CALL
2152 : AssignResolveNode(PlacementNewAdopt
)
2156 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2159 class ReadModifyBracketNode
: public ExpressionNode
{
2161 ReadModifyBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2163 , m_subscript(subscript
)
2169 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2170 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2171 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2172 virtual Precedence
precedence() const { return PrecAssignment
; }
2175 RefPtr
<ExpressionNode
> m_base
;
2176 RefPtr
<ExpressionNode
> m_subscript
;
2177 Operator m_operator
;
2178 RefPtr
<ExpressionNode
> m_right
;
2181 class AssignBracketNode
: public ExpressionNode
{
2183 AssignBracketNode(ExpressionNode
* base
, ExpressionNode
* subscript
, ExpressionNode
* right
) KJS_FAST_CALL
2185 , m_subscript(subscript
)
2190 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2191 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2192 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2193 virtual Precedence
precedence() const { return PrecAssignment
; }
2196 RefPtr
<ExpressionNode
> m_base
;
2197 RefPtr
<ExpressionNode
> m_subscript
;
2198 RefPtr
<ExpressionNode
> m_right
;
2201 class AssignDotNode
: public ExpressionNode
{
2203 AssignDotNode(ExpressionNode
* base
, const Identifier
& ident
, ExpressionNode
* right
) KJS_FAST_CALL
2210 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2211 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2212 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2213 virtual Precedence
precedence() const { return PrecAssignment
; }
2216 RefPtr
<ExpressionNode
> m_base
;
2218 RefPtr
<ExpressionNode
> m_right
;
2221 class ReadModifyDotNode
: public ExpressionNode
{
2223 ReadModifyDotNode(ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2231 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2232 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2233 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2234 virtual Precedence
precedence() const { return PrecAssignment
; }
2237 RefPtr
<ExpressionNode
> m_base
;
2239 Operator m_operator
;
2240 RefPtr
<ExpressionNode
> m_right
;
2243 class AssignErrorNode
: public ExpressionNode
{
2245 AssignErrorNode(ExpressionNode
* left
, Operator oper
, ExpressionNode
* right
) KJS_FAST_CALL
2252 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2253 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2254 virtual Precedence
precedence() const { return PrecAssignment
; }
2257 RefPtr
<ExpressionNode
> m_left
;
2258 Operator m_operator
;
2259 RefPtr
<ExpressionNode
> m_right
;
2262 class CommaNode
: public ExpressionNode
{
2264 CommaNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2268 m_expr1
->optimizeForUnnecessaryResult();
2271 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2272 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2273 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2274 virtual Precedence
precedence() const { return PrecExpression
; }
2277 RefPtr
<ExpressionNode
> m_expr1
;
2278 RefPtr
<ExpressionNode
> m_expr2
;
2281 class VarDeclCommaNode
: public CommaNode
{
2283 VarDeclCommaNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
) KJS_FAST_CALL
2284 : CommaNode(expr1
, expr2
)
2287 virtual Precedence
precedence() const { return PrecAssignment
; }
2290 class ConstDeclNode
: public ExpressionNode
{
2292 ConstDeclNode(const Identifier
& ident
, ExpressionNode
* in
) KJS_FAST_CALL
;
2294 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2295 virtual KJS::JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2296 void evaluateSingle(ExecState
*) KJS_FAST_CALL
;
2297 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2298 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2299 PassRefPtr
<ConstDeclNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
2302 ListRefPtr
<ConstDeclNode
> m_next
;
2303 RefPtr
<ExpressionNode
> m_init
;
2306 void handleSlowCase(ExecState
*, const ScopeChain
&, JSValue
*) KJS_FAST_CALL NEVER_INLINE
;
2309 class ConstStatementNode
: public StatementNode
{
2311 ConstStatementNode(ConstDeclNode
* next
) KJS_FAST_CALL
2316 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2317 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2318 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2321 RefPtr
<ConstDeclNode
> m_next
;
2324 typedef Vector
<RefPtr
<StatementNode
> > StatementVector
;
2326 class SourceElements
: public ParserRefCounted
{
2328 void append(PassRefPtr
<StatementNode
>);
2329 void releaseContentsIntoVector(StatementVector
& destination
)
2331 ASSERT(destination
.isEmpty());
2332 m_statements
.swap(destination
);
2336 StatementVector m_statements
;
2339 class BlockNode
: public StatementNode
{
2341 BlockNode(SourceElements
* children
) KJS_FAST_CALL
;
2343 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2344 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2345 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2348 StatementVector m_children
;
2351 class EmptyStatementNode
: public StatementNode
{
2353 EmptyStatementNode() KJS_FAST_CALL
// debug
2357 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2358 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2359 virtual bool isEmptyStatement() const KJS_FAST_CALL
{ return true; }
2362 class ExprStatementNode
: public StatementNode
{
2364 ExprStatementNode(ExpressionNode
* expr
) KJS_FAST_CALL
2369 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2370 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2371 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2374 RefPtr
<ExpressionNode
> m_expr
;
2377 class VarStatementNode
: public StatementNode
{
2379 VarStatementNode(ExpressionNode
* expr
) KJS_FAST_CALL
2384 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2385 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2386 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2389 RefPtr
<ExpressionNode
> m_expr
;
2392 class IfNode
: public StatementNode
{
2394 IfNode(ExpressionNode
* condition
, StatementNode
* ifBlock
) KJS_FAST_CALL
2395 : m_condition(condition
)
2396 , m_ifBlock(ifBlock
)
2400 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2401 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2402 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2405 RefPtr
<ExpressionNode
> m_condition
;
2406 RefPtr
<StatementNode
> m_ifBlock
;
2409 class IfElseNode
: public IfNode
{
2411 IfElseNode(ExpressionNode
* condtion
, StatementNode
* ifBlock
, StatementNode
* elseBlock
) KJS_FAST_CALL
2412 : IfNode(condtion
, ifBlock
)
2413 , m_elseBlock(elseBlock
)
2417 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2418 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2419 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2422 RefPtr
<StatementNode
> m_elseBlock
;
2425 class DoWhileNode
: public StatementNode
{
2427 DoWhileNode(StatementNode
* statement
, ExpressionNode
* expr
) KJS_FAST_CALL
2428 : m_statement(statement
)
2433 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2434 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2435 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2438 RefPtr
<StatementNode
> m_statement
;
2439 RefPtr
<ExpressionNode
> m_expr
;
2442 class WhileNode
: public StatementNode
{
2444 WhileNode(ExpressionNode
* expr
, StatementNode
* statement
) KJS_FAST_CALL
2446 , m_statement(statement
)
2450 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2451 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2452 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2455 RefPtr
<ExpressionNode
> m_expr
;
2456 RefPtr
<StatementNode
> m_statement
;
2459 class ForNode
: public StatementNode
{
2461 ForNode(ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
, bool expr1WasVarDecl
) KJS_FAST_CALL
2462 : m_expr1(expr1
? expr1
: new PlaceholderTrueNode
)
2463 , m_expr2(expr2
? expr2
: new PlaceholderTrueNode
)
2464 , m_expr3(expr3
? expr3
: new PlaceholderTrueNode
)
2465 , m_statement(statement
)
2466 , m_expr1WasVarDecl(expr1
&& expr1WasVarDecl
)
2473 m_expr1
->optimizeForUnnecessaryResult();
2474 m_expr3
->optimizeForUnnecessaryResult();
2477 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2478 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2479 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2482 RefPtr
<ExpressionNode
> m_expr1
;
2483 RefPtr
<ExpressionNode
> m_expr2
;
2484 RefPtr
<ExpressionNode
> m_expr3
;
2485 RefPtr
<StatementNode
> m_statement
;
2486 bool m_expr1WasVarDecl
;
2489 class ForInNode
: public StatementNode
{
2491 ForInNode(ExpressionNode
*, ExpressionNode
*, StatementNode
*) KJS_FAST_CALL
;
2492 ForInNode(const Identifier
&, ExpressionNode
*, ExpressionNode
*, StatementNode
*) KJS_FAST_CALL
;
2494 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2495 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2496 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2500 RefPtr
<ExpressionNode
> m_init
;
2501 RefPtr
<ExpressionNode
> m_lexpr
;
2502 RefPtr
<ExpressionNode
> m_expr
;
2503 RefPtr
<StatementNode
> m_statement
;
2504 bool m_identIsVarDecl
;
2507 class ContinueNode
: public StatementNode
{
2509 ContinueNode() KJS_FAST_CALL
2513 ContinueNode(const Identifier
& ident
) KJS_FAST_CALL
2518 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2519 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2525 class BreakNode
: public StatementNode
{
2527 BreakNode() KJS_FAST_CALL
2531 BreakNode(const Identifier
& ident
) KJS_FAST_CALL
2536 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2537 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2543 class ReturnNode
: public StatementNode
{
2545 ReturnNode(ExpressionNode
* value
) KJS_FAST_CALL
2550 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2551 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2552 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2555 RefPtr
<ExpressionNode
> m_value
;
2558 class WithNode
: public StatementNode
{
2560 WithNode(ExpressionNode
* expr
, StatementNode
* statement
) KJS_FAST_CALL
2562 , m_statement(statement
)
2566 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2567 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2568 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2571 RefPtr
<ExpressionNode
> m_expr
;
2572 RefPtr
<StatementNode
> m_statement
;
2575 class LabelNode
: public StatementNode
{
2577 LabelNode(const Identifier
& label
, StatementNode
* statement
) KJS_FAST_CALL
2579 , m_statement(statement
)
2583 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2584 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2585 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2589 RefPtr
<StatementNode
> m_statement
;
2592 class ThrowNode
: public StatementNode
{
2594 ThrowNode(ExpressionNode
* expr
) KJS_FAST_CALL
2599 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2600 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2601 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2604 RefPtr
<ExpressionNode
> m_expr
;
2607 class TryNode
: public StatementNode
{
2609 TryNode(StatementNode
* tryBlock
, const Identifier
& exceptionIdent
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
) KJS_FAST_CALL
2610 : m_tryBlock(tryBlock
)
2611 , m_exceptionIdent(exceptionIdent
)
2612 , m_catchBlock(catchBlock
)
2613 , m_finallyBlock(finallyBlock
)
2617 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2618 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2619 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2622 RefPtr
<StatementNode
> m_tryBlock
;
2623 Identifier m_exceptionIdent
;
2624 RefPtr
<StatementNode
> m_catchBlock
;
2625 RefPtr
<StatementNode
> m_finallyBlock
;
2628 class ParameterNode
: public Node
{
2630 ParameterNode(const Identifier
& ident
) KJS_FAST_CALL
2635 ParameterNode(ParameterNode
* l
, const Identifier
& ident
) KJS_FAST_CALL
2641 Identifier
ident() KJS_FAST_CALL
{ return m_ident
; }
2642 ParameterNode
*nextParam() KJS_FAST_CALL
{ return m_next
.get(); }
2643 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2644 PassRefPtr
<ParameterNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
2645 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2648 friend class FuncDeclNode
;
2649 friend class FuncExprNode
;
2651 ListRefPtr
<ParameterNode
> m_next
;
2654 class ScopeNode
: public BlockNode
{
2656 ScopeNode(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2658 int sourceId() const KJS_FAST_CALL
{ return m_sourceId
; }
2659 const UString
& sourceURL() const KJS_FAST_CALL
{ return m_sourceURL
; }
2660 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2663 void optimizeVariableAccess(ExecState
*) KJS_FAST_CALL
;
2665 VarStack m_varStack
;
2666 FunctionStack m_functionStack
;
2669 UString m_sourceURL
;
2673 class ProgramNode
: public ScopeNode
{
2675 static ProgramNode
* create(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2677 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2680 ProgramNode(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2682 void initializeSymbolTable(ExecState
*) KJS_FAST_CALL
;
2683 ALWAYS_INLINE
void processDeclarations(ExecState
*) KJS_FAST_CALL
;
2685 Vector
<size_t> m_varIndexes
; // Storage indexes belonging to the nodes in m_varStack. (Recorded to avoid double lookup.)
2686 Vector
<size_t> m_functionIndexes
; // Storage indexes belonging to the nodes in m_functionStack. (Recorded to avoid double lookup.)
2689 class EvalNode
: public ScopeNode
{
2691 static EvalNode
* create(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2693 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2696 EvalNode(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2698 ALWAYS_INLINE
void processDeclarations(ExecState
*) KJS_FAST_CALL
;
2701 class FunctionBodyNode
: public ScopeNode
{
2703 static FunctionBodyNode
* create(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2705 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2707 SymbolTable
& symbolTable() KJS_FAST_CALL
{ return m_symbolTable
; }
2709 Vector
<Identifier
>& parameters() KJS_FAST_CALL
{ return m_parameters
; }
2710 UString
paramString() const KJS_FAST_CALL
;
2713 FunctionBodyNode(SourceElements
*, VarStack
*, FunctionStack
*) KJS_FAST_CALL
;
2716 void initializeSymbolTable(ExecState
*) KJS_FAST_CALL
;
2717 ALWAYS_INLINE
void processDeclarations(ExecState
*) KJS_FAST_CALL
;
2720 Vector
<Identifier
> m_parameters
;
2721 SymbolTable m_symbolTable
;
2724 class FuncExprNode
: public ExpressionNode
{
2726 FuncExprNode(const Identifier
& ident
, FunctionBodyNode
* body
, ParameterNode
* parameter
= 0) KJS_FAST_CALL
2728 , m_parameter(parameter
)
2734 virtual JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2735 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2736 virtual Precedence
precedence() const { return PrecMember
; }
2737 virtual bool needsParensIfLeftmost() const { return true; }
2740 void addParams() KJS_FAST_CALL
;
2742 // Used for streamTo
2743 friend class PropertyNode
;
2745 RefPtr
<ParameterNode
> m_parameter
;
2746 RefPtr
<FunctionBodyNode
> m_body
;
2749 class FuncDeclNode
: public StatementNode
{
2751 FuncDeclNode(const Identifier
& ident
, FunctionBodyNode
* body
) KJS_FAST_CALL
2758 FuncDeclNode(const Identifier
& ident
, ParameterNode
* parameter
, FunctionBodyNode
* body
) KJS_FAST_CALL
2760 , m_parameter(parameter
)
2766 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2767 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2768 ALWAYS_INLINE FunctionImp
* makeFunction(ExecState
*) KJS_FAST_CALL
;
2773 void addParams() KJS_FAST_CALL
;
2775 RefPtr
<ParameterNode
> m_parameter
;
2776 RefPtr
<FunctionBodyNode
> m_body
;
2779 class CaseClauseNode
: public Node
{
2781 CaseClauseNode(ExpressionNode
* expr
) KJS_FAST_CALL
2786 CaseClauseNode(ExpressionNode
* expr
, SourceElements
* children
) KJS_FAST_CALL
2790 children
->releaseContentsIntoVector(m_children
);
2793 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2794 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2795 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2797 JSValue
* evaluate(ExecState
*) KJS_FAST_CALL
;
2798 JSValue
* executeStatements(ExecState
*) KJS_FAST_CALL
;
2801 RefPtr
<ExpressionNode
> m_expr
;
2802 StatementVector m_children
;
2805 class ClauseListNode
: public Node
{
2807 ClauseListNode(CaseClauseNode
* clause
) KJS_FAST_CALL
2812 ClauseListNode(ClauseListNode
* clauseList
, CaseClauseNode
* clause
) KJS_FAST_CALL
2815 clauseList
->m_next
= this;
2818 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2819 CaseClauseNode
* getClause() const KJS_FAST_CALL
{ return m_clause
.get(); }
2820 ClauseListNode
* getNext() const KJS_FAST_CALL
{ return m_next
.get(); }
2821 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2822 PassRefPtr
<ClauseListNode
> releaseNext() KJS_FAST_CALL
{ return m_next
.release(); }
2823 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2826 friend class CaseBlockNode
;
2827 RefPtr
<CaseClauseNode
> m_clause
;
2828 ListRefPtr
<ClauseListNode
> m_next
;
2831 class CaseBlockNode
: public Node
{
2833 CaseBlockNode(ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
) KJS_FAST_CALL
;
2835 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2836 JSValue
* executeBlock(ExecState
*, JSValue
*input
) KJS_FAST_CALL
;
2837 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2838 virtual Precedence
precedence() const { ASSERT_NOT_REACHED(); return PrecExpression
; }
2841 RefPtr
<ClauseListNode
> m_list1
;
2842 RefPtr
<CaseClauseNode
> m_defaultClause
;
2843 RefPtr
<ClauseListNode
> m_list2
;
2846 class SwitchNode
: public StatementNode
{
2848 SwitchNode(ExpressionNode
* expr
, CaseBlockNode
* block
) KJS_FAST_CALL
2854 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2855 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2856 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2859 RefPtr
<ExpressionNode
> m_expr
;
2860 RefPtr
<CaseBlockNode
> m_block
;
2863 class BreakpointCheckStatement
: public StatementNode
{
2865 BreakpointCheckStatement(PassRefPtr
<StatementNode
>) KJS_FAST_CALL
;
2867 virtual JSValue
* execute(ExecState
*) KJS_FAST_CALL
;
2868 virtual void streamTo(SourceStream
&) const KJS_FAST_CALL
;
2869 virtual void optimizeVariableAccess(const SymbolTable
&, const LocalStorage
&, NodeStack
&) KJS_FAST_CALL
;
2872 RefPtr
<StatementNode
> m_statement
;
2875 struct ElementList
{
2880 struct PropertyList
{
2881 PropertyListNode
* head
;
2882 PropertyListNode
* tail
;
2885 struct ArgumentList
{
2886 ArgumentListNode
* head
;
2887 ArgumentListNode
* tail
;
2890 struct ConstDeclList
{
2891 ConstDeclNode
* head
;
2892 ConstDeclNode
* tail
;
2895 struct ParameterList
{
2896 ParameterNode
* head
;
2897 ParameterNode
* tail
;
2901 ClauseListNode
* head
;
2902 ClauseListNode
* tail
;