Changeset 26811 in webkit
- Timestamp:
- Oct 20, 2007, 12:11:53 AM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r26809 r26811 1 2007-10-20 Geoffrey Garen <[email protected]> 2 3 Reviewed by Maciej Stachowiak. 4 5 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570 6 Store gathered declaration nodes in the function body node. 7 8 This means that you only have to gather the declaration nodes the first 9 time the function executes. Performance gain of 2.10% on SunSpider, 10 0.90% on command-line JS iBench. 11 12 * kjs/nodes.cpp: Split declaration stack initialization code off into 13 initializeDeclarationStacks(). 14 (FunctionBodyNode::FunctionBodyNode): 15 (FunctionBodyNode::initializeDeclarationStacks): 16 (FunctionBodyNode::processDeclarations): 17 18 * kjs/nodes.h: Changed DeclarationStacks structure to hold references, 19 since the actual Vectors are now stored either on the stack or in the 20 function body node. 21 1 22 2007-10-19 Geoffrey Garen <[email protected]> 2 23 -
trunk/JavaScriptCore/kjs/nodes.cpp
r26808 r26811 2423 2423 , m_sourceURL(Lexer::curr()->sourceURL()) 2424 2424 , m_sourceId(Parser::sid) 2425 { 2426 2425 , m_initializedDeclarationStacks(false) 2426 { 2427 2427 setLoc(-1, -1); 2428 2428 } 2429 2429 2430 void FunctionBodyNode:: processDeclarations(ExecState* exec)2430 void FunctionBodyNode::initializeDeclarationStacks() 2431 2431 { 2432 2432 Node* node = source.get(); … … 2434 2434 return; 2435 2435 2436 DeclarationStacks stacks;2437 DeclarationStacks ::NodeStack& nodeStack = stacks.nodeStack;2436 DeclarationStacks::NodeStack nodeStack; 2437 DeclarationStacks stacks(nodeStack, m_varStack, m_functionStack); 2438 2438 2439 2439 while (true) { … … 2448 2448 nodeStack.shrink(size); 2449 2449 } 2450 2450 2451 m_initializedDeclarationStacks = true; 2452 } 2453 2454 void FunctionBodyNode::processDeclarations(ExecState* exec) 2455 { 2456 if (!m_initializedDeclarationStacks) 2457 initializeDeclarationStacks(); 2458 2451 2459 size_t i, size; 2452 2460 2453 DeclarationStacks::FunctionStack& functionStack = stacks.functionStack; 2454 for (i = 0, size = functionStack.size(); i < size; ++i) 2455 functionStack[i]->processDeclaration(exec); 2456 2457 DeclarationStacks::VarStack& varStack = stacks.varStack; 2458 for (i = 0, size = varStack.size(); i < size; ++i) 2459 varStack[i]->processDeclaration(exec); 2461 for (i = 0, size = m_functionStack.size(); i < size; ++i) 2462 m_functionStack[i]->processDeclaration(exec); 2463 2464 for (i = 0, size = m_varStack.size(); i < size; ++i) 2465 m_varStack[i]->processDeclaration(exec); 2460 2466 } 2461 2467 -
trunk/JavaScriptCore/kjs/nodes.h
r26808 r26811 90 90 typedef Vector<FuncDeclNode*, 16> FunctionStack; 91 91 92 NodeStack nodeStack; 93 VarStack varStack; 94 FunctionStack functionStack; 92 DeclarationStacks(NodeStack& n, VarStack& v, FunctionStack& f) 93 : nodeStack(n) 94 , varStack(v) 95 , functionStack(f) 96 { 97 } 98 99 NodeStack& nodeStack; 100 VarStack& varStack; 101 FunctionStack& functionStack; 95 102 }; 96 103 … … 1057 1064 int m_sourceId; 1058 1065 Vector<Identifier> m_parameters; 1066 1067 void initializeDeclarationStacks(); 1068 bool m_initializedDeclarationStacks; 1069 DeclarationStacks::VarStack m_varStack; 1070 DeclarationStacks::FunctionStack m_functionStack; 1059 1071 }; 1060 1072
Note:
See TracChangeset
for help on using the changeset viewer.