Changeset 27126 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp
- Timestamp:
- Oct 26, 2007, 3:43:03 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes.cpp
r27100 r27126 1835 1835 flags |= ReadOnly; 1836 1836 1837 ASSERT(variableObject-> getDirect(ident) || ident == exec->propertyNames().arguments);1837 ASSERT(variableObject->hasProperty(exec, ident)); 1838 1838 variableObject->put(exec, ident, val, flags); 1839 1839 } … … 2579 2579 , m_sourceId(Parser::sid) 2580 2580 , m_initializedDeclarationStacks(false) 2581 , m_initializedSymbolTable(false) 2581 2582 { 2582 2583 setLoc(-1, -1); … … 2607 2608 } 2608 2609 2609 void FunctionBodyNode:: processDeclarationsFunctionCode(ExecState* exec)2610 void FunctionBodyNode::initializesymbolTable() 2610 2611 { 2611 2612 size_t i, size; 2612 2613 JSObject* variableObject = exec->variableObject(); 2614 2613 size_t count = 0; 2614 2615 // The order of additions here implicitly enforces the mutual exclusion described in ECMA 10.1.3. 2616 for (i = 0, size = m_varStack.size(); i < size; ++i) 2617 m_symbolTable.set(m_varStack[i]->ident, count++); 2618 2619 for (i = 0, size = m_parameters.size(); i < size; ++i) 2620 m_symbolTable.set(m_parameters[i], count++); 2621 2622 for (i = 0, size = m_functionStack.size(); i < size; ++i) 2623 m_symbolTable.set(m_functionStack[i]->ident, count++); 2624 2625 m_initializedSymbolTable = true; 2626 } 2627 2628 void FunctionBodyNode::processDeclarations(ExecState* exec) 2629 { 2630 if (!m_initializedDeclarationStacks) 2631 initializeDeclarationStacks(exec); 2632 2633 if (exec->codeType() == FunctionCode) 2634 processDeclarationsForFunctionCode(exec); 2635 else 2636 processDeclarationsForProgramCode(exec); 2637 } 2638 2639 void FunctionBodyNode::processDeclarationsForFunctionCode(ExecState* exec) 2640 { 2641 if (!m_initializedSymbolTable) 2642 initializesymbolTable(); 2643 2644 ASSERT(exec->variableObject()->isActivation()); 2645 ActivationImp::LocalStorage& localStorage = static_cast<ActivationImp*>(exec->variableObject())->localStorage(); 2646 localStorage.reserveCapacity(m_varStack.size() + m_parameters.size() + m_functionStack.size()); 2647 2615 2648 int minAttributes = Internal | DontDelete; 2616 2617 // The order of additions to the variable object here implicitly enforces the mutual exclusion described in ECMA 10.1.3. 2649 2650 size_t i, size; 2651 2652 // NOTE: Must match the order of addition in initializesymbolTable(). 2653 2618 2654 for (i = 0, size = m_varStack.size(); i < size; ++i) { 2619 2655 VarDeclNode* node = m_varStack[i]; … … 2621 2657 if (node->varType == VarDeclNode::Constant) 2622 2658 attributes |= ReadOnly; 2623 variableObject->put(exec, node->ident, jsUndefined(), attributes);2659 localStorage.append(ActivationImp::LocalStorageEntry(jsUndefined(), attributes)); 2624 2660 } 2625 2661 2626 2662 const List& args = *exec->arguments(); 2627 2663 for (i = 0, size = m_parameters.size(); i < size; ++i) 2628 variableObject->put(exec, m_parameters[i], args[i], DontDelete);2664 localStorage.append(ActivationImp::LocalStorageEntry(args[i], DontDelete)); 2629 2665 2630 2666 for (i = 0, size = m_functionStack.size(); i < size; ++i) { 2631 2667 FuncDeclNode* node = m_functionStack[i]; 2632 variableObject->put(exec, node->ident, node->makeFunction(exec), minAttributes);2668 localStorage.append(ActivationImp::LocalStorageEntry(node->makeFunction(exec), minAttributes)); 2633 2669 } 2634 2670 } 2635 2671 2636 void FunctionBodyNode::processDeclarations ProgramCode(ExecState* exec)2672 void FunctionBodyNode::processDeclarationsForProgramCode(ExecState* exec) 2637 2673 { 2638 2674 size_t i, size; … … 2678 2714 } 2679 2715 2680 void FunctionBodyNode::processDeclarations(ExecState* exec)2681 {2682 if (!m_initializedDeclarationStacks)2683 initializeDeclarationStacks(exec);2684 2685 if (exec->codeType() == FunctionCode)2686 processDeclarationsFunctionCode(exec);2687 else2688 processDeclarationsProgramCode(exec);2689 }2690 2691 2716 Completion FunctionBodyNode::execute(ExecState* exec) 2692 2717 {
Note:
See TracChangeset
for help on using the changeset viewer.