JavaScriptCore:
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Dec 2007 23:56:56 +0000 (23:56 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Dec 2007 23:56:56 +0000 (23:56 +0000)
commit2b35fadf40b6bccf4b5e9e3a09f4bc8de1afc875
tree8a8bc0066bceecd4dcca480f10cfecb23390ef68
parent10e5badd74d806d38b1fa2f41070085e08aa5754
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
JavaScriptCore/API/JSContextRef.cpp
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/bindings/jni/jni_jsobject.h
JavaScriptCore/bindings/runtime_root.cpp
JavaScriptCore/bindings/runtime_root.h
JavaScriptCore/kjs/JSGlobalObject.h
JavaScriptCore/kjs/collector.cpp
JavaScriptCore/kjs/interpreter.cpp
JavaScriptCore/kjs/interpreter.h
JavaScriptCore/kjs/testkjs.cpp
JavaScriptGlue/ChangeLog
JavaScriptGlue/JSRun.cpp
JavaScriptGlue/JSRun.h
JavaScriptGlue/JSValueWrapper.cpp
WebCore/ChangeLog
WebCore/bindings/js/kjs_binding.cpp
WebCore/bindings/js/kjs_binding.h
WebCore/bindings/js/kjs_proxy.cpp
WebCore/bindings/js/kjs_proxy.h
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/js/kjs_window.h
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/mac/WebCoreFrameBridge.mm