Changeset 28468 in webkit for trunk/JavaScriptCore/kjs/ExecState.cpp
- Timestamp:
- Dec 5, 2007, 6:31:41 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ExecState.cpp
r28110 r28468 32 32 namespace KJS { 33 33 34 35 34 // ECMA 10.2 36 ExecState::ExecState( Interpreter* interpreter,JSGlobalObject* globalObject, JSObject* thisV,37 FunctionBodyNode* currentBody, CodeType type, ExecState* callingExec, 35 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV, 36 FunctionBodyNode* currentBody, CodeType type, ExecState* callingExec, ExecState* currentExec, 38 37 FunctionImp* func, const List* args) 39 : m_ interpreter(interpreter)38 : m_globalObject(globalObject) 40 39 , m_exception(0) 41 40 , m_propertyNames(CommonIdentifiers::shared()) 42 , m_savedExecState(interpreter->currentExec()) 41 , m_callingExec(callingExec) 42 , m_savedExec(currentExec) 43 43 , m_currentBody(currentBody) 44 44 , m_function(func) … … 46 46 , m_iterationDepth(0) 47 47 , m_switchDepth(0) 48 , m_codeType(type) 48 49 { 49 m_codeType = type;50 m_callingExecState = callingExec;51 52 50 // create and initialize activation object (ECMA 10.1.6) 53 51 if (type == FunctionCode) { … … 62 60 switch(type) { 63 61 case EvalCode: 64 if (m_callingExec State) {65 m_scopeChain = m_callingExec State->scopeChain();66 m_variable = m_callingExec State->variableObject();67 m_thisVal = m_callingExec State->thisValue();62 if (m_callingExec) { 63 m_scopeChain = m_callingExec->scopeChain(); 64 m_variable = m_callingExec->variableObject(); 65 m_thisVal = m_callingExec->thisValue(); 68 66 break; 69 67 } // else same as GlobalCode 70 68 case GlobalCode: 71 if (globalObject)72 setGlobalObject(globalObject);69 m_scopeChain.push(globalObject); 70 m_thisVal = globalObject; 73 71 break; 74 72 case FunctionCode: … … 81 79 82 80 if (currentBody) 83 m_ interpreter->setCurrentExec(this);81 m_globalObject->setCurrentExec(this); 84 82 } 85 83 86 84 ExecState::~ExecState() 87 85 { 88 m_ interpreter->setCurrentExec(m_savedExecState);86 m_globalObject->setCurrentExec(m_savedExec); 89 87 } 90 88 91 89 void ExecState::mark() 92 90 { 93 for (ExecState* exec = this; exec; exec = exec->m_callingExec State)91 for (ExecState* exec = this; exec; exec = exec->m_callingExec) 94 92 exec->m_scopeChain.mark(); 95 93 } 96 94 97 void ExecState::setGlobalObject(JSGlobalObject* globalObject) 98 { 99 m_scopeChain.clear(); 100 m_scopeChain.push(globalObject); 101 m_thisVal = static_cast<JSObject*>(globalObject); 102 } 103 104 Interpreter* ExecState::lexicalInterpreter() const 95 JSGlobalObject* ExecState::lexicalGlobalObject() const 105 96 { 106 97 if (scopeChain().isEmpty()) 107 return dynamic Interpreter();98 return dynamicGlobalObject(); 108 99 109 100 JSObject* object = scopeChain().bottom(); 110 101 if (object && object->isGlobalObject()) 111 return static_cast<JSGlobalObject*>(object) ->interpreter();102 return static_cast<JSGlobalObject*>(object); 112 103 113 return dynamic Interpreter();104 return dynamicGlobalObject(); 114 105 } 115 106
Note:
See TracChangeset
for help on using the changeset viewer.