Changeset 96836 in webkit for trunk/Source/JavaScriptCore


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/JavaScriptCore
Files:
1 added
6 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    }
Note: See TracChangeset for help on using the changeset viewer.