Changeset 29810 in webkit for trunk/JavaScriptCore/kjs/ExecState.h
- Timestamp:
- Jan 26, 2008, 10:55:52 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ExecState.h
r29710 r29810 3 3 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 4 4 * Copyright (C) 2001 Peter Kelly ([email protected]) 5 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 22 22 */ 23 23 24 #ifndef ExecState_ H25 #define ExecState_ H24 #ifndef ExecState_h 25 #define ExecState_h 26 26 27 27 #include "LabelStack.h" 28 28 #include "LocalStorage.h" 29 #include "completion.h" 30 #include "list.h" 29 31 #include "scope_chain.h" 30 #include "types.h"31 32 32 33 namespace KJS { 33 34 34 enum CodeType {35 GlobalCode,36 EvalCode,37 FunctionCode,38 };39 40 35 class ActivationImp; 41 36 class CommonIdentifiers; … … 48 43 class JSVariableObject; 49 44 class ProgramNode; 50 class ScopeChain;51 45 class ScopeNode; 52 struct LocalStorageEntry; 46 47 enum CodeType { GlobalCode, EvalCode, FunctionCode }; 53 48 54 49 typedef Vector<ExecState*, 16> ExecStateStack; 55 50 56 /** 57 * Represents the current state of script execution. This is 58 * passed as the first argument to most functions. 59 */ 60 class ExecState { 61 friend class Interpreter; 62 friend class FunctionImp; 63 friend class GlobalFuncImp; 64 public: 65 /** 66 * Returns the global object that was in scope when the current script started executing. 67 */ 51 // Represents the current state of script execution. 52 // Passed as the first argument to most functions. 53 class ExecState : Noncopyable { 54 public: 55 // Global object that was in scope when the current script started executing. 68 56 JSGlobalObject* dynamicGlobalObject() const { return m_globalObject; } 69 57 70 /** 71 * Returns the global object that was in scope when the current body of code was defined. 72 */ 58 // Global object that was in scope when the current body of code was defined. 73 59 JSGlobalObject* lexicalGlobalObject() const; 74 60 … … 80 66 81 67 const ScopeChain& scopeChain() const { return m_scopeChain; } 68 void pushScope(JSObject* s) { m_scopeChain.push(s); } 69 void popScope() { m_scopeChain.pop(); } 82 70 void replaceScopeChainTop(JSObject* o) { m_scopeChain.replaceTop(o); } 83 71 … … 85 73 void setVariableObject(JSVariableObject* v) { m_variableObject = v; } 86 74 87 JSObject* thisValue() const { return m_thisVal ; }75 JSObject* thisValue() const { return m_thisValue; } 88 76 89 77 ExecState* callingExecState() { return m_callingExec; } … … 96 84 const List* arguments() const { return m_arguments; } 97 85 98 void pushScope(JSObject* s) { m_scopeChain.push(s); } 99 void popScope() { m_scopeChain.pop(); } 100 LabelStack* seenLabels() { return &ls; } 86 LabelStack& seenLabels() { return m_labelStack; } 101 87 102 88 void pushIteration() { m_iterationDepth++; } … … 178 164 } 179 165 166 static void markActiveExecStates(); 167 static ExecStateStack& activeExecStates(); 168 169 protected: 180 170 ExecState(JSGlobalObject*); 181 171 ExecState(JSGlobalObject*, JSObject* thisObject, ProgramNode*); … … 185 175 ~ExecState(); 186 176 187 static void markActiveExecStates();188 static ExecStateStack& activeExecStates();189 190 private:191 177 // ExecStates are always stack-allocated, and the garbage collector 192 178 // marks the stack, so we don't need to protect the objects below from GC. … … 208 194 ScopeChain m_scopeChain; 209 195 JSVariableObject* m_variableObject; 210 JSObject* m_thisVal ;211 212 LabelStack ls;196 JSObject* m_thisValue; 197 198 LabelStack m_labelStack; 213 199 int m_iterationDepth; 214 200 int m_switchDepth; … … 219 205 }; 220 206 207 class GlobalExecState : public ExecState { 208 public: 209 GlobalExecState(JSGlobalObject*); 210 ~GlobalExecState(); 211 }; 212 213 class InterpreterExecState : public ExecState { 214 public: 215 InterpreterExecState(JSGlobalObject*, JSObject* thisObject, ProgramNode*); 216 ~InterpreterExecState(); 217 }; 218 219 class EvalExecState : public ExecState { 220 public: 221 EvalExecState(JSGlobalObject*, EvalNode*, ExecState* callingExecState); 222 ~EvalExecState(); 223 }; 224 225 class FunctionExecState : public ExecState { 226 public: 227 FunctionExecState(JSGlobalObject*, JSObject* thisObject, FunctionBodyNode*, 228 ExecState* callingExecState, FunctionImp*, const List& args); 229 ~FunctionExecState(); 230 }; 231 221 232 } // namespace KJS 222 233 223 #endif // ExecState_ H234 #endif // ExecState_h
Note:
See TracChangeset
for help on using the changeset viewer.