Changeset 27025 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Oct 25, 2007, 12:09:44 AM (18 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r27022 r27025 77 77 ctx.setExecState(&newExec); 78 78 79 passInParameters(&newExec, args);80 81 79 Debugger* dbg = exec->dynamicInterpreter()->debugger(); 82 80 int sid = -1; … … 125 123 else 126 124 return jsUndefined(); 127 }128 129 // ECMA 10.1.3q130 inline void FunctionImp::passInParameters(ExecState* exec, const List& args)131 {132 Vector<Identifier>& parameters = body->parameters();133 134 JSObject* variable = exec->context()->variableObject();135 136 size_t size = parameters.size();137 for (size_t i = 0; i < size; ++i) {138 variable->put(exec, parameters[i], args[i], DontDelete);139 }140 125 } 141 126 -
trunk/JavaScriptCore/kjs/function.h
r26808 r27025 108 108 static JSValue* callerGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&); 109 109 static JSValue* lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&); 110 111 void passInParameters(ExecState*, const List&);112 110 }; 113 111 -
trunk/JavaScriptCore/kjs/nodes.cpp
r27001 r27025 1767 1767 1768 1768 void VarDeclNode::getDeclarations(DeclarationStacks& stacks) 1769 { 1769 { 1770 // The normal check to avoid overwriting pre-existing values with variable 1771 // declarations doesn't work for the "arguments" property because we 1772 // instantiate it lazily. So we need to check here instead. 1773 if (ident == stacks.exec->propertyNames().arguments) 1774 return; 1775 1770 1776 stacks.varStack.append(this); 1771 1777 } … … 1845 1851 void VarDeclNode::processDeclaration(ExecState* exec) 1846 1852 { 1847 JSObject* variable = exec->context()->variableObject(); 1848 1849 // If a variable by this name already exists, don't clobber it - 1850 // it might be a function parameter 1851 if (!variable->hasProperty(exec, ident)) { 1852 int flags = Internal; 1853 if (exec->context()->codeType() != EvalCode) 1854 flags |= DontDelete; 1855 if (varType == VarDeclNode::Constant) 1856 flags |= ReadOnly; 1857 variable->put(exec, ident, jsUndefined(), flags); 1858 } 1853 Context* context = exec->context(); 1854 JSObject* variable = context->variableObject(); 1855 1856 if (context->codeType() != FunctionCode) 1857 if (variable->hasProperty(exec, ident)) 1858 return; 1859 1860 int flags = Internal; 1861 if (context->codeType() != EvalCode) 1862 flags |= DontDelete; 1863 if (varType == VarDeclNode::Constant) 1864 flags |= ReadOnly; 1865 variable->put(exec, ident, jsUndefined(), flags); 1859 1866 } 1860 1867 … … 1877 1884 stacks.nodeStack.append(next.get()); 1878 1885 } 1879 stacks. varStack.append(var.get());1886 stacks.nodeStack.append(var.get()); 1880 1887 } 1881 1888 … … 2596 2603 } 2597 2604 2598 void FunctionBodyNode::initializeDeclarationStacks( )2605 void FunctionBodyNode::initializeDeclarationStacks(ExecState* exec) 2599 2606 { 2600 2607 Node* node = source.get(); … … 2603 2610 2604 2611 DeclarationStacks::NodeStack nodeStack; 2605 DeclarationStacks stacks( nodeStack, m_varStack, m_functionStack);2612 DeclarationStacks stacks(exec, nodeStack, m_varStack, m_functionStack); 2606 2613 2607 2614 while (true) { … … 2623 2630 { 2624 2631 if (!m_initializedDeclarationStacks) 2625 initializeDeclarationStacks( );2632 initializeDeclarationStacks(exec); 2626 2633 2627 2634 size_t i, size; 2635 2636 JSObject* variableObject = exec->context()->variableObject(); 2637 const List& args = *exec->context()->arguments(); 2638 2639 // The order of additions to the variable object here implicitly enforces the mutual exclusion described in ECMA 10.1.3. 2640 for (i = 0, size = m_varStack.size(); i < size; ++i) 2641 m_varStack[i]->processDeclaration(exec); 2642 2643 for (i = 0, size = m_parameters.size(); i < size; ++i) 2644 variableObject->put(exec, m_parameters[i], args[i], DontDelete); 2628 2645 2629 2646 for (i = 0, size = m_functionStack.size(); i < size; ++i) 2630 2647 m_functionStack[i]->processDeclaration(exec); 2631 2632 for (i = 0, size = m_varStack.size(); i < size; ++i)2633 m_varStack[i]->processDeclaration(exec);2634 2648 } 2635 2649 -
trunk/JavaScriptCore/kjs/nodes.h
r26960 r27025 89 89 typedef Vector<FuncDeclNode*, 16> FunctionStack; 90 90 91 DeclarationStacks(NodeStack& n, VarStack& v, FunctionStack& f) 92 : nodeStack(n) 91 DeclarationStacks(ExecState* e, NodeStack& n, VarStack& v, FunctionStack& f) 92 : exec(e) 93 , nodeStack(n) 93 94 , varStack(v) 94 95 , functionStack(f) 95 96 { 96 97 } 97 98 99 ExecState* exec; 98 100 NodeStack& nodeStack; 99 101 VarStack& varStack; … … 1244 1246 UString m_sourceURL; 1245 1247 int m_sourceId; 1246 Vector<Identifier> m_parameters; 1247 1248 void initializeDeclarationStacks(); 1248 1249 void initializeDeclarationStacks(ExecState*); 1249 1250 bool m_initializedDeclarationStacks; 1251 1250 1252 DeclarationStacks::VarStack m_varStack; 1251 1253 DeclarationStacks::FunctionStack m_functionStack; 1254 Vector<Identifier> m_parameters; 1252 1255 }; 1253 1256
Note:
See TracChangeset
for help on using the changeset viewer.