Changeset 27022 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Oct 24, 2007, 11:38:35 PM (18 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/Context.cpp
r26620 r27022 28 28 29 29 // ECMA 10.2 30 Context::Context(JS Object* glob, Interpreter* interpreter, JSObject* thisV,30 Context::Context(JSGlobalObject* glob, Interpreter* interpreter, JSObject* thisV, 31 31 FunctionBodyNode* currentBody, CodeType type, Context* callingCon, 32 32 FunctionImp* func, const List* args) -
trunk/JavaScriptCore/kjs/ExecState.cpp
r15118 r27022 31 31 Interpreter* ExecState::lexicalInterpreter() const 32 32 { 33 if (!m_context) 33 if (!m_context) 34 return dynamicInterpreter(); 35 36 JSObject* object = m_context->scopeChain().bottom(); 37 if (object && object->isGlobalObject()) 38 return static_cast<JSGlobalObject*>(object)->interpreter(); 39 34 40 return dynamicInterpreter(); 35 36 Interpreter* result = Interpreter::interpreterWithGlobalObject(m_context->scopeChain().bottom());37 38 if (!result)39 return dynamicInterpreter();40 41 return result;42 41 } 43 42 -
trunk/JavaScriptCore/kjs/array_instance.cpp
r26897 r27022 492 492 JSObject *compareFunction; 493 493 List arguments; 494 JS Object *globalObject;494 JSGlobalObject* globalObject; 495 495 }; 496 496 -
trunk/JavaScriptCore/kjs/context.h
r25534 r27022 51 51 class Context { 52 52 public: 53 Context(JS Object* global, Interpreter*, JSObject* thisV,53 Context(JSGlobalObject*, Interpreter*, JSObject* thisV, 54 54 FunctionBodyNode* currentBody, CodeType type = GlobalCode, 55 55 Context* callingContext = 0, FunctionImp* function = 0, const List* args = 0); -
trunk/JavaScriptCore/kjs/function.cpp
r26808 r27022 31 31 #include "function_object.h" 32 32 #include "internal.h" 33 #include "JSGlobalObject.h" 33 34 #include "lexer.h" 34 35 #include "nodes.h" … … 66 67 JSValue* FunctionImp::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) 67 68 { 68 JS Object* globalObj = exec->dynamicInterpreter()->globalObject();69 JSGlobalObject* globalObj = exec->dynamicInterpreter()->globalObject(); 69 70 70 71 // enter a new execution context … … 755 756 return throwError(exec, SyntaxError, errMsg, errLine, sid, NULL); 756 757 757 bool switchGlobal = thisObj && exec->dynamicInterpreter()->isGlobalObject(thisObj) &&thisObj != exec->dynamicInterpreter()->globalObject();758 bool switchGlobal = thisObj && thisObj != exec->dynamicInterpreter()->globalObject(); 758 759 759 760 // enter a new execution context 760 Interpreter* interpreter = switchGlobal ? exec->dynamicInterpreter()->interpreterForGlobalObject(thisObj) : exec->dynamicInterpreter();761 Interpreter* interpreter = switchGlobal ? static_cast<JSGlobalObject*>(thisObj)->interpreter() : exec->dynamicInterpreter(); 761 762 JSObject* thisVal = static_cast<JSObject*>(exec->context()->thisValue()); 762 763 Context ctx(interpreter->globalObject(), -
trunk/JavaScriptCore/kjs/interpreter.cpp
r26808 r27022 80 80 return* map; 81 81 } 82 83 Interpreter::Interpreter(JS Object* globalObject)82 83 Interpreter::Interpreter(JSGlobalObject* globalObject) 84 84 : m_globalExec(this, 0) 85 85 , m_globalObject(globalObject) … … 90 90 Interpreter::Interpreter() 91 91 : m_globalExec(this, 0) 92 , m_globalObject(new JS Object())92 , m_globalObject(new JSGlobalObject()) 93 93 { 94 94 init(); … … 119 119 s_hook = next = prev = this; 120 120 } 121 interpreterMap().set(m_globalObject, this);122 121 123 122 initGlobalObject(); … … 138 137 s_hook = 0; 139 138 } 140 interpreterMap().remove(m_globalObject); 141 } 142 143 JSObject* Interpreter::globalObject() const 144 { 145 return m_globalObject; 139 } 140 141 JSGlobalObject* Interpreter::globalObject() const 142 { 143 return m_globalObject; 146 144 } 147 145 148 146 void Interpreter::initGlobalObject() 149 147 { 148 m_globalObject->setInterpreter(this); 149 150 150 // Clear before inititalizing, to avoid marking uninitialized (dangerous) or 151 151 // stale (wasteful) pointers during initialization. 152 152 153 153 // Prototypes 154 154 m_FunctionPrototype = 0; … … 348 348 m_recursion++; 349 349 350 JS Object* globalObj = m_globalObject;350 JSGlobalObject* globalObj = m_globalObject; 351 351 JSObject* thisObj = globalObj; 352 352 … … 611 611 } 612 612 613 Interpreter* Interpreter::interpreterWithGlobalObject(JSObject* globalObject)614 {615 return interpreterMap().get(globalObject);616 }617 618 613 #ifdef KJS_DEBUG_MEM 619 614 #include "lexer.h" -
trunk/JavaScriptCore/kjs/interpreter.h
r20310 r27022 46 46 class FunctionObjectImp; 47 47 class FunctionPrototype; 48 class JSGlobalObject; 48 49 class NativeErrorImp; 49 50 class NativeErrorPrototype; … … 95 96 * @param global The object to use as the global object for this interpreter 96 97 */ 97 Interpreter(JS Object* globalObject);98 Interpreter(JSGlobalObject*); 98 99 /** 99 100 * Creates a new interpreter. A global object will be created and … … 112 113 * execution performed by this interpreter 113 114 */ 114 JS Object* globalObject() const;115 JSGlobalObject* globalObject() const; 115 116 116 117 /** … … 301 302 void saveBuiltins (SavedBuiltins&) const; 302 303 void restoreBuiltins (const SavedBuiltins&); 303 304 /**305 * Determine if the value is a global object (for any interpreter). This may306 * be difficult to determine for multiple uses of JSC in a process that are307 * logically independent of each other. In the case of WebCore, this method308 * is used to determine if an object is the Window object so we can perform309 * security checks.310 */311 virtual bool isGlobalObject(JSValue*) { return false; }312 313 /**314 * Find the interpreter for a particular global object. This should really315 * be a static method, but we can't do that is C++. Again, as with isGlobalObject()316 * implementation really need to know about all instances of Interpreter317 * created in an application to correctly implement this method. The only318 * override of this method is currently in WebCore.319 */320 virtual Interpreter* interpreterForGlobalObject(const JSValue*) { return 0; }321 304 322 305 /** … … 338 321 void setContext(Context* c) { m_context = c; } 339 322 Context* context() const { return m_context; } 340 341 static Interpreter* interpreterWithGlobalObject(JSObject*); 342 323 343 324 void setTimeoutTime(unsigned timeoutTime) { m_timeoutTime = timeoutTime; } 344 325 … … 389 370 unsigned m_ticksUntilNextTimeoutCheck; 390 371 391 JS Object* m_globalObject;372 JSGlobalObject* m_globalObject; 392 373 393 374 ObjectObjectImp* m_Object; -
trunk/JavaScriptCore/kjs/lookup.h
r26956 r27022 20 20 */ 21 21 22 #ifndef _KJSLOOKUP_H_23 #define _KJSLOOKUP_H_22 #ifndef KJS_lookup_h 23 #define KJS_lookup_h 24 24 25 25 #include "context.h" 26 26 #include "identifier.h" 27 27 #include "interpreter.h" 28 #include "JSGlobalObject.h" 28 29 #include "object.h" 29 30 #include <stdio.h> … … 270 271 inline JSObject* cacheGlobalObject(ExecState* exec, const Identifier& propertyName) 271 272 { 272 JS Object* globalObject = static_cast<JSObject*>(exec->lexicalInterpreter()->globalObject());273 JSGlobalObject* globalObject = exec->lexicalInterpreter()->globalObject(); 273 274 JSValue* obj = globalObject->getDirect(propertyName); 274 275 if (obj) { … … 352 353 }; 353 354 354 #endif 355 #endif // KJS_lookup_h -
trunk/JavaScriptCore/kjs/object.h
r26688 r27022 458 458 459 459 virtual bool isActivation() { return false; } 460 virtual bool isGlobalObject() const { return false; } 460 461 protected: 461 462 PropertyMap _prop; -
trunk/JavaScriptCore/kjs/testkjs.cpp
r26783 r27022 27 27 #include "Parser.h" 28 28 #include "collector.h" 29 #include "JSGlobalObject.h" 29 30 #include "object.h" 30 31 #include "protect.h" … … 111 112 } 112 113 113 class GlobalImp : public JS Object {114 class GlobalImp : public JSGlobalObject { 114 115 public: 115 116 virtual UString className() const { return "global"; }
Note:
See TracChangeset
for help on using the changeset viewer.