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.cpp

    r26808 r27022  
    8080    return* map;
    8181}
    82    
    83 Interpreter::Interpreter(JSObject* globalObject)
     82
     83Interpreter::Interpreter(JSGlobalObject* globalObject)
    8484    : m_globalExec(this, 0)
    8585    , m_globalObject(globalObject)
     
    9090Interpreter::Interpreter()
    9191    : m_globalExec(this, 0)
    92     , m_globalObject(new JSObject())
     92    , m_globalObject(new JSGlobalObject())
    9393{
    9494    init();
     
    119119        s_hook = next = prev = this;
    120120    }
    121     interpreterMap().set(m_globalObject, this);
    122121
    123122    initGlobalObject();
     
    138137        s_hook = 0;
    139138    }
    140     interpreterMap().remove(m_globalObject);
    141 }
    142 
    143 JSObject* Interpreter::globalObject() const
    144 {
    145   return m_globalObject;
     139}
     140
     141JSGlobalObject* Interpreter::globalObject() const
     142{
     143    return m_globalObject;
    146144}
    147145
    148146void Interpreter::initGlobalObject()
    149147{
     148    m_globalObject->setInterpreter(this);
     149
    150150    // Clear before inititalizing, to avoid marking uninitialized (dangerous) or
    151151    // stale (wasteful) pointers during initialization.
    152 
     152   
    153153    // Prototypes
    154154    m_FunctionPrototype = 0;
     
    348348    m_recursion++;
    349349   
    350     JSObject* globalObj = m_globalObject;
     350    JSGlobalObject* globalObj = m_globalObject;
    351351    JSObject* thisObj = globalObj;
    352352   
     
    611611}
    612612
    613 Interpreter* Interpreter::interpreterWithGlobalObject(JSObject* globalObject)
    614 {
    615     return interpreterMap().get(globalObject);
    616 }
    617 
    618613#ifdef KJS_DEBUG_MEM
    619614#include "lexer.h"
Note: See TracChangeset for help on using the changeset viewer.