Changeset 43479 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
May 10, 2009, 9:30:14 PM (16 years ago)
Author:
Darin Adler
Message:

2009-05-10 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

Part two: Remove reference counting from most nodes.

  • JavaScriptCore.xcodeproj/project.pbxproj: Added ParserArena.h and .cpp.
  • parser/Grammar.y: Replaced uses of ParserRefCountedData with uses of ParserArenaData. Took out now-nonfunctional code that tries to manually release declaration list. Changed the new calls that create FuncDeclNode and FuncExprNode so that they use the proper version of operator new for the reference-counted idiom, not the deletion idiom.
  • parser/NodeConstructors.h: (JSC::ParserArenaDeletable::operator new): Added. (JSC::ParserArenaRefCounted::ParserArenaRefCounted): Added. (JSC::Node::Node): Removed ParserRefCounted initializer. (JSC::ElementNode::ElementNode): Ditto. (JSC::PropertyNode::PropertyNode): Ditto. (JSC::ArgumentsNode::ArgumentsNode): Ditto. (JSC::SourceElements::SourceElements): Ditto. (JSC::ParameterNode::ParameterNode): Ditto. (JSC::FuncExprNode::FuncExprNode): Added ParserArenaRefCounted initializer. (JSC::FuncDeclNode::FuncDeclNode): Ditto. (JSC::CaseClauseNode::CaseClauseNode): Removed ParserRefCounted initializer. (JSC::ClauseListNode::ClauseListNode): Ditto. (JSC::CaseBlockNode::CaseBlockNode): Ditto.
  • parser/NodeInfo.h: Replaced uses of ParserRefCountedData with uses of ParserArenaData.
  • parser/Nodes.cpp: (JSC::ScopeNode::ScopeNode): Added ParserArenaRefCounted initializer. (JSC::ProgramNode::create): Use the proper version of operator new for the reference-counted idiom, not the deletion idiom. Use the arena contains function instead of the vecctor find function. (JSC::EvalNode::create): Use the proper version of operator new for the reference-counted idiom, not the deletion idiom. Use the arena reset function instead of the vector shrink function. (JSC::FunctionBodyNode::createNativeThunk): Use the proper version of operator new for the reference-counted idiom, not the deletion idiom. (JSC::FunctionBodyNode::create): More of the same.
  • parser/Nodes.h: Added ParserArenaDeletable and ParserArenaRefCounted to replace ParserRefCounted. Fixed inheritance so only the classes that need reference counting inherit from ParserArenaRefCounted.
  • parser/Parser.cpp: (JSC::Parser::parse): Set m_sourceElements to 0 since it now starts uninitialized. Just set it to 0 again in the failure case, since it's now just a raw pointer, not an owning one. (JSC::Parser::reparseInPlace): Removed now-unneeded get() function. (JSC::Parser::didFinishParsing): Replaced uses of ParserRefCountedData with uses of ParserArenaData.
  • parser/Parser.h: Less RefPtr, more arena.
  • parser/ParserArena.cpp: Added.
  • parser/ParserArena.h: Added.
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::~JSGlobalData): Removed arena-related code, since it's now in the Parser. (JSC::JSGlobalData::createLeaked): Removed unneeded #ifndef. (JSC::JSGlobalData::createNativeThunk): Tweaked #if a bit.
  • runtime/JSGlobalData.h: Removed parserArena, which is now in Parser.
  • wtf/RefCounted.h: Added deletionHasBegun function, for use in assertions to catch deletion not done by the deref function.
Location:
trunk/JavaScriptCore
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r43478 r43479  
     12009-05-10  Darin Adler  <[email protected]>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        Bug 25674: syntax tree nodes should use arena allocation
     6        https://bugs.webkit.org/show_bug.cgi?id=25674
     7
     8        Part two: Remove reference counting from most nodes.
     9
     10        * JavaScriptCore.exp: Updated.
     11
     12        * JavaScriptCore.xcodeproj/project.pbxproj: Added ParserArena.h and .cpp.
     13
     14        * parser/Grammar.y: Replaced uses of ParserRefCountedData with uses of
     15        ParserArenaData. Took out now-nonfunctional code that tries to manually
     16        release declaration list. Changed the new calls that create FuncDeclNode
     17        and FuncExprNode so that they use the proper version of operator new for
     18        the reference-counted idiom, not the deletion idiom.
     19
     20        * parser/NodeConstructors.h:
     21        (JSC::ParserArenaDeletable::operator new): Added.
     22        (JSC::ParserArenaRefCounted::ParserArenaRefCounted): Added.
     23        (JSC::Node::Node): Removed ParserRefCounted initializer.
     24        (JSC::ElementNode::ElementNode): Ditto.
     25        (JSC::PropertyNode::PropertyNode): Ditto.
     26        (JSC::ArgumentsNode::ArgumentsNode): Ditto.
     27        (JSC::SourceElements::SourceElements): Ditto.
     28        (JSC::ParameterNode::ParameterNode): Ditto.
     29        (JSC::FuncExprNode::FuncExprNode): Added ParserArenaRefCounted initializer.
     30        (JSC::FuncDeclNode::FuncDeclNode): Ditto.
     31        (JSC::CaseClauseNode::CaseClauseNode): Removed ParserRefCounted initializer.
     32        (JSC::ClauseListNode::ClauseListNode): Ditto.
     33        (JSC::CaseBlockNode::CaseBlockNode): Ditto.
     34
     35        * parser/NodeInfo.h: Replaced uses of ParserRefCountedData with uses of
     36        ParserArenaData.
     37
     38        * parser/Nodes.cpp:
     39        (JSC::ScopeNode::ScopeNode): Added ParserArenaRefCounted initializer.
     40        (JSC::ProgramNode::create): Use the proper version of operator new for
     41        the reference-counted idiom, not the deletion idiom. Use the arena
     42        contains function instead of the vecctor find function.
     43        (JSC::EvalNode::create): Use the proper version of operator new for
     44        the reference-counted idiom, not the deletion idiom. Use the arena
     45        reset function instead of the vector shrink function.
     46        (JSC::FunctionBodyNode::createNativeThunk): Use the proper version
     47        of operator new for the reference-counted idiom, not the deletion idiom.
     48        (JSC::FunctionBodyNode::create): More of the same.
     49
     50        * parser/Nodes.h: Added ParserArenaDeletable and ParserArenaRefCounted
     51        to replace ParserRefCounted. Fixed inheritance so only the classes that
     52        need reference counting inherit from ParserArenaRefCounted.
     53
     54        * parser/Parser.cpp:
     55        (JSC::Parser::parse): Set m_sourceElements to 0 since it now starts
     56        uninitialized. Just set it to 0 again in the failure case, since it's
     57        now just a raw pointer, not an owning one.
     58        (JSC::Parser::reparseInPlace): Removed now-unneeded get() function.
     59        (JSC::Parser::didFinishParsing): Replaced uses of ParserRefCountedData
     60        with uses of ParserArenaData.
     61
     62        * parser/Parser.h: Less RefPtr, more arena.
     63
     64        * parser/ParserArena.cpp: Added.
     65        * parser/ParserArena.h: Added.
     66
     67        * runtime/JSGlobalData.cpp:
     68        (JSC::JSGlobalData::~JSGlobalData): Removed arena-related code, since it's
     69        now in the Parser.
     70        (JSC::JSGlobalData::createLeaked): Removed unneeded #ifndef.
     71        (JSC::JSGlobalData::createNativeThunk): Tweaked #if a bit.
     72
     73        * runtime/JSGlobalData.h: Removed parserArena, which is now in Parser.
     74
     75        * wtf/RefCounted.h: Added deletionHasBegun function, for use in
     76        assertions to catch deletion not done by the deref function.
     77
    1782009-05-10  David Kilzer  <[email protected]>
    279
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r43471 r43479  
    108108__ZN3JSC11JSImmediate8toStringENS_7JSValueE
    109109__ZN3JSC11JSImmediate9prototypeENS_7JSValueEPNS_9ExecStateE
     110__ZN3JSC11ParserArena5resetEv
    110111__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
    111112__ZN3JSC12DateInstance4infoE
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r43424 r43479  
    137137                905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */; };
    138138                90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
     139                93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93052C320FB792190048FDC3 /* ParserArena.cpp */; };
     140                93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
    139141                930754C108B0F68000AB3056 /* pcre_compile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754BF08B0F68000AB3056 /* pcre_compile.cpp */; };
    140142                930754D008B0F74600AB3056 /* pcre_tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754CE08B0F74500AB3056 /* pcre_tables.cpp */; };
     
    632634                9303F5690991190000AD71B8 /* Noncopyable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Noncopyable.h; sourceTree = "<group>"; };
    633635                9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnArrayPtr.h; sourceTree = "<group>"; };
     636                93052C320FB792190048FDC3 /* ParserArena.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParserArena.cpp; sourceTree = "<group>"; };
     637                93052C330FB792190048FDC3 /* ParserArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParserArena.h; sourceTree = "<group>"; };
    634638                930754BF08B0F68000AB3056 /* pcre_compile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_compile.cpp; sourceTree = "<group>"; tabWidth = 8; };
    635639                930754CE08B0F74500AB3056 /* pcre_tables.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_tables.cpp; sourceTree = "<group>"; tabWidth = 8; };
     
    12571261                                93F0B3A909BB4DC00068FCE3 /* Parser.cpp */,
    12581262                                93F0B3AA09BB4DC00068FCE3 /* Parser.h */,
     1263                                93052C320FB792190048FDC3 /* ParserArena.cpp */,
     1264                                93052C330FB792190048FDC3 /* ParserArena.h */,
    12591265                                869EBCB60E8C6D4A008722CC /* ResultType.h */,
    12601266                                65E866EE0DD59AFA00A2B2A1 /* SourceCode.h */,
     
    18041810                                A76EE6590FAE59D5003F069A /* NativeFunctionWrapper.h in Headers */,
    18051811                                A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */,
     1812                                93052C350FB792190048FDC3 /* ParserArena.h in Headers */,
    18061813                        );
    18071814                        runOnlyForDeploymentPostprocessing = 0;
     
    21622169                                86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */,
    21632170                                A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */,
     2171                                93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */,
    21642172                        );
    21652173                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/JavaScriptCore/parser/Grammar.y

    r43471 r43479  
    100100#define YYLEX_PARAM globalPtr
    101101
    102 template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserRefCountedData<DeclarationStacks::VarStack>* varDecls,
    103                                                                        ParserRefCountedData<DeclarationStacks::FunctionStack>* funcDecls,
     102template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserArenaData<DeclarationStacks::VarStack>* varDecls,
     103                                                                       ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
    104104                                                                       CodeFeatures info,
    105105                                                                       int numConstants)
    106106{
    107107    ASSERT((info & ~AllFeatures) == 0);
    108     NodeDeclarationInfo<T> result = {node, varDecls, funcDecls, info, numConstants};
     108    NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
    109109    return result;
    110110}
     
    113113{
    114114    ASSERT((info & ~AllFeatures) == 0);
    115     NodeInfo<T> result = {node, info, numConstants};
     115    NodeInfo<T> result = { node, info, numConstants };
    116116    return result;
    117117}
    118118
    119 template <typename T> T mergeDeclarationLists(T decls1, T decls2)
     119template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
    120120{
    121121    // decls1 or both are null
     
    129129    decls1->data.append(decls2->data);
    130130   
    131     // We manually release the declaration lists to avoid accumulating many many
    132     // unused heap allocated vectors
    133     decls2->ref();
    134     decls2->deref();
     131    // Manually release as much as possible from the now-defunct declaration lists
     132    // to avoid accumulating so many unused heap allocated vectors.
     133    decls2->data.clear();
     134
    135135    return decls1;
    136136}
    137137
    138 static void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
     138static void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
    139139{
    140140    if (!varDecls)
    141         varDecls = new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
     141        varDecls = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    142142
    143143    varDecls->data.append(make_pair(ident, attrs));
     
    145145}
    146146
    147 static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
     147static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
    148148{
    149149    unsigned attrs = DeclarationStacks::IsConstant;
     
    265265%type <statementNode>   FunctionDeclaration
    266266%type <funcExprNode>    FunctionExpr
    267 %type <functionBodyNode>  FunctionBody
     267%type <functionBodyNode> FunctionBody
    268268%type <sourceElements>  SourceElements
    269269%type <parameterList>   FormalParameterList
     
    829829VariableDeclarationList:
    830830    IDENT                               { $$.m_node = 0;
    831                                           $$.m_varDeclarations = new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
     831                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    832832                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
    833833                                          $$.m_funcDeclarations = 0;
     
    838838                                          SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
    839839                                          $$.m_node = node;
    840                                           $$.m_varDeclarations = new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
     840                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    841841                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
    842842                                          $$.m_funcDeclarations = 0;
     
    866866VariableDeclarationListNoIn:
    867867    IDENT                               { $$.m_node = 0;
    868                                           $$.m_varDeclarations = new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
     868                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    869869                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
    870870                                          $$.m_funcDeclarations = 0;
     
    875875                                          SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
    876876                                          $$.m_node = node;
    877                                           $$.m_varDeclarations = new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
     877                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    878878                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
    879879                                          $$.m_funcDeclarations = 0;
     
    912912    ConstDeclaration                    { $$.m_node.head = $1.m_node;
    913913                                          $$.m_node.tail = $$.m_node.head;
    914                                           $$.m_varDeclarations = new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
     914                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
    915915                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
    916916                                          $$.m_funcDeclarations = 0;
     
    959959  | IF '(' Expr ')' Statement ELSE Statement
    960960                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
    961                                                                                          mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations), mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
     961                                                                                         mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations),
     962                                                                                         mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
    962963                                                                                         $3.m_features | $5.m_features | $7.m_features,
    963964                                                                                         $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
     
    11691170
    11701171FunctionDeclaration:
    1171     FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::FunctionStack>(GLOBAL_DATA), ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)); }
     1172    FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)); }
    11721173  | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
    11731174      {
    1174           $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserRefCountedData<DeclarationStacks::FunctionStack>(GLOBAL_DATA), ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
     1175          $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
    11751176          if ($4.m_features & ArgumentsFeature)
    11761177              $7->setUsesArguments();
     
    11811182
    11821183FunctionExpr:
    1183     FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); DBG($5, @4, @6); }
     1184    FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); DBG($5, @4, @6); }
    11841185    | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
    11851186      {
    1186           $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
     1187          $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
    11871188          if ($3.m_features & ArgumentsFeature)
    11881189              $6->setUsesArguments();
    11891190          DBG($6, @5, @7);
    11901191      }
    1191   | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); }
     1192  | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); }
    11921193  | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
    11931194      {
    1194           $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
     1195          $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
    11951196          if ($4.m_features & ArgumentsFeature)
    11961197              $7->setUsesArguments();
     
    19721973    else
    19731974        return 0;
    1974     return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
     1975    return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
    19751976}
    19761977
  • trunk/JavaScriptCore/parser/NodeConstructors.h

    r43471 r43479  
    2727namespace JSC {
    2828
    29 #ifdef NDEBUG
    30     inline ParserRefCounted::ParserRefCounted(JSGlobalData* globalData)
    31     {
    32         globalData->parserArena.append(adoptRef(this));
    33     }
    34 #endif
     29    void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
     30    {
     31        ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size));
     32        globalData->parser->arena().deleteWithArena(deletable);
     33        return deletable;
     34    }
     35
     36    void* ParserArenaDeletable::operator new(size_t size)
     37    {
     38        return fastMalloc(size);
     39    }
     40
     41    inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
     42    {
     43        globalData->parser->arena().derefWithArena(adoptRef(this));
     44    }
    3545
    3646    inline Node::Node(JSGlobalData* globalData)
    37         : ParserRefCounted(globalData)
    38         , m_line(globalData->lexer->lineNumber())
    39     {
    40     }
    41 
     47        : m_line(globalData->lexer->lineNumber())
     48    {
     49    }
    4250
    4351    inline ExpressionNode::ExpressionNode(JSGlobalData* globalData, ResultType resultType)
     
    95103    }
    96104
    97     inline ElementNode::ElementNode(JSGlobalData* globalData, int elision, ExpressionNode* node)
    98         : ParserRefCounted(globalData)
    99         , m_next(0)
     105    inline ElementNode::ElementNode(JSGlobalData*, int elision, ExpressionNode* node)
     106        : m_next(0)
    100107        , m_elision(elision)
    101108        , m_node(node)
     
    103110    }
    104111
    105     inline ElementNode::ElementNode(JSGlobalData* globalData, ElementNode* l, int elision, ExpressionNode* node)
    106         : ParserRefCounted(globalData)
    107         , m_next(0)
     112    inline ElementNode::ElementNode(JSGlobalData*, ElementNode* l, int elision, ExpressionNode* node)
     113        : m_next(0)
    108114        , m_elision(elision)
    109115        , m_node(node)
     
    136142    }
    137143
    138     inline PropertyNode::PropertyNode(JSGlobalData* globalData, const Identifier& name, ExpressionNode* assign, Type type)
    139         : ParserRefCounted(globalData)
    140         , m_name(name)
     144    inline PropertyNode::PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* assign, Type type)
     145        : m_name(name)
    141146        , m_assign(assign)
    142147        , m_type(type)
     
    201206    }
    202207
    203     inline ArgumentsNode::ArgumentsNode(JSGlobalData* globalData)
    204         : ParserRefCounted(globalData)
    205         , m_listNode(0)
    206     {
    207     }
    208 
    209     inline ArgumentsNode::ArgumentsNode(JSGlobalData* globalData, ArgumentListNode* listNode)
    210         : ParserRefCounted(globalData)
    211         , m_listNode(listNode)
     208    inline ArgumentsNode::ArgumentsNode(JSGlobalData*)
     209        : m_listNode(0)
     210    {
     211    }
     212
     213    inline ArgumentsNode::ArgumentsNode(JSGlobalData*, ArgumentListNode* listNode)
     214        : m_listNode(listNode)
    212215    {
    213216    }
     
    667670    }
    668671
    669     inline SourceElements::SourceElements(JSGlobalData* globalData)
    670         : ParserRefCounted(globalData)
     672    inline SourceElements::SourceElements(JSGlobalData*)
    671673    {
    672674    }
     
    792794    }
    793795
    794     inline ParameterNode::ParameterNode(JSGlobalData* globalData, const Identifier& ident)
    795         : ParserRefCounted(globalData)
    796         , m_ident(ident)
     796    inline ParameterNode::ParameterNode(JSGlobalData*, const Identifier& ident)
     797        : m_ident(ident)
    797798        , m_next(0)
    798799    {
    799800    }
    800801
    801     inline ParameterNode::ParameterNode(JSGlobalData* globalData, ParameterNode* l, const Identifier& ident)
    802         : ParserRefCounted(globalData)
    803         , m_ident(ident)
     802    inline ParameterNode::ParameterNode(JSGlobalData*, ParameterNode* l, const Identifier& ident)
     803        : m_ident(ident)
    804804        , m_next(0)
    805805    {
     
    807807    }
    808808
    809        
    810809    inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
    811810        : ExpressionNode(globalData)
     811        , ParserArenaRefCounted(globalData)
    812812        , m_ident(ident)
    813813        , m_body(body)
     
    818818    inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
    819819        : StatementNode(globalData)
     820        , ParserArenaRefCounted(globalData)
    820821        , m_ident(ident)
    821822        , m_body(body)
     
    824825    }
    825826
    826     inline CaseClauseNode::CaseClauseNode(JSGlobalData* globalData, ExpressionNode* expr)
    827         : ParserRefCounted(globalData)
    828         , m_expr(expr)
    829     {
    830     }
    831 
    832     inline CaseClauseNode::CaseClauseNode(JSGlobalData* globalData, ExpressionNode* expr, SourceElements* children)
    833         : ParserRefCounted(globalData)
    834         , m_expr(expr)
     827    inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr)
     828        : m_expr(expr)
     829    {
     830    }
     831
     832    inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* children)
     833        : m_expr(expr)
    835834    {
    836835        if (children)
     
    838837    }
    839838
    840     inline ClauseListNode::ClauseListNode(JSGlobalData* globalData, CaseClauseNode* clause)
    841         : ParserRefCounted(globalData)
    842         , m_clause(clause)
     839    inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause)
     840        : m_clause(clause)
    843841        , m_next(0)
    844842    {
    845843    }
    846844
    847     inline ClauseListNode::ClauseListNode(JSGlobalData* globalData, ClauseListNode* clauseList, CaseClauseNode* clause)
    848         : ParserRefCounted(globalData)
    849         , m_clause(clause)
     845    inline ClauseListNode::ClauseListNode(JSGlobalData*, ClauseListNode* clauseList, CaseClauseNode* clause)
     846        : m_clause(clause)
    850847        , m_next(0)
    851848    {
     
    853850    }
    854851
    855     inline CaseBlockNode::CaseBlockNode(JSGlobalData* globalData, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2)
    856         : ParserRefCounted(globalData)
    857         , m_list1(list1)
     852    inline CaseBlockNode::CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2)
     853        : m_list1(list1)
    858854        , m_defaultClause(defaultClause)
    859855        , m_list2(list2)
  • trunk/JavaScriptCore/parser/NodeInfo.h

    r38205 r43479  
    4444    template <typename T> struct NodeDeclarationInfo {
    4545        T m_node;
    46         ParserRefCountedData<DeclarationStacks::VarStack>* m_varDeclarations;
    47         ParserRefCountedData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
     46        ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
     47        ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
    4848        CodeFeatures m_features;
    4949        int m_numConstants;
  • trunk/JavaScriptCore/parser/Nodes.cpp

    r43475 r43479  
    5151
    5252static void substitute(UString& string, const UString& substring) JSC_FAST_CALL;
    53 
    54 // ------------------------------ ParserRefCounted -----------------------------------------
    55 
    56 #ifndef NDEBUG
    57 
    58 static RefCountedLeakCounter parserRefCountedCounter("JSC::Node");
    59 
    60 ALWAYS_INLINE ParserRefCounted::ParserRefCounted(JSGlobalData* globalData)
    61 {
    62     globalData->parserArena.append(adoptRef(this));
    63     parserRefCountedCounter.increment();
    64 }
    65 
    66 ALWAYS_INLINE ParserRefCounted::~ParserRefCounted()
    67 {
    68     parserRefCountedCounter.decrement();
    69 }
    70 
    71 #endif
    7253
    7354// ------------------------------ ThrowableExpressionData --------------------------------
     
    18401821ScopeNode::ScopeNode(JSGlobalData* globalData)
    18411822    : StatementNode(globalData)
     1823    , ParserArenaRefCounted(globalData)
    18421824    , m_features(NoFeatures)
    18431825{
     
    18491831ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, CodeFeatures features, int numConstants)
    18501832    : StatementNode(globalData)
    1851     , m_data(new ScopeNodeData(globalData->parserArena, children, varStack, funcStack, numConstants))
     1833    , ParserArenaRefCounted(globalData)
     1834    , m_data(new ScopeNodeData(globalData->parser->arena(), children, varStack, funcStack, numConstants))
    18521835    , m_features(features)
    18531836    , m_source(source)
     
    18671850PassRefPtr<ProgramNode> ProgramNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& source, CodeFeatures features, int numConstants)
    18681851{
    1869     RefPtr<ProgramNode> node = new (globalData) ProgramNode(globalData, children, varStack, funcStack, source, features, numConstants);
     1852    RefPtr<ProgramNode> node = new ProgramNode(globalData, children, varStack, funcStack, source, features, numConstants);
    18701853
    18711854    ASSERT(node->data()->m_arena.last() == node);
    18721855    node->data()->m_arena.removeLast();
    1873     ASSERT(node->data()->m_arena.find(node.get()) == notFound);
     1856    ASSERT(!node->data()->m_arena.contains(node.get()));
    18741857
    18751858    return node.release();
     
    19111894PassRefPtr<EvalNode> EvalNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& source, CodeFeatures features, int numConstants)
    19121895{
    1913     RefPtr<EvalNode> node = new (globalData) EvalNode(globalData, children, varStack, funcStack, source, features, numConstants);
     1896    RefPtr<EvalNode> node = new EvalNode(globalData, children, varStack, funcStack, source, features, numConstants);
    19141897
    19151898    ASSERT(node->data()->m_arena.last() == node);
    19161899    node->data()->m_arena.removeLast();
    1917     ASSERT(node->data()->m_arena.find(node.get()) == notFound);
     1900    ASSERT(!node->data()->m_arena.contains(node.get()));
    19181901
    19191902    return node.release();
     
    20262009PassRefPtr<FunctionBodyNode> FunctionBodyNode::createNativeThunk(JSGlobalData* globalData)
    20272010{
    2028     RefPtr<FunctionBodyNode> body = new (globalData) FunctionBodyNode(globalData);
    2029     globalData->parserArena.shrink(0);
     2011    RefPtr<FunctionBodyNode> body = new FunctionBodyNode(globalData);
     2012    globalData->parser->arena().reset();
    20302013    body->m_jitCode = globalData->jitStubs.ctiNativeCallThunk();
    20312014    return body.release();
     
    20352018FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData)
    20362019{
    2037     return new (globalData) FunctionBodyNode(globalData);
     2020    return new FunctionBodyNode(globalData);
    20382021}
    20392022
    20402023PassRefPtr<FunctionBodyNode> FunctionBodyNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
    20412024{
    2042     RefPtr<FunctionBodyNode> node = new (globalData) FunctionBodyNode(globalData, children, varStack, funcStack, sourceCode, features, numConstants);
     2025    RefPtr<FunctionBodyNode> node = new FunctionBodyNode(globalData, children, varStack, funcStack, sourceCode, features, numConstants);
    20432026
    20442027    ASSERT(node->data()->m_arena.last() == node);
    20452028    node->data()->m_arena.removeLast();
    2046     ASSERT(node->data()->m_arena.find(node.get()) == notFound);
     2029    ASSERT(!node->data()->m_arena.contains(node.get()));
    20472030
    20482031    return node.release();
  • trunk/JavaScriptCore/parser/Nodes.h

    r43471 r43479  
    3030#include "JITCode.h"
    3131#include "Opcode.h"
     32#include "ParserArena.h"
    3233#include "ResultType.h"
    3334#include "SourceCode.h"
     
    102103    };
    103104
    104     class ParserRefCounted : public RefCounted<ParserRefCounted> {
     105    class ParserArenaDeletable {
    105106    protected:
    106         ParserRefCounted(JSGlobalData*);
    107 
    108     public:
    109         virtual ~ParserRefCounted();
    110 
    111         // Placeholder: To be changed to arena allocation.
    112         void* operator new(size_t size, JSGlobalData*) { return fastMalloc(size); }
    113 
    114     private:
     107        ParserArenaDeletable() { }
     108
     109    public:
     110        virtual ~ParserArenaDeletable() { }
     111
     112        // Objects created with this version of new are deleted when the arena is deleted.
     113        void* operator new(size_t, JSGlobalData*);
     114
     115        // Objects created with this version of new are not deleted when the arena is deleted.
     116        // Other arrangements must be made.
    115117        void* operator new(size_t);
    116118    };
    117119
    118 #ifdef NDEBUG
    119     inline ParserRefCounted::~ParserRefCounted()
    120     {
    121     }
    122 #endif
    123 
    124     class Node : public ParserRefCounted {
    125     public:
     120    class ParserArenaRefCounted : public RefCounted<ParserArenaRefCounted> {
     121    protected:
     122        ParserArenaRefCounted(JSGlobalData*);
     123
     124    public:
     125        virtual ~ParserArenaRefCounted()
     126        {
     127            ASSERT(deletionHasBegun());
     128        }
     129    };
     130
     131    class Node : public ParserArenaDeletable {
     132    protected:
    126133        Node(JSGlobalData*);
    127134
     135    public:
    128136        /*
    129137            Return value: The register holding the production's value.
     
    387395    };
    388396
    389     class ElementNode : public ParserRefCounted {
     397    class ElementNode : public ParserArenaDeletable {
    390398    public:
    391399        ElementNode(JSGlobalData*, int elision, ExpressionNode*);
     
    420428    };
    421429
    422     class PropertyNode : public ParserRefCounted {
     430    class PropertyNode : public ParserArenaDeletable {
    423431    public:
    424432        enum Type { Constant, Getter, Setter };
     
    505513    };
    506514
    507     class ArgumentsNode : public ParserRefCounted {
     515    class ArgumentsNode : public ParserArenaDeletable {
    508516    public:
    509517        ArgumentsNode(JSGlobalData*);
     
    11301138    typedef Vector<StatementNode*> StatementVector;
    11311139
    1132     class SourceElements : public ParserRefCounted {
     1140    class SourceElements : public ParserArenaDeletable {
    11331141    public:
    11341142        SourceElements(JSGlobalData*);
     
    13571365    };
    13581366
    1359     class ParameterNode : public ParserRefCounted {
     1367    class ParameterNode : public ParserArenaDeletable {
    13601368    public:
    13611369        ParameterNode(JSGlobalData*, const Identifier&);
     
    13691377        ParameterNode* m_next;
    13701378    };
    1371 
    1372     // Placholder. Later this will become a true arena.
    1373     typedef Vector<RefPtr<ParserRefCounted> > ParserArena;
    13741379
    13751380    struct ScopeNodeData {
     
    13881393    };
    13891394
    1390     class ScopeNode : public StatementNode {
     1395    class ScopeNode : public StatementNode, public ParserArenaRefCounted {
    13911396    public:
    13921397        typedef DeclarationStacks::VarStack VarStack;
     
    13981403        void adoptData(std::auto_ptr<ScopeNodeData> data)
    13991404        {
    1400             ASSERT(data->m_arena.find(this) == notFound);
     1405            ASSERT(!data->m_arena.contains(this));
    14011406            ASSERT(!m_data);
    14021407            m_data.adopt(data);
     
    15681573    };
    15691574
    1570     class FuncExprNode : public ExpressionNode {
     1575    class FuncExprNode : public ExpressionNode, public ParserArenaRefCounted {
    15711576    public:
    15721577        FuncExprNode(JSGlobalData*, const Identifier&, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0);
     
    15851590    };
    15861591
    1587     class FuncDeclNode : public StatementNode {
     1592    class FuncDeclNode : public StatementNode, public ParserArenaRefCounted {
    15881593    public:
    15891594        FuncDeclNode(JSGlobalData*, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
     
    16011606    };
    16021607
    1603     class CaseClauseNode : public ParserRefCounted {
     1608    class CaseClauseNode : public ParserArenaDeletable {
    16041609    public:
    16051610        CaseClauseNode(JSGlobalData*, ExpressionNode*);
     
    16141619    };
    16151620
    1616     class ClauseListNode : public ParserRefCounted {
     1621    class ClauseListNode : public ParserArenaDeletable {
    16171622    public:
    16181623        ClauseListNode(JSGlobalData*, CaseClauseNode*);
     
    16271632    };
    16281633
    1629     class CaseBlockNode : public ParserRefCounted {
     1634    class CaseBlockNode : public ParserArenaDeletable {
    16301635    public:
    16311636        CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2);
  • trunk/JavaScriptCore/parser/Parser.cpp

    r43471 r43479  
    4040void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
    4141{
    42     ASSERT(!m_sourceElements);
     42    m_sourceElements = 0;
    4343
    4444    int defaultErrLine;
     
    6464        *errLine = lineNumber;
    6565        *errMsg = "Parse error";
    66         m_sourceElements.clear();
     66        m_sourceElements = 0;
    6767    }
    6868}
     
    7777    ASSERT(m_sourceElements);
    7878
    79     functionBodyNode->adoptData(std::auto_ptr<ScopeNodeData>(new ScopeNodeData(globalData->parserArena,
    80         m_sourceElements.get(),
     79    functionBodyNode->adoptData(std::auto_ptr<ScopeNodeData>(new ScopeNodeData(globalData->parser->arena(),
     80        m_sourceElements,
    8181        m_varDeclarations ? &m_varDeclarations->data : 0,
    8282        m_funcDeclarations ? &m_funcDeclarations->data : 0,
     
    8787        functionBodyNode->setUsesArguments();
    8888
    89     ASSERT(globalData->parserArena.isEmpty());
     89    ASSERT(globalData->parser->arena().isEmpty());
    9090
    9191    m_source = 0;
     
    9595}
    9696
    97 void Parser::didFinishParsing(SourceElements* sourceElements, ParserRefCountedData<DeclarationStacks::VarStack>* varStack,
    98                               ParserRefCountedData<DeclarationStacks::FunctionStack>* funcStack, CodeFeatures features, int lastLine, int numConstants)
     97void Parser::didFinishParsing(SourceElements* sourceElements, ParserArenaData<DeclarationStacks::VarStack>* varStack,
     98                              ParserArenaData<DeclarationStacks::FunctionStack>* funcStack, CodeFeatures features, int lastLine, int numConstants)
    9999{
    100100    m_sourceElements = sourceElements;
  • trunk/JavaScriptCore/parser/Parser.h

    r43471 r43479  
    2424#define Parser_h
    2525
    26 #include "SourceProvider.h"
    2726#include "Debugger.h"
    2827#include "Nodes.h"
     28#include "SourceProvider.h"
    2929#include <wtf/Forward.h>
    3030#include <wtf/Noncopyable.h>
     
    3838    class UString;
    3939
    40     template <typename T>
    41     struct ParserRefCountedData : ParserRefCounted {
    42         ParserRefCountedData(JSGlobalData* globalData)
    43             : ParserRefCounted(globalData)
    44         {
    45         }
    46 
    47         T data;
    48     };
     40    template <typename T> struct ParserArenaData : ParserArenaDeletable { T data; };
    4941
    5042    class Parser : Noncopyable {
     
    5446        void reparseInPlace(JSGlobalData*, FunctionBodyNode*);
    5547
    56         void didFinishParsing(SourceElements*, ParserRefCountedData<DeclarationStacks::VarStack>*,
    57                               ParserRefCountedData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants);
     48        void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
     49                              ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants);
     50
     51        ParserArena& arena() { return m_arena; }
    5852
    5953    private:
    6054        void parse(JSGlobalData*, int* errLine, UString* errMsg);
    6155
     56        ParserArena m_arena;
    6257        const SourceCode* m_source;
    63         RefPtr<SourceElements> m_sourceElements;
    64         RefPtr<ParserRefCountedData<DeclarationStacks::VarStack> > m_varDeclarations;
    65         RefPtr<ParserRefCountedData<DeclarationStacks::FunctionStack> > m_funcDeclarations;
     58        SourceElements* m_sourceElements;
     59        ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
     60        ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
    6661        CodeFeatures m_features;
    6762        int m_lastLine;
     
    7671        if (m_sourceElements) {
    7772            result = ParsedNode::create(&exec->globalData(),
    78                                          m_sourceElements.get(),
     73                                         m_sourceElements,
    7974                                         m_varDeclarations ? &m_varDeclarations->data : 0,
    8075                                         m_funcDeclarations ? &m_funcDeclarations->data : 0,
     
    8580        }
    8681
    87         exec->globalData().parserArena.shrink(0);
     82        m_arena.reset();
    8883
    8984        m_source = 0;
    90         m_sourceElements = 0;
    9185        m_varDeclarations = 0;
    9286        m_funcDeclarations = 0;
     
    10498        if (m_sourceElements) {
    10599            result = ParsedNode::create(globalData,
    106                                         m_sourceElements.get(),
     100                                        m_sourceElements,
    107101                                        m_varDeclarations ? &m_varDeclarations->data : 0,
    108102                                        m_funcDeclarations ? &m_funcDeclarations->data : 0,
     
    113107        }
    114108
    115         globalData->parserArena.shrink(0);
     109        m_arena.reset();
    116110
    117111        m_source = 0;
    118         m_sourceElements = 0;
    119112        m_varDeclarations = 0;
    120113        m_funcDeclarations = 0;
  • trunk/JavaScriptCore/runtime/JSGlobalData.cpp

    r43471 r43479  
    184184
    185185    delete clientData;
    186    
    187     ASSERT(parserArena.isEmpty());
    188186}
    189187
     
    195193PassRefPtr<JSGlobalData> JSGlobalData::createLeaked()
    196194{
    197 #ifndef NDEBUG
    198195    Structure::startIgnoringLeaks();
    199196    RefPtr<JSGlobalData> data = create();
    200197    Structure::stopIgnoringLeaks();
    201198    return data.release();
    202 #else
    203     return create();
    204 #endif
    205199}
    206200
     
    229223}
    230224
     225#if ENABLE(JIT)
     226
    231227void JSGlobalData::createNativeThunk()
    232228{
    233 #if ENABLE(JIT)
    234229    lazyNativeFunctionThunk = FunctionBodyNode::createNativeThunk(this);
    235 #endif
    236 }
     230}
     231
     232#endif
    237233
    238234// FIXME: We can also detect forms like v1 < v2 ? -1 : 0, reverse comparison, etc.
  • trunk/JavaScriptCore/runtime/JSGlobalData.h

    r43471 r43479  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4545namespace JSC {
    4646
    47     class ArgList;
    4847    class CommonIdentifiers;
    4948    class FunctionBodyNode;
    50     class Heap;
    5149    class IdentifierTable;
    5250    class Instruction;
     
    5654    class Lexer;
    5755    class Parser;
    58     class ParserRefCounted;
    5956    class ScopeNode;
    6057    class Structure;
     
    148145        HashSet<JSObject*> arrayVisitedElements;
    149146
    150         Vector<RefPtr<ParserRefCounted> > parserArena;
    151147        ScopeNode* scopeNodeBeingReparsed;
    152148
     
    156152        void createNativeThunk();
    157153    };
     154
    158155} // namespace JSC
    159156
  • trunk/JavaScriptCore/wtf/RefCounted.h

    r43317 r43479  
    8484    }
    8585
     86#ifndef NDEBUG
     87    bool deletionHasBegun() const
     88    {
     89        return m_deletionHasBegun;
     90    }
     91#endif
     92
    8693private:
    8794    template<class T>
Note: See TracChangeset for help on using the changeset viewer.