Ignore:
Timestamp:
Oct 24, 2007, 11:38:35 PM (18 years ago)
Author:
eseidel
Message:

2007-10-24 Eric Seidel <[email protected]>

Reviewed by Maciej.


Add a JSGlobalObject class and remove the InterpreterMap
http://bugs.webkit.org/show_bug.cgi?id=15681


This required making JSCallbackObject a template class to allow for
JSGlobalObjects with JSCallbackObject functionality.


SunSpider claims this was a 0.5% speedup.

  • API/JSCallbackObject.cpp: (KJS::):
  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp. (KJS::::JSCallbackObject): (KJS::::init): (KJS::::~JSCallbackObject): (KJS::::initializeIfNeeded): (KJS::::className): (KJS::::getOwnPropertySlot): (KJS::::put): (KJS::::deleteProperty): (KJS::::implementsConstruct): (KJS::::construct): (KJS::::implementsHasInstance): (KJS::::hasInstance): (KJS::::implementsCall): (KJS::::callAsFunction): (KJS::::getPropertyNames): (KJS::::toNumber): (KJS::::toString): (KJS::::setPrivate): (KJS::::getPrivate): (KJS::::inherits): (KJS::::cachedValueGetter): (KJS::::staticValueGetter): (KJS::::staticFunctionGetter): (KJS::::callbackGetter):
  • API/JSClassRef.cpp: (OpaqueJSClass::prototype):
  • API/JSContextRef.cpp: (JSGlobalContextCreate):
  • API/JSObjectRef.cpp: (JSObjectMake): (JSObjectGetPrivate): (JSObjectSetPrivate):
  • API/JSValueRef.cpp: (JSValueIsObjectOfClass):
  • JavaScriptCore.exp:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bindings/c/c_utility.cpp: (KJS::Bindings::convertValueToNPVariant):
  • bindings/jni/jni_jsobject.cpp:
  • bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue):
  • kjs/Context.cpp: (KJS::Context::Context):
  • kjs/ExecState.cpp: (KJS::ExecState::lexicalInterpreter):
  • kjs/JSGlobalObject.h: Added. (KJS::JSGlobalObject::JSGlobalObject): (KJS::JSGlobalObject::isGlobalObject): (KJS::JSGlobalObject::interpreter): (KJS::JSGlobalObject::setInterpreter):
  • kjs/array_instance.cpp:
  • kjs/context.h:
  • kjs/function.cpp: (KJS::FunctionImp::callAsFunction): (KJS::GlobalFuncImp::callAsFunction):
  • kjs/interpreter.cpp: (KJS::Interpreter::Interpreter): (KJS::Interpreter::init): (KJS::Interpreter::~Interpreter): (KJS::Interpreter::globalObject): (KJS::Interpreter::initGlobalObject): (KJS::Interpreter::evaluate):
  • kjs/interpreter.h:
  • kjs/lookup.h: (KJS::cacheGlobalObject):
  • kjs/object.h: (KJS::JSObject::isGlobalObject):
  • kjs/testkjs.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/interpreter.h

    r20310 r27022  
    4646  class FunctionObjectImp;
    4747  class FunctionPrototype;
     48  class JSGlobalObject;
    4849  class NativeErrorImp;
    4950  class NativeErrorPrototype;
     
    9596     * @param global The object to use as the global object for this interpreter
    9697     */
    97     Interpreter(JSObject* globalObject);
     98    Interpreter(JSGlobalObject*);
    9899    /**
    99100     * Creates a new interpreter. A global object will be created and
     
    112113     * execution performed by this interpreter
    113114     */
    114     JSObject* globalObject() const;
     115    JSGlobalObject* globalObject() const;
    115116
    116117    /**
     
    301302    void saveBuiltins (SavedBuiltins&) const;
    302303    void restoreBuiltins (const SavedBuiltins&);
    303 
    304     /**
    305      * Determine if the value is a global object (for any interpreter).  This may
    306      * be difficult to determine for multiple uses of JSC in a process that are
    307      * logically independent of each other.  In the case of WebCore, this method
    308      * is used to determine if an object is the Window object so we can perform
    309      * security checks.
    310      */
    311     virtual bool isGlobalObject(JSValue*) { return false; }
    312    
    313     /**
    314      * Find the interpreter for a particular global object.  This should really
    315      * 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 Interpreter
    317      * created in an application to correctly implement this method.  The only
    318      * override of this method is currently in WebCore.
    319      */
    320     virtual Interpreter* interpreterForGlobalObject(const JSValue*) { return 0; }
    321304   
    322305    /**
     
    338321    void setContext(Context* c) { m_context = c; }
    339322    Context* context() const { return m_context; }
    340    
    341     static Interpreter* interpreterWithGlobalObject(JSObject*);
    342    
     323       
    343324    void setTimeoutTime(unsigned timeoutTime) { m_timeoutTime = timeoutTime; }
    344325
     
    389370    unsigned m_ticksUntilNextTimeoutCheck;
    390371
    391     JSObject* m_globalObject;
     372    JSGlobalObject* m_globalObject;
    392373
    393374    ObjectObjectImp* m_Object;
Note: See TracChangeset for help on using the changeset viewer.