Ignore:
Timestamp:
May 13, 2009, 11:14:48 AM (16 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2009-05-13 Darin Adler <Darin Adler>

Reviewed by Cameron Zwarich.

Bug 25674: syntax tree nodes should use arena allocation
https://bugs.webkit.org/show_bug.cgi?id=25674

Step 3: Add some actual arena allocation. About 1% SunSpider speedup.

  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack contains const Identifier* now. (JSC::BytecodeGenerator::emitPushNewScope): Updated to take a const Identifier&.
  • bytecompiler/BytecodeGenerator.h: Ditto
  • bytecompiler/SegmentedVector.h: Added isEmpty.
  • debugger/Debugger.cpp: (JSC::Debugger::recompileAllJSFunctions): Moved this function here from WebCore so WebCore doesn't need the details of FunctionBodyNode.
  • debugger/Debugger.h: Ditto.
  • interpreter/Interpreter.cpp: (JSC::Interpreter::execute): Updated since VarStack contains const Identifier* now.
  • jit/JITStubs.cpp: (JSC::JITStubs::cti_vm_lazyLinkCall): Call isHostFunction on the body rather than on the function object, since we can't easily have inlined access to the FunctionBodyNode in JSFunction.h since WebCore needs access to that header. (JSC::JITStubs::cti_op_construct_JSConstruct): Ditto.
  • profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier): Ditto.
  • parser/Grammar.y: Use JSGlobalData* to pass the global data pointer around whenever possible instead of using void*. Changed SET_EXCEPTION_LOCATION from a macro to an inline function. Marked the structure-creating functions inline. Changed the VarStack to use identifier pointers instead of actual identifiers. This takes advantage of the fact that all identifier pointers come from the arena and avoids referenc count churn. Changed Identifier* to const Identifier* to make sure we don't modify any by accident. Used identifiers for regular expression strings too, using the new scanRegExp that has out parameters instead of the old one that relied on side effects in the Lexer. Move the creation of numeric identifiers out of this file and into the PropertyNode constructor.
  • parser/Lexer.cpp: (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers. (JSC::Lexer::makeIdentifier): Changed return type to const Identifier* and changed to call ParserArena. (JSC::Lexer::scanRegExp): Added out arguments that are const Identifier* as well as a prefix character argument so we can handle the /= case without a string append. (JSC::Lexer::skipRegExp): Added. Skips a regular expression without allocating Identifier objects. (JSC::Lexer::clear): Removed the code to manage m_identifiers, m_pattern, and m_flags, and added code to set m_arena to 0.
  • parser/Lexer.h: Updated for changes above.
  • parser/NodeConstructors.h: (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable on the arena. (JSC::ParserArenaDeletable::operator new): Changed to call the allocateDeletable function on the arena instead of deleteWithArena. (JSC::RegExpNode::RegExpNode): Changed arguments to Identifier instead of UString since these come from the parser which makes identifiers. (JSC::PropertyNode::PropertyNode): Added new constructor that makes numeric identifiers. Some day we might want to optimize this for integers so it doesn't create a string for each one. (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier since it's now a const Identifier& so it can't be left uninitialized. (JSC::BreakNode::BreakNode): Ditto. (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements* to keep track of the statements rather than a separate statement vector. (JSC::BlockNode::BlockNode): Ditto. (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier.
  • parser/Nodes.cpp: Moved the comment explaining emitBytecode in here. It seemed strangely out of place in the header. (JSC::ThrowableExpressionData::emitThrowError): Added an overload for UString as well as Identifier. (JSC::SourceElements::singleStatement): Added. (JSC::SourceElements::lastStatement): Added. (JSC::RegExpNode::emitBytecode): Updated since the pattern and flags are now Identifier instead of UString. Also changed the throwError code to use the substitution mechanism instead of doing a string append. (JSC::SourceElements::emitBytecode): Added. Replaces the old statementListEmitCode function, since we now keep the SourceElements objects around. (JSC::BlockNode::lastStatement): Added. (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of statementListEmitCode. (JSC::CaseClauseNode::emitBytecode): Added. (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode instead of statementListEmitCode. (JSC::ScopeNodeData::ScopeNodeData): Changed to store the SourceElements* instead of using releaseContentsIntoVector. (JSC::ScopeNode::emitStatementsBytecode): Added. (JSC::ScopeNode::singleStatement): Added. (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead of statementListEmitCode. (JSC::EvalNode::emitBytecode): Ditto. (JSC::EvalNode::generateBytecode): Removed code to clear the children vector. This optimization is no longer possible since everything is in a single arena. (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode insetad of statementListEmitCode and check for the return node using the new functions.
  • parser/Nodes.h: Changed VarStack to store const Identifier* instead of Identifier and rely on the arena to control lifetime. Added a new ParserArenaFreeable class. Made ParserArenaDeletable inherit from FastAllocBase instead of having its own operator new. Base the Node class on ParserArenaFreeable. Changed the various Node classes to use const Identifier& instead of Identifier to avoid the need to call their destructors and allow them to function as "freeable" in the arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions. Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode, CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable as a base class since they do not descend from Node. Eliminated the StatementVector type and instead have various classes use SourceElements* instead of StatementVector. This prevents those classes from having th use ParserArenaDeletable to make sure the vector destructor is called.
  • parser/Parser.cpp: (JSC::Parser::parse): Pass the arena to the lexer.
  • parser/Parser.h: Added an include of ParserArena.h, which is no longer included by Nodes.h.
  • parser/ParserArena.cpp: (JSC::ParserArena::ParserArena): Added. Initializes the new members, m_freeableMemory, m_freeablePoolEnd, and m_identifiers. (JSC::ParserArena::freeablePool): Added. Computes the pool pointer, since we store only the current pointer and the end of pool pointer. (JSC::ParserArena::deallocateObjects): Added. Contains the common memory-deallocation logic used by both the destructor and the reset function. (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects. (JSC::ParserArena::reset): Ditto. Also added code to zero out the new structures, and switched to use clear() instead of shrink(0) since we don't really reuse arenas. (JSC::ParserArena::makeNumericIdentifier): Added. (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool is empty. (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine since this is used only for assertions at the moment.
  • parser/ParserArena.h: Added an actual arena of "freeable" objects, ones that don't need destructors to be called. Also added the segmented vector of identifiers that used to be in the Lexer.
  • runtime/FunctionConstructor.cpp: (JSC::extractFunctionBody): Use singleStatement function rather than getting at a StatementVector.
  • runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): Call isHostFunction on the body rather than the function object.
  • runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): Moved the structure version of this in here from the header. It's not hot enough that it needs to be inlined. (JSC::JSFunction::isHostFunction): Moved this in here from the header. It's now a helper to be used only within the class. (JSC::JSFunction::setBody): Moved this in here. It's not hot enough that it needs to be inlined, and we want to be able to compile the header without the definition of FunctionBodyNode.
  • runtime/JSFunction.h: Eliminated the include of "Nodes.h". This was exposing too much JavaScriptCore dependency to WebCore. Because of this change and some changes made to WebCore, we could now export a lot fewer headers from JavaScriptCore, but I have not done that yet in this check-in. Made a couple functions non-inline. Removes some isHostFunction() assertions.


  • wtf/FastAllocBase.h: Added the conventional using statements we use in WTF so we can use identifiers from the WTF namespace without explicit namespace qualification or namespace directive. This is the usual WTF style, although it's unconventional in the C++ world. We use the namespace primarily for link-time disambiguation, not compile-time.
  • wtf/FastMalloc.cpp: Fixed an incorrect comment.

WebCore:

2009-05-13 Darin Adler <Darin Adler>

Reviewed by Cameron Zwarich.

Bug 25674: syntax tree nodes should use arena allocation
https://bugs.webkit.org/show_bug.cgi?id=25674

  • bindings/js/JSDOMBinding.h: Removed include of JSFunction.h. We don't want the entire DOM binding to depend on that file.
  • bindings/js/JSAudioConstructor.cpp: Added include of Error.h. Before we inherited this automatically because JDDOMBinding.h included JSFunction.h, but that was excessive.
  • bindings/js/JSDOMWindowCustom.cpp: Ditto.
  • bindings/js/JSHTMLInputElementCustom.cpp: Ditto.
  • bindings/js/JSImageConstructor.cpp: Ditto.
  • bindings/js/JSLazyEventListener.cpp: Ditto, but for JSFunction.h.
  • bindings/js/JSMessageChannelConstructor.cpp: Ditto.
  • bindings/js/JSOptionConstructor.cpp: Ditto.
  • bindings/js/JSWorkerConstructor.cpp: Ditto.
  • bindings/js/JSXMLHttpRequestConstructor.cpp: Ditto.
  • bridge/jni/jni_jsobject.mm: Ditto, but for SourceCode.h.
  • inspector/InspectorController.cpp: Ditto.
  • inspector/JavaScriptDebugServer.cpp: (WebCore::JavaScriptDebugServer::recompileAllJSFunctions): Moved mose of this function into the base class in JavaScriptCore, so the details of compilation don't have to be exposed.

WebKit/mac:

2009-05-13 Darin Adler <Darin Adler>

Reviewed by Cameron Zwarich.

Bug 25674: syntax tree nodes should use arena allocation
https://bugs.webkit.org/show_bug.cgi?id=25674

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm: Updated includes. New ones needed due to reducing includes of JSDOMBinding.h.
  • WebView/WebScriptDebugger.mm: Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Grammar.y

    r43479 r43642  
    2626#include "config.h"
    2727
    28 #include <string.h>
    29 #include <stdlib.h>
     28#include "CommonIdentifiers.h"
     29#include "JSGlobalData.h"
     30#include "JSObject.h"
     31#include "JSString.h"
    3032#include "JSValue.h"
    31 #include "JSObject.h"
     33#include "Lexer.h"
    3234#include "NodeConstructors.h"
    33 #include "Lexer.h"
    34 #include "JSString.h"
    35 #include "JSGlobalData.h"
    36 #include "CommonIdentifiers.h"
    3735#include "NodeInfo.h"
    3836#include "Parser.h"
     37#include <stdlib.h>
     38#include <string.h>
    3939#include <wtf/MathExtras.h>
    4040
     
    5252int jscyylex(void* lvalp, void* llocp, void* globalPtr);
    5353int jscyyerror(const char*);
     54
    5455static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
    5556
     
    5859
    5960#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0)
    60 #define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot))
    6161#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line)
    6262
     
    6464using namespace std;
    6565
    66 static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
    67 static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
    68 static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
    69 static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
    70 static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
    71 static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
    72 static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
    73 static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
    74 static NumberNode* makeNumberNode(void*, double);
    75 static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*);
    76 static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
    77 static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
    78 static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
    79 static ExpressionNode* makeSubNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
    80 static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
    81 static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
    82 static StatementNode* makeVarStatementNode(void*, ExpressionNode*);
    83 static ExpressionNode* combineVarInitializers(void*, ExpressionNode* list, AssignResolveNode* init);
     66static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
     67static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode* expr, Operator, int start, int divot, int end);
     68static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode* expr, Operator, int start, int divot, int end);
     69static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
     70static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
     71static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*);
     72static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end);
     73static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*);
     74static NumberNode* makeNumberNode(JSGlobalData*, double);
     75static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*);
     76static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
     77static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
     78static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
     79static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
     80static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
     81static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
     82static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*);
     83static ExpressionNode* combineVarInitializers(JSGlobalData*, ExpressionNode* list, AssignResolveNode* init);
     84
     85// FIXME: This used to be a macro and is still named like one. It should be renamed.
     86static inline void SET_EXCEPTION_LOCATION(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
     87{
     88    node->setExceptionSourceCode(divot, divot - start, end - divot);
     89}
    8490
    8591#if COMPILER(MSVC)
     
    100106#define YYLEX_PARAM globalPtr
    101107
    102 template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserArenaData<DeclarationStacks::VarStack>* varDecls,
    103                                                                        ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
    104                                                                        CodeFeatures info,
    105                                                                       int numConstants)
     108template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
     109    ParserArenaData<DeclarationStacks::VarStack>* varDecls,
     110    ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
     111    CodeFeatures info, int numConstants)
    106112{
    107113    ASSERT((info & ~AllFeatures) == 0);
     
    110116}
    111117
    112 template <typename T> NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
     118template <typename T> NodeInfo<T> inline createNodeInfo(T node, CodeFeatures info, int numConstants)
    113119{
    114120    ASSERT((info & ~AllFeatures) == 0);
     
    136142}
    137143
    138 static void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
     144static void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
    139145{
    140146    if (!varDecls)
    141         varDecls = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    142 
    143     varDecls->data.append(make_pair(ident, attrs));
    144 
    145 }
    146 
    147 static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
     147        varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
     148
     149    varDecls->data.append(make_pair(&ident, attrs));
     150}
     151
     152static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
    148153{
    149154    unsigned attrs = DeclarationStacks::IsConstant;
    150155    if (decl->hasInitializer())
    151156        attrs |= DeclarationStacks::HasInitializer;       
    152     appendToVarDeclarationList(globalPtr, varDecls, decl->ident(), attrs);
     157    appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
    153158}
    154159
     
    158163    int                 intValue;
    159164    double              doubleValue;
    160     Identifier*         ident;
     165    const Identifier*   ident;
    161166
    162167    // expression subtrees
     
    294299  | STRING                              { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); }
    295300  | '/' /* regexp */                    {
    296                                             Lexer& l = *LEXER;
    297                                             if (!l.scanRegExp())
     301                                            const Identifier* pattern;
     302                                            const Identifier* flags;
     303                                            if (!LEXER->scanRegExp(pattern, flags))
    298304                                                YYABORT;
    299                                             RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
    300                                             int size = l.pattern().size() + 2; // + 2 for the two /'s
     305                                            RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
     306                                            int size = pattern->size() + 2; // + 2 for the two /'s
    301307                                            SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
    302308                                            $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
    303309                                        }
    304310  | DIVEQUAL /* regexp with /= */       {
    305                                             Lexer& l = *LEXER;
    306                                             if (!l.scanRegExp())
     311                                            const Identifier* pattern;
     312                                            const Identifier* flags;
     313                                            if (!LEXER->scanRegExp(pattern, flags, '='))
    307314                                                YYABORT;
    308                                             RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags());
    309                                             int size = l.pattern().size() + 2; // + 2 for the two /'s
     315                                            RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
     316                                            int size = pattern->size() + 2; // + 2 for the two /'s
    310317                                            SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
    311318                                            $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
     
    316323    IDENT ':' AssignmentExpr            { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
    317324  | STRING ':' AssignmentExpr           { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
    318   | NUMBER ':' AssignmentExpr           { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
    319   | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE    { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
     325  | NUMBER ':' AssignmentExpr           { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
     326  | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE    { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
    320327  | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
    321328                                                             {
    322                                                                  $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
     329                                                                 $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, LEXER->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
    323330                                                                 if ($4.m_features & ArgumentsFeature)
    324331                                                                     $7->setUsesArguments();
     
    434441
    435442CallExpr:
    436     MemberExpr Arguments                { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
    437   | CallExpr Arguments                  { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
     443    MemberExpr Arguments                { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
     444  | CallExpr Arguments                  { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
    438445  | CallExpr '[' Expr ']'               { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
    439446                                          SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
     
    446453
    447454CallExprNoBF:
    448     MemberExprNoBF Arguments            { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
    449   | CallExprNoBF Arguments              { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
     455    MemberExprNoBF Arguments            { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
     456  | CallExprNoBF Arguments              { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
    450457  | CallExprNoBF '[' Expr ']'           { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
    451458                                          SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
     
    813820
    814821Block:
    815     OPENBRACE CLOSEBRACE                             { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
     822    OPENBRACE CLOSEBRACE                { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
    816823                                          DBG($$.m_node, @1, @2); }
    817   | OPENBRACE SourceElements CLOSEBRACE              { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
     824  | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
    818825                                          DBG($$.m_node, @1, @3); }
    819826;
     
    12421249  | TRUETOKEN
    12431250  | FALSETOKEN
    1244   | NUMBER { }
    1245   | STRING { }
    1246   | '/' /* regexp */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
    1247   | DIVEQUAL /* regexp with /= */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
     1251  | NUMBER
     1252  | STRING
     1253  | '/' /* regexp */ { if (!LEXER->skipRegExp()) YYABORT; }
     1254  | DIVEQUAL /* regexp with /= */ { if (!LEXER->skipRegExp()) YYABORT; }
    12481255;
    12491256
    12501257Property_NoNode:
    1251     IDENT ':' AssignmentExpr_NoNode { }
    1252   | STRING ':' AssignmentExpr_NoNode { }
    1253   | NUMBER ':' AssignmentExpr_NoNode { }
     1258    IDENT ':' AssignmentExpr_NoNode
     1259  | STRING ':' AssignmentExpr_NoNode
     1260  | NUMBER ':' AssignmentExpr_NoNode
    12541261  | IDENT IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
    12551262  | IDENT IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
     
    12631270PrimaryExpr_NoNode:
    12641271    PrimaryExprNoBrace_NoNode
    1265   | OPENBRACE CLOSEBRACE { }
    1266   | OPENBRACE PropertyList_NoNode CLOSEBRACE { }
     1272  | OPENBRACE CLOSEBRACE
     1273  | OPENBRACE PropertyList_NoNode CLOSEBRACE
    12671274  /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
    1268   | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE { }
     1275  | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE
    12691276;
    12701277
     
    12731280  | Literal_NoNode
    12741281  | ArrayLiteral_NoNode
    1275   | IDENT { }
     1282  | IDENT
    12761283  | '(' Expr_NoNode ')'
    12771284;
     
    16411648
    16421649Block_NoNode:
    1643     OPENBRACE CLOSEBRACE { }
    1644   | OPENBRACE SourceElements_NoNode CLOSEBRACE { }
     1650    OPENBRACE CLOSEBRACE
     1651  | OPENBRACE SourceElements_NoNode CLOSEBRACE
    16451652;
    16461653
     
    16511658
    16521659VariableDeclarationList_NoNode:
    1653     IDENT { }
    1654   | IDENT Initializer_NoNode { }
     1660    IDENT
     1661  | IDENT Initializer_NoNode
    16551662  | VariableDeclarationList_NoNode ',' IDENT
    16561663  | VariableDeclarationList_NoNode ',' IDENT Initializer_NoNode
     
    16581665
    16591666VariableDeclarationListNoIn_NoNode:
    1660     IDENT { }
    1661   | IDENT InitializerNoIn_NoNode { }
     1667    IDENT
     1668  | IDENT InitializerNoIn_NoNode
    16621669  | VariableDeclarationListNoIn_NoNode ',' IDENT
    16631670  | VariableDeclarationListNoIn_NoNode ',' IDENT InitializerNoIn_NoNode
     
    16751682
    16761683ConstDeclaration_NoNode:
    1677     IDENT { }
    1678   | IDENT Initializer_NoNode { }
     1684    IDENT
     1685  | IDENT Initializer_NoNode
    16791686;
    16801687
     
    17521759
    17531760CaseBlock_NoNode:
    1754     OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE { }
    1755   | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE { }
     1761    OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE
     1762  | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE
    17561763;
    17571764
     
    17771784
    17781785LabelledStatement_NoNode:
    1779     IDENT ':' Statement_NoNode { }
     1786    IDENT ':' Statement_NoNode
    17801787;
    17811788
     
    18091816
    18101817FormalParameterList_NoNode:
    1811     IDENT { }
     1818    IDENT
    18121819  | FormalParameterList_NoNode ',' IDENT
    18131820;
     
    18271834%%
    18281835
    1829 static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
     1836#undef GLOBAL_DATA
     1837
     1838static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
    18301839{
    18311840    if (!loc->isLocation())
    1832         return new (GLOBAL_DATA) AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
     1841        return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
    18331842
    18341843    if (loc->isResolveNode()) {
    18351844        ResolveNode* resolve = static_cast<ResolveNode*>(loc);
    18361845        if (op == OpEqual) {
    1837             AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments);
     1846            AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
    18381847            SET_EXCEPTION_LOCATION(node, start, divot, end);
    18391848            return node;
    18401849        } else
    1841             return new (GLOBAL_DATA) ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
     1850            return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
    18421851    }
    18431852    if (loc->isBracketAccessorNode()) {
    18441853        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
    18451854        if (op == OpEqual)
    1846             return new (GLOBAL_DATA) AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
     1855            return new (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
    18471856        else {
    1848             ReadModifyBracketNode* node = new (GLOBAL_DATA) ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
     1857            ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
    18491858            node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
    18501859            return node;
     
    18541863    DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
    18551864    if (op == OpEqual)
    1856         return new (GLOBAL_DATA) AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
    1857 
    1858     ReadModifyDotNode* node = new (GLOBAL_DATA) ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
     1865        return new (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
     1866
     1867    ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
    18591868    node->setSubexpressionInfo(dot->divot(), dot->endOffset());
    18601869    return node;
    18611870}
    18621871
    1863 static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
     1872static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
    18641873{
    18651874    if (!expr->isLocation())
    1866         return new (GLOBAL_DATA) PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
     1875        return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
    18671876   
    18681877    if (expr->isResolveNode()) {
    18691878        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
    1870         return new (GLOBAL_DATA) PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
     1879        return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
    18711880    }
    18721881    if (expr->isBracketAccessorNode()) {
    18731882        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
    1874         PrefixBracketNode* node = new (GLOBAL_DATA) PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
     1883        PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
    18751884        node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
    18761885        return node;
     
    18781887    ASSERT(expr->isDotAccessorNode());
    18791888    DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
    1880     PrefixDotNode* node = new (GLOBAL_DATA) PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
     1889    PrefixDotNode* node = new (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
    18811890    node->setSubexpressionInfo(dot->divot(), dot->startOffset());
    18821891    return node;
    18831892}
    18841893
    1885 static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
     1894static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
    18861895{
    18871896    if (!expr->isLocation())
    1888         return new (GLOBAL_DATA) PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
     1897        return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
    18891898   
    18901899    if (expr->isResolveNode()) {
    18911900        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
    1892         return new (GLOBAL_DATA) PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
     1901        return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
    18931902    }
    18941903    if (expr->isBracketAccessorNode()) {
    18951904        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
    1896         PostfixBracketNode* node = new (GLOBAL_DATA) PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
     1905        PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
    18971906        node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
    18981907        return node;
     
    19011910    ASSERT(expr->isDotAccessorNode());
    19021911    DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
    1903     PostfixDotNode* node = new (GLOBAL_DATA) PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
     1912    PostfixDotNode* node = new (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
    19041913    node->setSubexpressionInfo(dot->divot(), dot->endOffset());
    19051914    return node;
    19061915}
    19071916
    1908 static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
     1917static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
    19091918{
    19101919    CodeFeatures features = func.m_features | args.m_features;
    19111920    int numConstants = func.m_numConstants + args.m_numConstants;
    19121921    if (!func.m_node->isLocation())
    1913         return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
     1922        return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
    19141923    if (func.m_node->isResolveNode()) {
    19151924        ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
    19161925        const Identifier& identifier = resolve->identifier();
    1917         if (identifier == GLOBAL_DATA->propertyNames->eval)
    1918             return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
    1919         return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
     1926        if (identifier == globalData->propertyNames->eval)
     1927            return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
     1928        return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
    19201929    }
    19211930    if (func.m_node->isBracketAccessorNode()) {
    19221931        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
    1923         FunctionCallBracketNode* node = new (GLOBAL_DATA) FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
     1932        FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
    19241933        node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
    19251934        return createNodeInfo<ExpressionNode*>(node, features, numConstants);
     
    19281937    DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
    19291938    FunctionCallDotNode* node;
    1930     if (dot->identifier() == GLOBAL_DATA->propertyNames->call)
    1931         node = new (GLOBAL_DATA) CallFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
    1932     else if (dot->identifier() == GLOBAL_DATA->propertyNames->apply)
    1933         node = new (GLOBAL_DATA) ApplyFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
     1939    if (dot->identifier() == globalData->propertyNames->call)
     1940        node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
     1941    else if (dot->identifier() == globalData->propertyNames->apply)
     1942        node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
    19341943    else
    1935         node = new (GLOBAL_DATA) FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
     1944        node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
    19361945    node->setSubexpressionInfo(dot->divot(), dot->endOffset());
    19371946    return createNodeInfo<ExpressionNode*>(node, features, numConstants);
    19381947}
    19391948
    1940 static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
     1949static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr)
    19411950{
    19421951    if (expr->isResolveNode()) {
    19431952        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
    1944         return new (GLOBAL_DATA) TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
     1953        return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
    19451954    }
    1946     return new (GLOBAL_DATA) TypeOfValueNode(GLOBAL_DATA, expr);
    1947 }
    1948 
    1949 static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
     1955    return new (globalData) TypeOfValueNode(globalData, expr);
     1956}
     1957
     1958static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
    19501959{
    19511960    if (!expr->isLocation())
    1952         return new (GLOBAL_DATA) DeleteValueNode(GLOBAL_DATA, expr);
     1961        return new (globalData) DeleteValueNode(globalData, expr);
    19531962    if (expr->isResolveNode()) {
    19541963        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
    1955         return new (GLOBAL_DATA) DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot);
     1964        return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
    19561965    }
    19571966    if (expr->isBracketAccessorNode()) {
    19581967        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
    1959         return new (GLOBAL_DATA) DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
     1968        return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
    19601969    }
    19611970    ASSERT(expr->isDotAccessorNode());
    19621971    DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
    1963     return new (GLOBAL_DATA) DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot);
    1964 }
    1965 
    1966 static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
     1972    return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
     1973}
     1974
     1975static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
    19671976{
    19681977    PropertyNode::Type type;
     
    19731982    else
    19741983        return 0;
    1975     return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
    1976 }
    1977 
    1978 static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
     1984    return new (globalData) PropertyNode(globalData, name, new FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
     1985}
     1986
     1987static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
    19791988{
    19801989    if (n->isNumber()) {
     
    19871996    }
    19881997
    1989     return new (GLOBAL_DATA) NegateNode(GLOBAL_DATA, n);
    1990 }
    1991 
    1992 static NumberNode* makeNumberNode(void* globalPtr, double d)
    1993 {
    1994     return new (GLOBAL_DATA) NumberNode(GLOBAL_DATA, d);
    1995 }
    1996 
    1997 static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
     1998    return new (globalData) NegateNode(globalData, n);
     1999}
     2000
     2001static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
     2002{
     2003    return new (globalData) NumberNode(globalData, d);
     2004}
     2005
     2006static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
    19982007{
    19992008    if (expr->isNumber())
    2000         return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value()));
    2001     return new (GLOBAL_DATA) BitwiseNotNode(GLOBAL_DATA, expr);
    2002 }
    2003 
    2004 static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
     2009        return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
     2010    return new (globalData) BitwiseNotNode(globalData, expr);
     2011}
     2012
     2013static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
    20052014{
    20062015    expr1 = expr1->stripUnaryPlus();
     
    20082017
    20092018    if (expr1->isNumber() && expr2->isNumber())
    2010         return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
     2019        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
    20112020
    20122021    if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
    2013         return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr2);
     2022        return new (globalData) UnaryPlusNode(globalData, expr2);
    20142023
    20152024    if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
    2016         return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr1);
    2017 
    2018     return new (GLOBAL_DATA) MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
    2019 }
    2020 
    2021 static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
     2025        return new (globalData) UnaryPlusNode(globalData, expr1);
     2026
     2027    return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
     2028}
     2029
     2030static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
    20222031{
    20232032    expr1 = expr1->stripUnaryPlus();
     
    20252034
    20262035    if (expr1->isNumber() && expr2->isNumber())
    2027         return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
    2028     return new (GLOBAL_DATA) DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
    2029 }
    2030 
    2031 static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
     2036        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
     2037    return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
     2038}
     2039
     2040static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
    20322041{
    20332042    if (expr1->isNumber() && expr2->isNumber())
    2034         return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
    2035     return new (GLOBAL_DATA) AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
    2036 }
    2037 
    2038 static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
     2043        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
     2044    return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
     2045}
     2046
     2047static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
    20392048{
    20402049    expr1 = expr1->stripUnaryPlus();
     
    20422051
    20432052    if (expr1->isNumber() && expr2->isNumber())
    2044         return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
    2045     return new (GLOBAL_DATA) SubNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
    2046 }
    2047 
    2048 static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
     2053        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
     2054    return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
     2055}
     2056
     2057static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
    20492058{
    20502059    if (expr1->isNumber() && expr2->isNumber())
    2051         return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
    2052     return new (GLOBAL_DATA) LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
    2053 }
    2054 
    2055 static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
     2060        return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
     2061    return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
     2062}
     2063
     2064static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
    20562065{
    20572066    if (expr1->isNumber() && expr2->isNumber())
    2058         return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
    2059     return new (GLOBAL_DATA) RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
    2060 }
    2061 
    2062 /* called by yyparse on error */
    2063 int yyerror(const char *)
     2067        return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
     2068    return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
     2069}
     2070
     2071// Called by yyparse on error.
     2072int yyerror(const char*)
    20642073{
    20652074    return 1;
    20662075}
    20672076
    2068 /* may we automatically insert a semicolon ? */
     2077// May we automatically insert a semicolon?
    20692078static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
    20702079{
     
    20722081}
    20732082
    2074 static ExpressionNode* combineVarInitializers(void* globalPtr, ExpressionNode* list, AssignResolveNode* init)
     2083static ExpressionNode* combineVarInitializers(JSGlobalData* globalData, ExpressionNode* list, AssignResolveNode* init)
    20752084{
    20762085    if (!list)
    20772086        return init;
    2078     return new (GLOBAL_DATA) CommaNode(GLOBAL_DATA, list, init);
     2087    return new (globalData) CommaNode(globalData, list, init);
    20792088}
    20802089
     
    20822091// statements (which later get stripped out), because the actual
    20832092// declaration work is hoisted up to the start of the function body
    2084 static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr)
     2093static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
    20852094{
    20862095    if (!expr)
    2087         return new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA);
    2088     return new (GLOBAL_DATA) VarStatementNode(GLOBAL_DATA, expr);
    2089 }
    2090 
    2091 #undef GLOBAL_DATA
     2096        return new (globalData) EmptyStatementNode(globalData);
     2097    return new (globalData) VarStatementNode(globalData, expr);
     2098}
Note: See TracChangeset for help on using the changeset viewer.