Changeset 33979 in webkit for trunk/JavaScriptCore/kjs/ExecState.cpp
- Timestamp:
- May 21, 2008, 6:20:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ExecState.cpp
r32652 r33979 25 25 #include "ExecState.h" 26 26 27 #include "Activation.h"28 27 #include "JSGlobalObject.h" 29 28 #include "function.h" 30 29 #include "internal.h" 31 30 #include "scope_chain_mark.h" 32 #include "ExecStateInlines.h"33 31 34 32 namespace KJS { 35 33 36 // ECMA 10.2 37 38 // The constructor for the globalExec pseudo-ExecState 39 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject) 34 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* globalThisValue, ScopeChainNode* globalScopeChain) 40 35 : m_globalObject(globalObject) 36 , m_globalThisValue(globalThisValue) 41 37 , m_exception(0) 42 , m_callingExec(0)43 38 , m_perThreadData(globalObject->perThreadData()) 44 , m_scopeNode(0) 45 , m_function(0) 46 , m_arguments(0) 47 , m_activation(0) 48 , m_localStorage(&globalObject->localStorage()) 49 , m_inlineScopeChainNode(0, 0) 50 , m_variableObject(globalObject) 51 , m_thisValue(thisObject) 52 , m_globalThisValue(thisObject) 53 , m_iterationDepth(0) 54 , m_switchDepth(0) 55 , m_codeType(GlobalCode) 56 { 57 m_scopeChain.push(globalObject); 58 } 59 60 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject, ProgramNode* programNode) 61 : m_globalObject(globalObject) 62 , m_exception(0) 63 , m_callingExec(0) 64 , m_perThreadData(globalObject->perThreadData()) 65 , m_scopeNode(programNode) 66 , m_function(0) 67 , m_arguments(0) 68 , m_activation(0) 69 , m_localStorage(&globalObject->localStorage()) 70 , m_inlineScopeChainNode(0, 0) 71 , m_variableObject(globalObject) 72 , m_thisValue(thisObject) 73 , m_globalThisValue(thisObject) 74 , m_iterationDepth(0) 75 , m_switchDepth(0) 76 , m_codeType(GlobalCode) 77 { 78 ASSERT(m_scopeNode); 79 m_scopeChain.push(globalObject); 80 } 81 82 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject, EvalNode* evalNode, ExecState* callingExec, const ScopeChain& scopeChain, JSVariableObject* variableObject) 83 : m_globalObject(globalObject) 84 , m_exception(0) 85 , m_callingExec(callingExec) 86 , m_perThreadData(callingExec->m_perThreadData) 87 , m_scopeNode(evalNode) 88 , m_function(0) 89 , m_arguments(0) 90 , m_activation(0) 91 , m_localStorage(callingExec->m_localStorage) 92 , m_scopeChain(scopeChain) 93 , m_inlineScopeChainNode(0, 0) 94 , m_variableObject(variableObject) 95 , m_thisValue(thisObject) 96 , m_globalThisValue(thisObject) 97 , m_iterationDepth(0) 98 , m_switchDepth(0) 99 , m_codeType(EvalCode) 100 { 101 ASSERT(m_scopeNode); 102 } 103 104 JSGlobalObject* ExecState::lexicalGlobalObject() const 105 { 106 JSObject* object = m_scopeChain.bottom(); 107 if (object && object->isGlobalObject()) 108 return static_cast<JSGlobalObject*>(object); 109 return m_globalObject; 110 } 111 112 GlobalExecState::GlobalExecState(JSGlobalObject* globalObject, JSObject* thisObject) 113 : ExecState(globalObject, thisObject) 39 , m_prev(0) 40 , m_machine(0) 41 , m_registerFile(0) 42 , m_scopeChain(globalScopeChain) 43 , m_callFrameOffset(-1) 114 44 { 115 45 } 116 46 117 GlobalExecState::~GlobalExecState() 47 ExecState::ExecState(ExecState* exec, Machine* machine, RegisterFile* registerFile, ScopeChainNode* scopeChain, int callFrameOffset) 48 : m_globalObject(exec->m_globalObject) 49 , m_globalThisValue(exec->m_globalThisValue) 50 , m_exception(0) 51 , m_perThreadData(exec->m_globalObject->perThreadData()) 52 , m_prev(exec) 53 , m_machine(machine) 54 , m_registerFile(registerFile) 55 , m_scopeChain(scopeChain) 56 , m_callFrameOffset(callFrameOffset) 118 57 { 58 ASSERT(!exec->m_exception); 119 59 } 120 60 121 InterpreterExecState::InterpreterExecState(JSGlobalObject* globalObject, JSObject* thisObject, ProgramNode* programNode) 122 : ExecState(globalObject, thisObject, programNode) 61 bool ExecState::isGlobalObject(JSObject* o) const 123 62 { 124 m_globalObject->activeExecStates().append(this);63 return o->isGlobalObject(); 125 64 } 126 65 127 InterpreterExecState::~InterpreterExecState()128 {129 ASSERT(m_globalObject->activeExecStates().last() == this);130 m_globalObject->activeExecStates().removeLast();131 }132 133 EvalExecState::EvalExecState(JSGlobalObject* globalObject, JSObject* thisObj, EvalNode* evalNode, ExecState* callingExec, const ScopeChain& scopeChain, JSVariableObject* variableObject)134 : ExecState(globalObject, thisObj, evalNode, callingExec, scopeChain, variableObject)135 {136 m_globalObject->activeExecStates().append(this);137 }138 139 EvalExecState::~EvalExecState()140 {141 ASSERT(m_globalObject->activeExecStates().last() == this);142 m_globalObject->activeExecStates().removeLast();143 }144 145 66 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.