Changeset 96836 in webkit


Ignore:
Timestamp:
Oct 6, 2011, 11:17:07 AM (14 years ago)
Author:
[email protected]
Message:

Add explicit JSGlobalThis type.
https://bugs.webkit.org/show_bug.cgi?id=69478

Reviewed by Darin Adler.

JSC supports a split global object, as used by WebCore for the Window. As a stage
of making this visible to JSC, make it so that if the global this value is not the
global object itself, it must be a subclass of JSGlobalThis.

Source/JavaScriptCore:

  • API/JSCallbackObjectFunctions.h:

(JSC::::finishCreation):

  • Don't pass the thisValue to JSGlobalObject::finishCreation.
  • JavaScriptCore.xcodeproj/project.pbxproj:
    • Added JSGlobalThis.h
  • jsc.cpp:

(GlobalObject::finishCreation):

  • Don't pass the thisValue to JSGlobalObject::finishCreation.
  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::create):
(JSC::JSGlobalObject::finishCreation):

  • finishCreation takes a JSGlobalThis, or thisValue is implicit.
  • runtime/JSGlobalThis.h: Added.

(JSC::JSGlobalThis::create):
(JSC::JSGlobalThis::JSGlobalThis):
(JSC::JSGlobalThis::finishCreation):

  • Thin wrapper on JSNonFinalObject to allow type checking.
  • testRegExp.cpp:

(GlobalObject::finishCreation):

  • Don't pass the thisValue to JSGlobalObject::finishCreation.

Source/JavaScriptGlue:

  • JSRun.h:

(JSGlueGlobalObject::create):

  • Don't pass the thisValue to JSGlobalObject::finishCreation.

Source/WebCore:

  • ForwardingHeaders/runtime/JSGlobalThis.h: Added.
    • Added forwarding header.
  • bindings/js/JSDOMGlobalObject.cpp:

(WebCore::JSDOMGlobalObject::finishCreation):

  • bindings/js/JSDOMGlobalObject.h:
    • finishCreation takes a JSGlobalThis, or thisValue is implicit.
  • bindings/js/JSDOMWindowShell.h:
    • Make the window shell a subclass of JSGlobalThis.
  • bindings/js/JSWorkerContextBase.cpp:

(WebCore::JSWorkerContextBase::finishCreation):

  • Don't pass the thisValue to JSGlobalObject::finishCreation.
  • bindings/js/JSWorkerContextBase.h:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):

  • Don't pass the thisValue to JSGlobalObject::finishCreation, for worker contexts.
Location:
trunk/Source
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r96673 r96836  
    8080    ASSERT(Parent::inherits(&s_info));
    8181    ASSERT(Parent::isGlobalObject());
    82     Base::finishCreation(globalData, this);
     82    Base::finishCreation(globalData);
    8383    init(static_cast<JSGlobalObject*>(this)->globalExec());
    8484}
  • trunk/Source/JavaScriptCore/ChangeLog

    r96831 r96836  
     12011-10-05  Gavin Barraclough  <[email protected]>
     2
     3        Add explicit JSGlobalThis type.
     4        https://bugs.webkit.org/show_bug.cgi?id=69478
     5
     6        Reviewed by Darin Adler.
     7
     8        JSC supports a split global object, as used by WebCore for the Window. As a stage
     9        of making this visible to JSC, make it so that if the global this value is not the
     10        global object itself, it must be a subclass of JSGlobalThis.
     11
     12        * API/JSCallbackObjectFunctions.h:
     13        (JSC::::finishCreation):
     14            - Don't pass the thisValue to JSGlobalObject::finishCreation.
     15        * JavaScriptCore.xcodeproj/project.pbxproj:
     16            - Added JSGlobalThis.h
     17        * jsc.cpp:
     18        (GlobalObject::finishCreation):
     19            - Don't pass the thisValue to JSGlobalObject::finishCreation.
     20        * runtime/JSGlobalObject.h:
     21        (JSC::JSGlobalObject::create):
     22        (JSC::JSGlobalObject::finishCreation):
     23            - finishCreation takes a JSGlobalThis, or thisValue is implicit.
     24        * runtime/JSGlobalThis.h: Added.
     25        (JSC::JSGlobalThis::create):
     26        (JSC::JSGlobalThis::JSGlobalThis):
     27        (JSC::JSGlobalThis::finishCreation):
     28            - Thin wrapper on JSNonFinalObject to allow type checking.
     29        * testRegExp.cpp:
     30        (GlobalObject::finishCreation):
     31            - Don't pass the thisValue to JSGlobalObject::finishCreation.
     32
    1332011-10-06  Mark Hahnenberg  <[email protected]>
    234
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r96563 r96836  
    284284                860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */; };
    285285                860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */; };
     286                8604F505143CE1C200B295F5 /* JSGlobalThis.h in Headers */ = {isa = PBXBuildFile; fileRef = 8604F503143CE1C100B295F5 /* JSGlobalThis.h */; settings = {ATTRIBUTES = (Private, ); }; };
    286287                8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8626BECE11928E3900782FAB /* StringStatics.cpp */; };
    287288                8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8627E5EA11F1281900A313B5 /* PageAllocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    10541055                860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86Common.h; sourceTree = "<group>"; };
    10551056                8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };
     1057                8604F503143CE1C100B295F5 /* JSGlobalThis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalThis.h; sourceTree = "<group>"; };
    10561058                8626BECE11928E3900782FAB /* StringStatics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringStatics.cpp; path = text/StringStatics.cpp; sourceTree = "<group>"; };
    10571059                8627E5EA11F1281900A313B5 /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
     
    21242126                                BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
    21252127                                BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
     2128                                8604F503143CE1C100B295F5 /* JSGlobalThis.h */,
    21262129                                65EA4C99092AF9E20093D800 /* JSLock.cpp */,
    21272130                                65EA4C9A092AF9E20093D800 /* JSLock.h */,
     
    28742877                                0FE228ED1436AB2700196C48 /* Heuristics.h in Headers */,
    28752878                                0FFF4BB4143955E900655BC0 /* DFGStructureSet.h in Headers */,
     2879                                8604F505143CE1C200B295F5 /* JSGlobalThis.h in Headers */,
    28762880                        );
    28772881                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/jsc.cpp

    r96146 r96836  
    162162    void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
    163163    {
    164         Base::finishCreation(globalData, this);
     164        Base::finishCreation(globalData);
    165165       
    166166        addFunction(globalData, "debug", functionDebug, 1);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r96760 r96836  
    2525#include "JSArray.h"
    2626#include "JSGlobalData.h"
     27#include "JSGlobalThis.h"
    2728#include "JSVariableObject.h"
    2829#include "JSWeakObjectMapRefInternal.h"
     
    144145        {
    145146            JSGlobalObject* globalObject = new (allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);
    146             globalObject->finishCreation(globalData, globalObject);
     147            globalObject->finishCreation(globalData);
    147148            return globalObject;
    148149        }
     
    160161        }
    161162
    162         void finishCreation(JSGlobalData& globalData, JSObject* thisValue)
     163        void finishCreation(JSGlobalData& globalData)
     164        {
     165            Base::finishCreation(globalData);
     166            structure()->setGlobalObject(globalData, this);
     167            init(this);
     168        }
     169
     170        void finishCreation(JSGlobalData& globalData, JSGlobalThis* thisValue)
    163171        {
    164172            Base::finishCreation(globalData);
  • trunk/Source/JavaScriptCore/testRegExp.cpp

    r95901 r96836  
    125125    void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
    126126    {
    127         Base::finishCreation(globalData, this);
     127        Base::finishCreation(globalData);
    128128        UNUSED_PARAM(arguments);
    129129    }
  • trunk/Source/JavaScriptGlue/ChangeLog

    r96465 r96836  
     12011-10-05  Gavin Barraclough  <[email protected]>
     2
     3        Add explicit JSGlobalThis type.
     4        https://bugs.webkit.org/show_bug.cgi?id=69478
     5
     6        Reviewed by Darin Adler.
     7
     8        JSC supports a split global object, as used by WebCore for the Window. As a stage
     9        of making this visible to JSC, make it so that if the global this value is not the
     10        global object itself, it must be a subclass of JSGlobalThis.
     11
     12        * JSRun.h:
     13        (JSGlueGlobalObject::create):
     14            - Don't pass the thisValue to JSGlobalObject::finishCreation.
     15
    1162011-10-01  Geoffrey Garen  <[email protected]>
    217
  • trunk/Source/JavaScriptGlue/JSRun.h

    r95108 r96836  
    4343            Structure* userObjectStructure = UserObjectImp::createStructure(globalData, 0, jsNull());
    4444            JSGlueGlobalObject* object = new (allocateCell<JSGlueGlobalObject>(globalData.heap)) JSGlueGlobalObject(globalData, structure, userObjectStructure, flags);
    45             object->finishCreation(globalData, object);
     45            object->finishCreation(globalData);
    4646            return object;
    4747        }
  • trunk/Source/WebCore/ChangeLog

    r96835 r96836  
     12011-10-05  Gavin Barraclough  <[email protected]>
     2
     3        Add explicit JSGlobalThis type.
     4        https://bugs.webkit.org/show_bug.cgi?id=69478
     5
     6        Reviewed by Darin Adler.
     7
     8        JSC supports a split global object, as used by WebCore for the Window. As a stage
     9        of making this visible to JSC, make it so that if the global this value is not the
     10        global object itself, it must be a subclass of JSGlobalThis.
     11
     12        * ForwardingHeaders/runtime/JSGlobalThis.h: Added.
     13            - Added forwarding header.
     14        * bindings/js/JSDOMGlobalObject.cpp:
     15        (WebCore::JSDOMGlobalObject::finishCreation):
     16        * bindings/js/JSDOMGlobalObject.h:
     17            - finishCreation takes a JSGlobalThis, or thisValue is implicit.
     18        * bindings/js/JSDOMWindowShell.h:
     19            - Make the window shell a subclass of JSGlobalThis.
     20        * bindings/js/JSWorkerContextBase.cpp:
     21        (WebCore::JSWorkerContextBase::finishCreation):
     22            - Don't pass the thisValue to JSGlobalObject::finishCreation.
     23        * bindings/js/JSWorkerContextBase.h:
     24        * bindings/scripts/CodeGeneratorJS.pm:
     25        (GenerateHeader):
     26            - Don't pass the thisValue to JSGlobalObject::finishCreation,
     27              for worker contexts.
     28
    1292011-10-06  Anna Cavender  <[email protected]>
    230
  • trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp

    r96346 r96836  
    5454}
    5555
    56 void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData, JSObject* thisValue)
     56void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData)
     57{
     58    Base::finishCreation(globalData);
     59    ASSERT(inherits(&s_info));
     60}
     61
     62void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData, JSGlobalThis* thisValue)
    5763{
    5864    Base::finishCreation(globalData, thisValue);
  • trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.h

    r96346 r96836  
    2929
    3030#include <runtime/JSGlobalObject.h>
     31#include <runtime/JSGlobalThis.h>
    3132
    3233namespace WebCore {
     
    4950        JSDOMGlobalObject(JSC::JSGlobalData&, JSC::Structure*, PassRefPtr<DOMWrapperWorld>);
    5051        virtual ~JSDOMGlobalObject();
    51         void finishCreation(JSC::JSGlobalData&, JSC::JSObject* thisValue);
     52        void finishCreation(JSC::JSGlobalData&);
     53        void finishCreation(JSC::JSGlobalData&, JSC::JSGlobalThis*);
    5254
    5355    public:
  • trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h

    r96346 r96836  
    3131
    3232#include "JSDOMWindow.h"
     33#include <runtime/JSGlobalThis.h>
    3334
    3435namespace WebCore {
     
    3738    class Frame;
    3839
    39     class JSDOMWindowShell : public JSC::JSNonFinalObject {
    40         typedef JSC::JSNonFinalObject Base;
     40    class JSDOMWindowShell : public JSC::JSGlobalThis {
     41        typedef JSC::JSGlobalThis Base;
    4142    public:
    4243        JSDOMWindowShell(PassRefPtr<DOMWindow>, JSC::Structure*, DOMWrapperWorld*);
  • trunk/Source/WebCore/bindings/js/JSWorkerContextBase.cpp

    r95936 r96836  
    5555}
    5656
    57 void JSWorkerContextBase::finishCreation(JSGlobalData& globalData, JSWorkerContextBase* thisValue)
     57void JSWorkerContextBase::finishCreation(JSGlobalData& globalData)
    5858{
    59     Base::finishCreation(globalData, thisValue);
     59    Base::finishCreation(globalData);
    6060    ASSERT(inherits(&s_info));
    6161}
  • trunk/Source/WebCore/bindings/js/JSWorkerContextBase.h

    r95108 r96836  
    5656    protected:
    5757        JSWorkerContextBase(JSC::JSGlobalData&, JSC::Structure*, PassRefPtr<WorkerContext>);
    58         void finishCreation(JSC::JSGlobalData&, JSWorkerContextBase*);
     58        void finishCreation(JSC::JSGlobalData&);
    5959
    6060    private:
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r96788 r96836  
    739739        push(@headerContent, "    {\n");
    740740        push(@headerContent, "        $className* ptr = new (JSC::allocateCell<$className>(globalData.heap)) ${className}(globalData, structure, impl);\n");
    741         push(@headerContent, "        ptr->finishCreation(globalData, ptr);\n");
     741        push(@headerContent, "        ptr->finishCreation(globalData);\n");
    742742        push(@headerContent, "        return ptr;\n");
    743743        push(@headerContent, "    }\n\n");
Note: See TracChangeset for help on using the changeset viewer.