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, 2009 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. 
  32 #include "ParserArena.h" 
  33 #include "ResultType.h" 
  34 #include "SourceCode.h" 
  35 #include "SymbolTable.h" 
  36 #include <wtf/MathExtras.h> 
  40     class ArgumentListNode
; 
  41     class BytecodeGenerator
; 
  42     class FunctionBodyNode
; 
  44     class PropertyListNode
; 
  45     class ReadModifyResolveNode
; 
  50     typedef unsigned CodeFeatures
; 
  52     const CodeFeatures NoFeatures 
= 0; 
  53     const CodeFeatures EvalFeature 
= 1 << 0; 
  54     const CodeFeatures ClosureFeature 
= 1 << 1; 
  55     const CodeFeatures AssignFeature 
= 1 << 2; 
  56     const CodeFeatures ArgumentsFeature 
= 1 << 3; 
  57     const CodeFeatures WithFeature 
= 1 << 4; 
  58     const CodeFeatures CatchFeature 
= 1 << 5; 
  59     const CodeFeatures ThisFeature 
= 1 << 6; 
  60     const CodeFeatures AllFeatures 
= EvalFeature 
| ClosureFeature 
| AssignFeature 
| ArgumentsFeature 
| WithFeature 
| CatchFeature 
| ThisFeature
; 
  79     enum LogicalOperator 
{ 
  84     namespace DeclarationStacks 
{ 
  85         enum VarAttrs 
{ IsConstant 
= 1, HasInitializer 
= 2 }; 
  86         typedef Vector
<std::pair
<const Identifier
*, unsigned> > VarStack
; 
  87         typedef Vector
<FunctionBodyNode
*> FunctionStack
; 
  91         enum SwitchType 
{ SwitchNone
, SwitchImmediate
, SwitchCharacter
, SwitchString 
}; 
  92         uint32_t bytecodeOffset
; 
  93         SwitchType switchType
; 
  96     class ParserArenaFreeable 
{ 
  98         // ParserArenaFreeable objects are are freed when the arena is deleted. 
  99         // Destructors are not called. Clients must not call delete on such objects. 
 100         void* operator new(size_t, JSGlobalData
*); 
 103     class ParserArenaDeletable 
{ 
 105         virtual ~ParserArenaDeletable() { } 
 107         // ParserArenaDeletable objects are deleted when the arena is deleted. 
 108         // Clients must not call delete directly on such objects. 
 109         void* operator new(size_t, JSGlobalData
*); 
 112     class ParserArenaRefCounted 
: public RefCounted
<ParserArenaRefCounted
> { 
 114         ParserArenaRefCounted(JSGlobalData
*); 
 117         virtual ~ParserArenaRefCounted() 
 119             ASSERT(deletionHasBegun()); 
 123     class Node 
: public ParserArenaFreeable 
{ 
 130         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* destination 
= 0) = 0; 
 132         int lineNo() const { return m_line
; } 
 138     class ExpressionNode 
: public Node 
{ 
 140         ExpressionNode(JSGlobalData
*, ResultType 
= ResultType::unknownType()); 
 143         virtual bool isNumber() const { return false; } 
 144         virtual bool isString() const { return false; } 
 145         virtual bool isNull() const { return false; } 
 146         virtual bool isPure(BytecodeGenerator
&) const { return false; }         
 147         virtual bool isLocation() const { return false; } 
 148         virtual bool isResolveNode() const { return false; } 
 149         virtual bool isBracketAccessorNode() const { return false; } 
 150         virtual bool isDotAccessorNode() const { return false; } 
 151         virtual bool isFuncExprNode() const { return false; } 
 152         virtual bool isCommaNode() const { return false; } 
 153         virtual bool isSimpleArray() const { return false; } 
 154         virtual bool isAdd() const { return false; } 
 155         virtual bool hasConditionContextCodegen() const { return false; } 
 157         virtual void emitBytecodeInConditionContext(BytecodeGenerator
&, Label
*, Label
*, bool) { ASSERT_NOT_REACHED(); } 
 159         virtual ExpressionNode
* stripUnaryPlus() { return this; } 
 161         ResultType 
resultDescriptor() const { return m_resultType
; } 
 164         ResultType m_resultType
; 
 167     class StatementNode 
: public Node 
{ 
 169         StatementNode(JSGlobalData
*); 
 172         void setLoc(int firstLine
, int lastLine
); 
 173         int firstLine() const { return lineNo(); } 
 174         int lastLine() const { return m_lastLine
; } 
 176         virtual bool isEmptyStatement() const { return false; } 
 177         virtual bool isReturnNode() const { return false; } 
 178         virtual bool isExprStatement() const { return false; } 
 180         virtual bool isBlock() const { return false; } 
 186     class NullNode 
: public ExpressionNode 
{ 
 188         NullNode(JSGlobalData
*); 
 191         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 193         virtual bool isNull() const { return true; } 
 196     class BooleanNode 
: public ExpressionNode 
{ 
 198         BooleanNode(JSGlobalData
*, bool value
); 
 201         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 203         virtual bool isPure(BytecodeGenerator
&) const { return true; } 
 208     class NumberNode 
: public ExpressionNode 
{ 
 210         NumberNode(JSGlobalData
*, double value
); 
 212         double value() const { return m_value
; } 
 213         void setValue(double value
) { m_value 
= value
; } 
 216         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 218         virtual bool isNumber() const { return true; } 
 219         virtual bool isPure(BytecodeGenerator
&) const { return true; } 
 224     class StringNode 
: public ExpressionNode 
{ 
 226         StringNode(JSGlobalData
*, const Identifier
&); 
 228         const Identifier
& value() { return m_value
; } 
 231         virtual bool isPure(BytecodeGenerator
&) const { return true; } 
 233         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 235         virtual bool isString() const { return true; } 
 237         const Identifier
& m_value
; 
 240     class ThrowableExpressionData 
{ 
 242         ThrowableExpressionData() 
 243             : m_divot(static_cast<uint32_t>(-1)) 
 244             , m_startOffset(static_cast<uint16_t>(-1)) 
 245             , m_endOffset(static_cast<uint16_t>(-1)) 
 249         ThrowableExpressionData(unsigned divot
, unsigned startOffset
, unsigned endOffset
) 
 251             , m_startOffset(startOffset
) 
 252             , m_endOffset(endOffset
) 
 256         void setExceptionSourceCode(unsigned divot
, unsigned startOffset
, unsigned endOffset
) 
 259             m_startOffset 
= startOffset
; 
 260             m_endOffset 
= endOffset
; 
 263         uint32_t divot() const { return m_divot
; } 
 264         uint16_t startOffset() const { return m_startOffset
; } 
 265         uint16_t endOffset() const { return m_endOffset
; } 
 268         RegisterID
* emitThrowError(BytecodeGenerator
&, ErrorType
, const char* message
); 
 269         RegisterID
* emitThrowError(BytecodeGenerator
&, ErrorType
, const char* message
, const UString
&); 
 270         RegisterID
* emitThrowError(BytecodeGenerator
&, ErrorType
, const char* message
, const Identifier
&); 
 274         uint16_t m_startOffset
; 
 275         uint16_t m_endOffset
; 
 278     class ThrowableSubExpressionData 
: public ThrowableExpressionData 
{ 
 280         ThrowableSubExpressionData() 
 281             : m_subexpressionDivotOffset(0) 
 282             , m_subexpressionEndOffset(0) 
 286         ThrowableSubExpressionData(unsigned divot
, unsigned startOffset
, unsigned endOffset
) 
 287             : ThrowableExpressionData(divot
, startOffset
, endOffset
) 
 288             , m_subexpressionDivotOffset(0) 
 289             , m_subexpressionEndOffset(0) 
 293         void setSubexpressionInfo(uint32_t subexpressionDivot
, uint16_t subexpressionOffset
) 
 295             ASSERT(subexpressionDivot 
<= divot()); 
 296             if ((divot() - subexpressionDivot
) & ~0xFFFF) // Overflow means we can't do this safely, so just point at the primary divot 
 298             m_subexpressionDivotOffset 
= divot() - subexpressionDivot
; 
 299             m_subexpressionEndOffset 
= subexpressionOffset
; 
 303         uint16_t m_subexpressionDivotOffset
; 
 304         uint16_t m_subexpressionEndOffset
; 
 307     class ThrowablePrefixedSubExpressionData 
: public ThrowableExpressionData 
{ 
 309         ThrowablePrefixedSubExpressionData() 
 310             : m_subexpressionDivotOffset(0) 
 311             , m_subexpressionStartOffset(0) 
 315         ThrowablePrefixedSubExpressionData(unsigned divot
, unsigned startOffset
, unsigned endOffset
) 
 316             : ThrowableExpressionData(divot
, startOffset
, endOffset
) 
 317             , m_subexpressionDivotOffset(0) 
 318             , m_subexpressionStartOffset(0) 
 322         void setSubexpressionInfo(uint32_t subexpressionDivot
, uint16_t subexpressionOffset
) 
 324             ASSERT(subexpressionDivot 
>= divot()); 
 325             if ((subexpressionDivot 
- divot()) & ~0xFFFF) // Overflow means we can't do this safely, so just point at the primary divot 
 327             m_subexpressionDivotOffset 
= subexpressionDivot 
- divot(); 
 328             m_subexpressionStartOffset 
= subexpressionOffset
; 
 332         uint16_t m_subexpressionDivotOffset
; 
 333         uint16_t m_subexpressionStartOffset
; 
 336     class RegExpNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 338         RegExpNode(JSGlobalData
*, const Identifier
& pattern
, const Identifier
& flags
); 
 341         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 343         const Identifier
& m_pattern
; 
 344         const Identifier
& m_flags
; 
 347     class ThisNode 
: public ExpressionNode 
{ 
 349         ThisNode(JSGlobalData
*); 
 352         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 355     class ResolveNode 
: public ExpressionNode 
{ 
 357         ResolveNode(JSGlobalData
*, const Identifier
&, int startOffset
); 
 359         const Identifier
& identifier() const { return m_ident
; } 
 362         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 364         virtual bool isPure(BytecodeGenerator
&) const ; 
 365         virtual bool isLocation() const { return true; } 
 366         virtual bool isResolveNode() const { return true; } 
 368         const Identifier
& m_ident
; 
 369         int32_t m_startOffset
; 
 372     class ElementNode 
: public ParserArenaFreeable 
{ 
 374         ElementNode(JSGlobalData
*, int elision
, ExpressionNode
*); 
 375         ElementNode(JSGlobalData
*, ElementNode
*, int elision
, ExpressionNode
*); 
 377         int elision() const { return m_elision
; } 
 378         ExpressionNode
* value() { return m_node
; } 
 379         ElementNode
* next() { return m_next
; } 
 384         ExpressionNode
* m_node
; 
 387     class ArrayNode 
: public ExpressionNode 
{ 
 389         ArrayNode(JSGlobalData
*, int elision
); 
 390         ArrayNode(JSGlobalData
*, ElementNode
*); 
 391         ArrayNode(JSGlobalData
*, int elision
, ElementNode
*); 
 393         ArgumentListNode
* toArgumentList(JSGlobalData
*) const; 
 396         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 398         virtual bool isSimpleArray() const ; 
 400         ElementNode
* m_element
; 
 405     class PropertyNode 
: public ParserArenaFreeable 
{ 
 407         enum Type 
{ Constant
, Getter
, Setter 
}; 
 409         PropertyNode(JSGlobalData
*, const Identifier
& name
, ExpressionNode
* value
, Type
); 
 410         PropertyNode(JSGlobalData
*, double name
, ExpressionNode
* value
, Type
); 
 412         const Identifier
& name() const { return m_name
; } 
 415         friend class PropertyListNode
; 
 416         const Identifier
& m_name
; 
 417         ExpressionNode
* m_assign
; 
 421     class PropertyListNode 
: public Node 
{ 
 423         PropertyListNode(JSGlobalData
*, PropertyNode
*); 
 424         PropertyListNode(JSGlobalData
*, PropertyNode
*, PropertyListNode
*); 
 426         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 429         PropertyNode
* m_node
; 
 430         PropertyListNode
* m_next
; 
 433     class ObjectLiteralNode 
: public ExpressionNode 
{ 
 435         ObjectLiteralNode(JSGlobalData
*); 
 436         ObjectLiteralNode(JSGlobalData
*, PropertyListNode
*); 
 439         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 441         PropertyListNode
* m_list
; 
 444     class BracketAccessorNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 446         BracketAccessorNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, bool subscriptHasAssignments
); 
 448         ExpressionNode
* base() const { return m_base
; } 
 449         ExpressionNode
* subscript() const { return m_subscript
; } 
 452         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 454         virtual bool isLocation() const { return true; } 
 455         virtual bool isBracketAccessorNode() const { return true; } 
 457         ExpressionNode
* m_base
; 
 458         ExpressionNode
* m_subscript
; 
 459         bool m_subscriptHasAssignments
; 
 462     class DotAccessorNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 464         DotAccessorNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&); 
 466         ExpressionNode
* base() const { return m_base
; } 
 467         const Identifier
& identifier() const { return m_ident
; } 
 470         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 472         virtual bool isLocation() const { return true; } 
 473         virtual bool isDotAccessorNode() const { return true; } 
 475         ExpressionNode
* m_base
; 
 476         const Identifier
& m_ident
; 
 479     class ArgumentListNode 
: public Node 
{ 
 481         ArgumentListNode(JSGlobalData
*, ExpressionNode
*); 
 482         ArgumentListNode(JSGlobalData
*, ArgumentListNode
*, ExpressionNode
*); 
 484         ArgumentListNode
* m_next
; 
 485         ExpressionNode
* m_expr
; 
 488         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 491     class ArgumentsNode 
: public ParserArenaFreeable 
{ 
 493         ArgumentsNode(JSGlobalData
*); 
 494         ArgumentsNode(JSGlobalData
*, ArgumentListNode
*); 
 496         ArgumentListNode
* m_listNode
; 
 499     class NewExprNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 501         NewExprNode(JSGlobalData
*, ExpressionNode
*); 
 502         NewExprNode(JSGlobalData
*, ExpressionNode
*, ArgumentsNode
*); 
 505         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 507         ExpressionNode
* m_expr
; 
 508         ArgumentsNode
* m_args
; 
 511     class EvalFunctionCallNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 513         EvalFunctionCallNode(JSGlobalData
*, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 516         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 518         ArgumentsNode
* m_args
; 
 521     class FunctionCallValueNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 523         FunctionCallValueNode(JSGlobalData
*, ExpressionNode
*, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 526         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 528         ExpressionNode
* m_expr
; 
 529         ArgumentsNode
* m_args
; 
 532     class FunctionCallResolveNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 534         FunctionCallResolveNode(JSGlobalData
*, const Identifier
&, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 537         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 539         const Identifier
& m_ident
; 
 540         ArgumentsNode
* m_args
; 
 541         size_t m_index
; // Used by LocalVarFunctionCallNode. 
 542         size_t m_scopeDepth
; // Used by ScopedVarFunctionCallNode and NonLocalVarFunctionCallNode 
 545     class FunctionCallBracketNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
 547         FunctionCallBracketNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 550         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 552         ExpressionNode
* m_base
; 
 553         ExpressionNode
* m_subscript
; 
 554         ArgumentsNode
* m_args
; 
 557     class FunctionCallDotNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
 559         FunctionCallDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 562         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 565         ExpressionNode
* m_base
; 
 566         const Identifier
& m_ident
; 
 567         ArgumentsNode
* m_args
; 
 570     class CallFunctionCallDotNode 
: public FunctionCallDotNode 
{ 
 572         CallFunctionCallDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 575         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 578     class ApplyFunctionCallDotNode 
: public FunctionCallDotNode 
{ 
 580         ApplyFunctionCallDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, ArgumentsNode
*, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 583         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 586     class PrePostResolveNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 588         PrePostResolveNode(JSGlobalData
*, const Identifier
&, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 591         const Identifier
& m_ident
; 
 594     class PostfixResolveNode 
: public PrePostResolveNode 
{ 
 596         PostfixResolveNode(JSGlobalData
*, const Identifier
&, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 599         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 604     class PostfixBracketNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
 606         PostfixBracketNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 609         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 611         ExpressionNode
* m_base
; 
 612         ExpressionNode
* m_subscript
; 
 616     class PostfixDotNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
 618         PostfixDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 621         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 623         ExpressionNode
* m_base
; 
 624         const Identifier
& m_ident
; 
 628     class PostfixErrorNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
 630         PostfixErrorNode(JSGlobalData
*, ExpressionNode
*, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 633         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 635         ExpressionNode
* m_expr
; 
 639     class DeleteResolveNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 641         DeleteResolveNode(JSGlobalData
*, const Identifier
&, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 644         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 646         const Identifier
& m_ident
; 
 649     class DeleteBracketNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 651         DeleteBracketNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 654         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 656         ExpressionNode
* m_base
; 
 657         ExpressionNode
* m_subscript
; 
 660     class DeleteDotNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 662         DeleteDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 665         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 667         ExpressionNode
* m_base
; 
 668         const Identifier
& m_ident
; 
 671     class DeleteValueNode 
: public ExpressionNode 
{ 
 673         DeleteValueNode(JSGlobalData
*, ExpressionNode
*); 
 676         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 678         ExpressionNode
* m_expr
; 
 681     class VoidNode 
: public ExpressionNode 
{ 
 683         VoidNode(JSGlobalData
*, ExpressionNode
*); 
 686         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 688         ExpressionNode
* m_expr
; 
 691     class TypeOfResolveNode 
: public ExpressionNode 
{ 
 693         TypeOfResolveNode(JSGlobalData
*, const Identifier
&); 
 695         const Identifier
& identifier() const { return m_ident
; } 
 698         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 700         const Identifier
& m_ident
; 
 703     class TypeOfValueNode 
: public ExpressionNode 
{ 
 705         TypeOfValueNode(JSGlobalData
*, ExpressionNode
*); 
 708         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 710         ExpressionNode
* m_expr
; 
 713     class PrefixResolveNode 
: public PrePostResolveNode 
{ 
 715         PrefixResolveNode(JSGlobalData
*, const Identifier
&, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 718         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 723     class PrefixBracketNode 
: public ExpressionNode
, public ThrowablePrefixedSubExpressionData 
{ 
 725         PrefixBracketNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 728         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 730         ExpressionNode
* m_base
; 
 731         ExpressionNode
* m_subscript
; 
 735     class PrefixDotNode 
: public ExpressionNode
, public ThrowablePrefixedSubExpressionData 
{ 
 737         PrefixDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 740         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 742         ExpressionNode
* m_base
; 
 743         const Identifier
& m_ident
; 
 747     class PrefixErrorNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 749         PrefixErrorNode(JSGlobalData
*, ExpressionNode
*, Operator
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 752         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 754         ExpressionNode
* m_expr
; 
 758     class UnaryOpNode 
: public ExpressionNode 
{ 
 760         UnaryOpNode(JSGlobalData
*, ResultType
, ExpressionNode
*, OpcodeID
); 
 763         ExpressionNode
* expr() { return m_expr
; } 
 764         const ExpressionNode
* expr() const { return m_expr
; } 
 767         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 769         OpcodeID 
opcodeID() const { return m_opcodeID
; } 
 771         ExpressionNode
* m_expr
; 
 775     class UnaryPlusNode 
: public UnaryOpNode 
{ 
 777         UnaryPlusNode(JSGlobalData
*, ExpressionNode
*); 
 780         virtual ExpressionNode
* stripUnaryPlus() { return expr(); } 
 783     class NegateNode 
: public UnaryOpNode 
{ 
 785         NegateNode(JSGlobalData
*, ExpressionNode
*); 
 788     class BitwiseNotNode 
: public UnaryOpNode 
{ 
 790         BitwiseNotNode(JSGlobalData
*, ExpressionNode
*); 
 793     class LogicalNotNode 
: public UnaryOpNode 
{ 
 795         LogicalNotNode(JSGlobalData
*, ExpressionNode
*); 
 797         void emitBytecodeInConditionContext(BytecodeGenerator
&, Label
* trueTarget
, Label
* falseTarget
, bool fallThroughMeansTrue
); 
 798         virtual bool hasConditionContextCodegen() const { return expr()->hasConditionContextCodegen(); } 
 801     class BinaryOpNode 
: public ExpressionNode 
{ 
 803         BinaryOpNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID
, bool rightHasAssignments
); 
 804         BinaryOpNode(JSGlobalData
*, ResultType
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID
, bool rightHasAssignments
); 
 806         RegisterID
* emitStrcat(BytecodeGenerator
& generator
, RegisterID
* destination
, RegisterID
* lhs 
= 0, ReadModifyResolveNode
* emitExpressionInfoForMe 
= 0); 
 809         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 812         OpcodeID 
opcodeID() const { return m_opcodeID
; } 
 815         ExpressionNode
* m_expr1
; 
 816         ExpressionNode
* m_expr2
; 
 820         bool m_rightHasAssignments
; 
 823     class ReverseBinaryOpNode 
: public BinaryOpNode 
{ 
 825         ReverseBinaryOpNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID
, bool rightHasAssignments
); 
 826         ReverseBinaryOpNode(JSGlobalData
*, ResultType
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID
, bool rightHasAssignments
); 
 828         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 831     class MultNode 
: public BinaryOpNode 
{ 
 833         MultNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 836     class DivNode 
: public BinaryOpNode 
{ 
 838         DivNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 841     class ModNode 
: public BinaryOpNode 
{ 
 843         ModNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 846     class AddNode 
: public BinaryOpNode 
{ 
 848         AddNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 850         virtual bool isAdd() const { return true; } 
 853     class SubNode 
: public BinaryOpNode 
{ 
 855         SubNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 858     class LeftShiftNode 
: public BinaryOpNode 
{ 
 860         LeftShiftNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 863     class RightShiftNode 
: public BinaryOpNode 
{ 
 865         RightShiftNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 868     class UnsignedRightShiftNode 
: public BinaryOpNode 
{ 
 870         UnsignedRightShiftNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 873     class LessNode 
: public BinaryOpNode 
{ 
 875         LessNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 878     class GreaterNode 
: public ReverseBinaryOpNode 
{ 
 880         GreaterNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 883     class LessEqNode 
: public BinaryOpNode 
{ 
 885         LessEqNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 888     class GreaterEqNode 
: public ReverseBinaryOpNode 
{ 
 890         GreaterEqNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 893     class ThrowableBinaryOpNode 
: public BinaryOpNode
, public ThrowableExpressionData 
{ 
 895         ThrowableBinaryOpNode(JSGlobalData
*, ResultType
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID
, bool rightHasAssignments
); 
 896         ThrowableBinaryOpNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID
, bool rightHasAssignments
); 
 899         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 902     class InstanceOfNode 
: public ThrowableBinaryOpNode 
{ 
 904         InstanceOfNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 907         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 910     class InNode 
: public ThrowableBinaryOpNode 
{ 
 912         InNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 915     class EqualNode 
: public BinaryOpNode 
{ 
 917         EqualNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 920         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 923     class NotEqualNode 
: public BinaryOpNode 
{ 
 925         NotEqualNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 928     class StrictEqualNode 
: public BinaryOpNode 
{ 
 930         StrictEqualNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 933         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 936     class NotStrictEqualNode 
: public BinaryOpNode 
{ 
 938         NotStrictEqualNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 941     class BitAndNode 
: public BinaryOpNode 
{ 
 943         BitAndNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 946     class BitOrNode 
: public BinaryOpNode 
{ 
 948         BitOrNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 951     class BitXOrNode 
: public BinaryOpNode 
{ 
 953         BitXOrNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
); 
 956     // m_expr1 && m_expr2, m_expr1 || m_expr2 
 957     class LogicalOpNode 
: public ExpressionNode 
{ 
 959         LogicalOpNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, LogicalOperator
); 
 962         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 963         void emitBytecodeInConditionContext(BytecodeGenerator
&, Label
* trueTarget
, Label
* falseTarget
, bool fallThroughMeansTrue
); 
 964         virtual bool hasConditionContextCodegen() const { return true; } 
 966         ExpressionNode
* m_expr1
; 
 967         ExpressionNode
* m_expr2
; 
 968         LogicalOperator m_operator
; 
 971     // The ternary operator, "m_logical ? m_expr1 : m_expr2" 
 972     class ConditionalNode 
: public ExpressionNode 
{ 
 974         ConditionalNode(JSGlobalData
*, ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
); 
 977         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 979         ExpressionNode
* m_logical
; 
 980         ExpressionNode
* m_expr1
; 
 981         ExpressionNode
* m_expr2
; 
 984     class ReadModifyResolveNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
 986         ReadModifyResolveNode(JSGlobalData
*, const Identifier
&, Operator
, ExpressionNode
*  right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
 989         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
 991         const Identifier
& m_ident
; 
 992         ExpressionNode
* m_right
; 
 993         size_t m_index
; // Used by ReadModifyLocalVarNode. 
 995         bool m_rightHasAssignments
; 
 998     class AssignResolveNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
1000         AssignResolveNode(JSGlobalData
*, const Identifier
&, ExpressionNode
* right
, bool rightHasAssignments
); 
1003         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1005         const Identifier
& m_ident
; 
1006         ExpressionNode
* m_right
; 
1007         size_t m_index
; // Used by ReadModifyLocalVarNode. 
1008         bool m_rightHasAssignments
; 
1011     class ReadModifyBracketNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
1013         ReadModifyBracketNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
1016         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1018         ExpressionNode
* m_base
; 
1019         ExpressionNode
* m_subscript
; 
1020         ExpressionNode
* m_right
; 
1021         Operator m_operator 
: 30; 
1022         bool m_subscriptHasAssignments 
: 1; 
1023         bool m_rightHasAssignments 
: 1; 
1026     class AssignBracketNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
1028         AssignBracketNode(JSGlobalData
*, ExpressionNode
* base
, ExpressionNode
* subscript
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
1031         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1033         ExpressionNode
* m_base
; 
1034         ExpressionNode
* m_subscript
; 
1035         ExpressionNode
* m_right
; 
1036         bool m_subscriptHasAssignments 
: 1; 
1037         bool m_rightHasAssignments 
: 1; 
1040     class AssignDotNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
1042         AssignDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
1045         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1047         ExpressionNode
* m_base
; 
1048         const Identifier
& m_ident
; 
1049         ExpressionNode
* m_right
; 
1050         bool m_rightHasAssignments
; 
1053     class ReadModifyDotNode 
: public ExpressionNode
, public ThrowableSubExpressionData 
{ 
1055         ReadModifyDotNode(JSGlobalData
*, ExpressionNode
* base
, const Identifier
&, Operator
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
1058         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1060         ExpressionNode
* m_base
; 
1061         const Identifier
& m_ident
; 
1062         ExpressionNode
* m_right
; 
1063         Operator m_operator 
: 31; 
1064         bool m_rightHasAssignments 
: 1; 
1067     class AssignErrorNode 
: public ExpressionNode
, public ThrowableExpressionData 
{ 
1069         AssignErrorNode(JSGlobalData
*, ExpressionNode
* left
, Operator
, ExpressionNode
* right
, unsigned divot
, unsigned startOffset
, unsigned endOffset
); 
1072         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1074         ExpressionNode
* m_left
; 
1075         Operator m_operator
; 
1076         ExpressionNode
* m_right
; 
1079     typedef Vector
<ExpressionNode
*, 8> ExpressionVector
; 
1081     class CommaNode 
: public ExpressionNode
, public ParserArenaDeletable 
{ 
1083         CommaNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
); 
1085         using ParserArenaDeletable::operator new; 
1087         void append(ExpressionNode
* expr
) { m_expressions
.append(expr
); } 
1090         virtual bool isCommaNode() const { return true; } 
1091         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1093         ExpressionVector m_expressions
; 
1096     class ConstDeclNode 
: public ExpressionNode 
{ 
1098         ConstDeclNode(JSGlobalData
*, const Identifier
&, ExpressionNode
*); 
1100         bool hasInitializer() const { return m_init
; } 
1101         const Identifier
& ident() { return m_ident
; } 
1104         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1105         virtual RegisterID
* emitCodeSingle(BytecodeGenerator
&); 
1107         const Identifier
& m_ident
; 
1110         ConstDeclNode
* m_next
; 
1113         ExpressionNode
* m_init
; 
1116     class ConstStatementNode 
: public StatementNode 
{ 
1118         ConstStatementNode(JSGlobalData
*, ConstDeclNode
* next
); 
1121         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1123         ConstDeclNode
* m_next
; 
1126     class SourceElements 
: public ParserArenaDeletable 
{ 
1128         SourceElements(JSGlobalData
*); 
1130         void append(StatementNode
*); 
1132         StatementNode
* singleStatement() const; 
1133         StatementNode
* lastStatement() const; 
1135         void emitBytecode(BytecodeGenerator
&, RegisterID
* destination
); 
1138         Vector
<StatementNode
*> m_statements
; 
1141     class BlockNode 
: public StatementNode 
{ 
1143         BlockNode(JSGlobalData
*, SourceElements
* = 0); 
1145         StatementNode
* lastStatement() const; 
1148         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1150         virtual bool isBlock() const { return true; } 
1152         SourceElements
* m_statements
; 
1155     class EmptyStatementNode 
: public StatementNode 
{ 
1157         EmptyStatementNode(JSGlobalData
*); 
1160         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1162         virtual bool isEmptyStatement() const { return true; } 
1165     class DebuggerStatementNode 
: public StatementNode 
{ 
1167         DebuggerStatementNode(JSGlobalData
*); 
1170         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1173     class ExprStatementNode 
: public StatementNode 
{ 
1175         ExprStatementNode(JSGlobalData
*, ExpressionNode
*); 
1177         ExpressionNode
* expr() const { return m_expr
; } 
1180         virtual bool isExprStatement() const { return true; } 
1182         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1184         ExpressionNode
* m_expr
; 
1187     class VarStatementNode 
: public StatementNode 
{ 
1189         VarStatementNode(JSGlobalData
*, ExpressionNode
*);         
1192         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1194         ExpressionNode
* m_expr
; 
1197     class IfNode 
: public StatementNode 
{ 
1199         IfNode(JSGlobalData
*, ExpressionNode
* condition
, StatementNode
* ifBlock
); 
1202         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1204         ExpressionNode
* m_condition
; 
1205         StatementNode
* m_ifBlock
; 
1208     class IfElseNode 
: public IfNode 
{ 
1210         IfElseNode(JSGlobalData
*, ExpressionNode
* condition
, StatementNode
* ifBlock
, StatementNode
* elseBlock
); 
1213         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1215         StatementNode
* m_elseBlock
; 
1218     class DoWhileNode 
: public StatementNode 
{ 
1220         DoWhileNode(JSGlobalData
*, StatementNode
* statement
, ExpressionNode
*); 
1223         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1225         StatementNode
* m_statement
; 
1226         ExpressionNode
* m_expr
; 
1229     class WhileNode 
: public StatementNode 
{ 
1231         WhileNode(JSGlobalData
*, ExpressionNode
*, StatementNode
* statement
); 
1234         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1236         ExpressionNode
* m_expr
; 
1237         StatementNode
* m_statement
; 
1240     class ForNode 
: public StatementNode 
{ 
1242         ForNode(JSGlobalData
*, ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
, bool expr1WasVarDecl
); 
1245         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1247         ExpressionNode
* m_expr1
; 
1248         ExpressionNode
* m_expr2
; 
1249         ExpressionNode
* m_expr3
; 
1250         StatementNode
* m_statement
; 
1251         bool m_expr1WasVarDecl
; 
1254     class ForInNode 
: public StatementNode
, public ThrowableExpressionData 
{ 
1256         ForInNode(JSGlobalData
*, ExpressionNode
*, ExpressionNode
*, StatementNode
*); 
1257         ForInNode(JSGlobalData
*, const Identifier
&, ExpressionNode
*, ExpressionNode
*, StatementNode
*, int divot
, int startOffset
, int endOffset
); 
1260         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1262         const Identifier
& m_ident
; 
1263         ExpressionNode
* m_init
; 
1264         ExpressionNode
* m_lexpr
; 
1265         ExpressionNode
* m_expr
; 
1266         StatementNode
* m_statement
; 
1267         bool m_identIsVarDecl
; 
1270     class ContinueNode 
: public StatementNode
, public ThrowableExpressionData 
{ 
1272         ContinueNode(JSGlobalData
*); 
1273         ContinueNode(JSGlobalData
*, const Identifier
&); 
1276         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1278         const Identifier
& m_ident
; 
1281     class BreakNode 
: public StatementNode
, public ThrowableExpressionData 
{ 
1283         BreakNode(JSGlobalData
*); 
1284         BreakNode(JSGlobalData
*, const Identifier
&); 
1287         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1289         const Identifier
& m_ident
; 
1292     class ReturnNode 
: public StatementNode
, public ThrowableExpressionData 
{ 
1294         ReturnNode(JSGlobalData
*, ExpressionNode
* value
); 
1297         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1299         virtual bool isReturnNode() const { return true; } 
1301         ExpressionNode
* m_value
; 
1304     class WithNode 
: public StatementNode 
{ 
1306         WithNode(JSGlobalData
*, ExpressionNode
*, StatementNode
*, uint32_t divot
, uint32_t expressionLength
); 
1309         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1311         ExpressionNode
* m_expr
; 
1312         StatementNode
* m_statement
; 
1314         uint32_t m_expressionLength
; 
1317     class LabelNode 
: public StatementNode
, public ThrowableExpressionData 
{ 
1319         LabelNode(JSGlobalData
*, const Identifier
& name
, StatementNode
*); 
1322         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1324         const Identifier
& m_name
; 
1325         StatementNode
* m_statement
; 
1328     class ThrowNode 
: public StatementNode
, public ThrowableExpressionData 
{ 
1330         ThrowNode(JSGlobalData
*, ExpressionNode
*); 
1333         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1335         ExpressionNode
* m_expr
; 
1338     class TryNode 
: public StatementNode 
{ 
1340         TryNode(JSGlobalData
*, StatementNode
* tryBlock
, const Identifier
& exceptionIdent
, bool catchHasEval
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
); 
1343         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1345         StatementNode
* m_tryBlock
; 
1346         const Identifier
& m_exceptionIdent
; 
1347         StatementNode
* m_catchBlock
; 
1348         StatementNode
* m_finallyBlock
; 
1349         bool m_catchHasEval
; 
1352     class ParameterNode 
: public ParserArenaFreeable 
{ 
1354         ParameterNode(JSGlobalData
*, const Identifier
&); 
1355         ParameterNode(JSGlobalData
*, ParameterNode
*, const Identifier
&); 
1357         const Identifier
& ident() const { return m_ident
; } 
1358         ParameterNode
* nextParam() const { return m_next
; } 
1361         const Identifier
& m_ident
; 
1362         ParameterNode
* m_next
; 
1365     struct ScopeNodeData 
: FastAllocBase 
{ 
1366         typedef DeclarationStacks::VarStack VarStack
; 
1367         typedef DeclarationStacks::FunctionStack FunctionStack
; 
1369         ScopeNodeData(ParserArena
&, SourceElements
*, VarStack
*, FunctionStack
*, int numConstants
); 
1371         ParserArena m_arena
; 
1372         VarStack m_varStack
; 
1373         FunctionStack m_functionStack
; 
1375         SourceElements
* m_statements
; 
1378     class ScopeNode 
: public StatementNode
, public ParserArenaRefCounted 
{ 
1380         typedef DeclarationStacks::VarStack VarStack
; 
1381         typedef DeclarationStacks::FunctionStack FunctionStack
; 
1383         ScopeNode(JSGlobalData
*); 
1384         ScopeNode(JSGlobalData
*, const SourceCode
&, SourceElements
*, VarStack
*, FunctionStack
*, CodeFeatures
, int numConstants
); 
1386         using ParserArenaRefCounted::operator new; 
1388         void adoptData(std::auto_ptr
<ScopeNodeData
> data
) 
1390             ASSERT(!data
->m_arena
.contains(this)); 
1394         ScopeNodeData
* data() const { return m_data
.get(); } 
1395         void destroyData() { m_data
.clear(); } 
1397         const SourceCode
& source() const { return m_source
; } 
1398         const UString
& sourceURL() const { return m_source
.provider()->url(); } 
1399         intptr_t sourceID() const { return m_source
.provider()->asID(); } 
1401         void setFeatures(CodeFeatures features
) { m_features 
= features
; } 
1402         CodeFeatures 
features() { return m_features
; } 
1404         bool usesEval() const { return m_features 
& EvalFeature
; } 
1405         bool usesArguments() const { return m_features 
& ArgumentsFeature
; } 
1406         void setUsesArguments() { m_features 
|= ArgumentsFeature
; } 
1407         bool usesThis() const { return m_features 
& ThisFeature
; } 
1408         bool needsActivation() const { return m_features 
& (EvalFeature 
| ClosureFeature 
| WithFeature 
| CatchFeature
); } 
1410         VarStack
& varStack() { ASSERT(m_data
); return m_data
->m_varStack
; } 
1411         FunctionStack
& functionStack() { ASSERT(m_data
); return m_data
->m_functionStack
; } 
1413         int neededConstants() 
1416             // We may need 2 more constants than the count given by the parser, 
1417             // because of the various uses of jsUndefined() and jsNull(). 
1418             return m_data
->m_numConstants 
+ 2; 
1421         StatementNode
* singleStatement() const; 
1423         void emitStatementsBytecode(BytecodeGenerator
&, RegisterID
* destination
); 
1426         void setSource(const SourceCode
& source
) { m_source 
= source
; } 
1429         OwnPtr
<ScopeNodeData
> m_data
; 
1430         CodeFeatures m_features
; 
1431         SourceCode m_source
; 
1434     class ProgramNode 
: public ScopeNode 
{ 
1436         static PassRefPtr
<ProgramNode
> create(JSGlobalData
*, SourceElements
*, VarStack
*, FunctionStack
*, const SourceCode
&, CodeFeatures
, int numConstants
); 
1438         static const bool scopeIsFunction 
= false; 
1441         ProgramNode(JSGlobalData
*, SourceElements
*, VarStack
*, FunctionStack
*, const SourceCode
&, CodeFeatures
, int numConstants
); 
1443         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1446     class EvalNode 
: public ScopeNode 
{ 
1448         static PassRefPtr
<EvalNode
> create(JSGlobalData
*, SourceElements
*, VarStack
*, FunctionStack
*, const SourceCode
&, CodeFeatures
, int numConstants
); 
1450         static const bool scopeIsFunction 
= false; 
1453         EvalNode(JSGlobalData
*, SourceElements
*, VarStack
*, FunctionStack
*, const SourceCode
&, CodeFeatures
, int numConstants
); 
1455         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1458     class FunctionParameters 
: public Vector
<Identifier
>, public RefCounted
<FunctionParameters
> { 
1460         static PassRefPtr
<FunctionParameters
> create(ParameterNode
* firstParameter
) { return adoptRef(new FunctionParameters(firstParameter
)); } 
1463         FunctionParameters(ParameterNode
*); 
1466     class FunctionBodyNode 
: public ScopeNode 
{ 
1468         static FunctionBodyNode
* create(JSGlobalData
*); 
1469         static PassRefPtr
<FunctionBodyNode
> create(JSGlobalData
*, SourceElements
*, VarStack
*, FunctionStack
*, const SourceCode
&, CodeFeatures
, int numConstants
); 
1471         FunctionParameters
* parameters() const { return m_parameters
.get(); } 
1472         size_t parameterCount() const { return m_parameters
->size(); } 
1474         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1476         void finishParsing(const SourceCode
&, ParameterNode
*, const Identifier
&); 
1477         void finishParsing(PassRefPtr
<FunctionParameters
>, const Identifier
&); 
1479         const Identifier
& ident() { return m_ident
; } 
1481         static const bool scopeIsFunction 
= true; 
1484         FunctionBodyNode(JSGlobalData
*); 
1485         FunctionBodyNode(JSGlobalData
*, SourceElements
*, VarStack
*, FunctionStack
*, const SourceCode
&, CodeFeatures
, int numConstants
); 
1488         RefPtr
<FunctionParameters
> m_parameters
; 
1491     class FuncExprNode 
: public ExpressionNode 
{ 
1493         FuncExprNode(JSGlobalData
*, const Identifier
&, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter 
= 0); 
1495         FunctionBodyNode
* body() { return m_body
; } 
1498         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1500         virtual bool isFuncExprNode() const { return true; }  
1502         FunctionBodyNode
* m_body
; 
1505     class FuncDeclNode 
: public StatementNode 
{ 
1507         FuncDeclNode(JSGlobalData
*, const Identifier
&, FunctionBodyNode
*, const SourceCode
&, ParameterNode
* = 0); 
1509         FunctionBodyNode
* body() { return m_body
; } 
1512         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1514         FunctionBodyNode
* m_body
; 
1517     class CaseClauseNode 
: public ParserArenaFreeable 
{ 
1519         CaseClauseNode(JSGlobalData
*, ExpressionNode
*, SourceElements
* = 0); 
1521         ExpressionNode
* expr() const { return m_expr
; } 
1523         void emitBytecode(BytecodeGenerator
&, RegisterID
* destination
); 
1526         ExpressionNode
* m_expr
; 
1527         SourceElements
* m_statements
; 
1530     class ClauseListNode 
: public ParserArenaFreeable 
{ 
1532         ClauseListNode(JSGlobalData
*, CaseClauseNode
*); 
1533         ClauseListNode(JSGlobalData
*, ClauseListNode
*, CaseClauseNode
*); 
1535         CaseClauseNode
* getClause() const { return m_clause
; } 
1536         ClauseListNode
* getNext() const { return m_next
; } 
1539         CaseClauseNode
* m_clause
; 
1540         ClauseListNode
* m_next
; 
1543     class CaseBlockNode 
: public ParserArenaFreeable 
{ 
1545         CaseBlockNode(JSGlobalData
*, ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
); 
1547         RegisterID
* emitBytecodeForBlock(BytecodeGenerator
&, RegisterID
* input
, RegisterID
* destination
); 
1550         SwitchInfo::SwitchType 
tryOptimizedSwitch(Vector
<ExpressionNode
*, 8>& literalVector
, int32_t& min_num
, int32_t& max_num
); 
1551         ClauseListNode
* m_list1
; 
1552         CaseClauseNode
* m_defaultClause
; 
1553         ClauseListNode
* m_list2
; 
1556     class SwitchNode 
: public StatementNode 
{ 
1558         SwitchNode(JSGlobalData
*, ExpressionNode
*, CaseBlockNode
*); 
1561         virtual RegisterID
* emitBytecode(BytecodeGenerator
&, RegisterID
* = 0); 
1563         ExpressionNode
* m_expr
; 
1564         CaseBlockNode
* m_block
; 
1567     struct ElementList 
{ 
1572     struct PropertyList 
{ 
1573         PropertyListNode
* head
; 
1574         PropertyListNode
* tail
; 
1577     struct ArgumentList 
{ 
1578         ArgumentListNode
* head
; 
1579         ArgumentListNode
* tail
; 
1582     struct ConstDeclList 
{ 
1583         ConstDeclNode
* head
; 
1584         ConstDeclNode
* tail
; 
1587     struct ParameterList 
{ 
1588         ParameterNode
* head
; 
1589         ParameterNode
* tail
; 
1593         ClauseListNode
* head
; 
1594         ClauseListNode
* tail
;