Changeset 29067 in webkit for trunk/JavaScriptCore/kjs/ExecState.cpp
- Timestamp:
- Jan 1, 2008, 11:35:37 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ExecState.cpp
r28884 r29067 32 32 namespace KJS { 33 33 34 static inline List* globalEmptyList() 35 { 36 static List staticEmptyList; 37 return &staticEmptyList; 38 } 39 34 40 // ECMA 10.2 35 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV, 36 ScopeNode* scopeNode, CodeType type, ExecState* callingExec, ExecState* currentExec, 37 FunctionImp* func, const List* args) 41 42 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* /*thisObject*/, ProgramNode* programNode) 38 43 : m_globalObject(globalObject) 39 44 , m_exception(0) 40 45 , m_propertyNames(CommonIdentifiers::shared()) 41 , m_callingExec(callingExec) 42 , m_savedExec(currentExec) 43 , m_scopeNode(scopeNode) 44 , m_function(func) 45 , m_arguments(args) 46 , m_emptyList(globalEmptyList()) 47 , m_callingExec(0) 48 , m_savedExec(0) 49 , m_scopeNode(programNode) 50 , m_function(0) 51 , m_arguments(0) 52 , m_activation(0) 53 , m_localStorage(&globalObject->localStorage()) 54 , m_variableObject(globalObject) 55 , m_thisVal(globalObject) 46 56 , m_iterationDepth(0) 47 57 , m_switchDepth(0) 48 , m_codeType( type)58 , m_codeType(GlobalCode) 49 59 { 50 // create and initialize activation object (ECMA 10.1.6) 51 if (type == FunctionCode) { 52 m_activation = new ActivationImp(this); 53 m_variableObject = m_activation; 54 } else { 55 m_activation = 0; 56 m_variableObject = globalObject; 57 } 58 59 // ECMA 10.2 60 switch(type) { 61 case EvalCode: 62 if (m_callingExec) { 63 m_scopeChain = m_callingExec->scopeChain(); 64 m_variableObject = m_callingExec->variableObject(); 65 m_thisVal = m_callingExec->thisValue(); 66 break; 67 } // else same as GlobalCode 68 case GlobalCode: 69 m_scopeChain.push(globalObject); 70 m_thisVal = globalObject; 71 break; 72 case FunctionCode: 73 m_scopeChain = func->scope(); 74 m_scopeChain.push(m_activation); 75 m_variableObject = m_activation; 76 m_thisVal = thisV; 77 break; 78 } 79 80 m_localStorage = &m_variableObject->localStorage(); 60 // FIXME: This function ignores the "thisObject" parameter, which means that the API for evaluating 61 // a script with a this object that's not the same as the global object is broken, and probably 62 // has been for some time. 63 m_scopeChain.push(globalObject); 64 if (programNode) 65 globalObject->setCurrentExec(this); 66 } 81 67 82 if (scopeNode) 83 m_globalObject->setCurrentExec(this); 68 ExecState::ExecState(JSGlobalObject* globalObject, EvalNode* evalNode, ExecState* callingExec) 69 : m_globalObject(globalObject) 70 , m_exception(0) 71 , m_propertyNames(callingExec->m_propertyNames) 72 , m_emptyList(callingExec->m_emptyList) 73 , m_callingExec(callingExec) 74 , m_savedExec(globalObject->currentExec()) 75 , m_scopeNode(evalNode) 76 , m_function(0) 77 , m_arguments(0) 78 , m_activation(0) 79 , m_localStorage(callingExec->m_localStorage) 80 , m_scopeChain(callingExec->m_scopeChain) 81 , m_variableObject(callingExec->m_variableObject) 82 , m_thisVal(callingExec->m_thisVal) 83 , m_iterationDepth(0) 84 , m_switchDepth(0) 85 , m_codeType(EvalCode) 86 { 87 globalObject->setCurrentExec(this); 88 } 89 90 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject, 91 FunctionBodyNode* functionBodyNode, ExecState* callingExec, 92 FunctionImp* func, const List& args) 93 : m_globalObject(globalObject) 94 , m_exception(0) 95 , m_propertyNames(callingExec->m_propertyNames) 96 , m_emptyList(callingExec->m_emptyList) 97 , m_callingExec(callingExec) 98 , m_savedExec(globalObject->currentExec()) 99 , m_scopeNode(functionBodyNode) 100 , m_function(func) 101 , m_arguments(&args) 102 , m_scopeChain(func->scope()) 103 , m_thisVal(thisObject) 104 , m_iterationDepth(0) 105 , m_switchDepth(0) 106 , m_codeType(FunctionCode) 107 { 108 ActivationImp* activation = new ActivationImp(this); 109 m_activation = activation; 110 m_localStorage = &activation->localStorage(); 111 m_variableObject = activation; 112 m_scopeChain.push(activation); 113 globalObject->setCurrentExec(this); 84 114 } 85 115
Note:
See TracChangeset
for help on using the changeset viewer.