Ignore:
Timestamp:
Dec 1, 2007, 3:56:56 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Beth Dakin.


Reversed the ownership relationship between Interpreter and JSGlobalObject.
Now, the JSGlobalObject owns the Interpreter, and top-level objects
that need the two to persist just protect the JSGlobalObject from GC.


Global object bootstrapping looks a little odd right now, but it will
make much more sense soon, after further rounds of refactoring.

  • bindings/runtime_root.h: Made this class inherit from RefCounted, to avoid code duplication.
  • kjs/collector.cpp: (KJS::Collector::collect): No need to give special GC treatment to Interpreters, since we mark their global objects, which mark them.
  • kjs/interpreter.cpp: (KJS::Interpreter::mark): No need to mark our global object, since it marks us.
  • kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject owns us directly.
  • kjs/testkjs.cpp: Modified to follow the new rules. (createGlobalObject): (runWithScripts):

JavaScriptGlue:

Reviewed by Beth Dakin.


Modified to follow new JSGlobalObject/Interpreter ownership rules
in JavaScriptCore.

  • JSRun.cpp: (JSRun::JSRun): (JSRun::GetInterpreter): (JSRun::Evaluate): (JSRun::CheckSyntax):
  • JSRun.h:
  • JSValueWrapper.cpp: (unprotectGlobalObject): (initializeGlobalObjectKey): (getThreadGlobalExecState):

WebCore:

Reviewed by Beth Dakin.


Modified WebCore to follow the new JSGlobalObject/Interpreter ownership
rules in JavaScriptCore.

  • bindings/js/kjs_binding.cpp:
  • bindings/js/kjs_binding.h: Removed stale, unused interpreterForGlobalObject().
  • bindings/js/kjs_proxy.cpp: Changed to store a global object, rather than an interpreter. (WebCore::KJSProxy::finishedWithEvent): Need to NULL check m_globalObject here because we no longer unnecessarily instantiate it.
  • bindings/js/kjs_window.cpp: (KJS::ScheduledAction::execute):
  • bindings/js/kjs_window.h: Removed redundant and less efficient interpreter() function -- global objects have direct access to their interpreters now.

Changed these functions to pass around JSGlobalObjects instead of
Interpreters:

  • page/Frame.cpp: (WebCore::Frame::bindingRootObject): (WebCore::Frame::createRootObject):
  • page/Frame.h:
  • page/mac/WebCoreFrameBridge.mm: (createRootObject):
File:
1 edited

Legend:

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

    r28110 r28309  
    257257{
    258258    ASSERT(m_globalObject);
    259     m_globalObject->setInterpreter(this);
     259    m_globalObject->setInterpreter(std::auto_ptr<Interpreter>(this));
    260260
    261261    // Set global object prototype
     
    553553        m_globalExec.exception()->mark();
    554554
    555     if (m_globalObject && !m_globalObject->marked())
    556         m_globalObject->mark();
    557 
    558555    if (m_Object && !m_Object->marked())
    559556        m_Object->mark();
Note: See TracChangeset for help on using the changeset viewer.