Diff
Modified: trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h (96835 => 96836)
--- trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -79,7 +79,7 @@
{
ASSERT(Parent::inherits(&s_info));
ASSERT(Parent::isGlobalObject());
- Base::finishCreation(globalData, this);
+ Base::finishCreation(globalData);
init(static_cast<JSGlobalObject*>(this)->globalExec());
}
Modified: trunk/Source/_javascript_Core/ChangeLog (96835 => 96836)
--- trunk/Source/_javascript_Core/ChangeLog 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-10-06 18:17:07 UTC (rev 96836)
@@ -1,3 +1,35 @@
+2011-10-05 Gavin Barraclough <[email protected]>
+
+ 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.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::finishCreation):
+ - Don't pass the thisValue to JSGlobalObject::finishCreation.
+ * _javascript_Core.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.
+
2011-10-06 Mark Hahnenberg <[email protected]>
JSC objects need to know their own cell size at runtime.
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (96835 => 96836)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-10-06 18:17:07 UTC (rev 96836)
@@ -283,6 +283,7 @@
860161E40F3A83C100F84710 /* MacroAssemblerX86.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */; };
860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */; };
860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */; };
+ 8604F505143CE1C200B295F5 /* JSGlobalThis.h in Headers */ = {isa = PBXBuildFile; fileRef = 8604F503143CE1C100B295F5 /* JSGlobalThis.h */; settings = {ATTRIBUTES = (Private, ); }; };
8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8626BECE11928E3900782FAB /* StringStatics.cpp */; };
8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8627E5EA11F1281900A313B5 /* PageAllocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1053,6 +1054,7 @@
860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86_64.h; sourceTree = "<group>"; };
860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86Common.h; sourceTree = "<group>"; };
8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };
+ 8604F503143CE1C100B295F5 /* JSGlobalThis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalThis.h; sourceTree = "<group>"; };
8626BECE11928E3900782FAB /* StringStatics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringStatics.cpp; path = text/StringStatics.cpp; sourceTree = "<group>"; };
8627E5EA11F1281900A313B5 /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerCodeRef.h; sourceTree = "<group>"; };
@@ -2123,6 +2125,7 @@
A8E894330CD0603F00367179 /* JSGlobalObject.h */,
BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
+ 8604F503143CE1C100B295F5 /* JSGlobalThis.h */,
65EA4C99092AF9E20093D800 /* JSLock.cpp */,
65EA4C9A092AF9E20093D800 /* JSLock.h */,
A72700780DAC605600E548D7 /* JSNotAnObject.cpp */,
@@ -2873,6 +2876,7 @@
86880F1E14328BB900B08D42 /* DFGJITCompilerInlineMethods.h in Headers */,
0FE228ED1436AB2700196C48 /* Heuristics.h in Headers */,
0FFF4BB4143955E900655BC0 /* DFGStructureSet.h in Headers */,
+ 8604F505143CE1C200B295F5 /* JSGlobalThis.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/_javascript_Core/jsc.cpp (96835 => 96836)
--- trunk/Source/_javascript_Core/jsc.cpp 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Core/jsc.cpp 2011-10-06 18:17:07 UTC (rev 96836)
@@ -161,7 +161,7 @@
protected:
void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
{
- Base::finishCreation(globalData, this);
+ Base::finishCreation(globalData);
addFunction(globalData, "debug", functionDebug, 1);
addFunction(globalData, "print", functionPrint, 1);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (96835 => 96836)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -24,6 +24,7 @@
#include "JSArray.h"
#include "JSGlobalData.h"
+#include "JSGlobalThis.h"
#include "JSVariableObject.h"
#include "JSWeakObjectMapRefInternal.h"
#include "NumberPrototype.h"
@@ -143,7 +144,7 @@
static JSGlobalObject* create(JSGlobalData& globalData, Structure* structure)
{
JSGlobalObject* globalObject = new (allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);
- globalObject->finishCreation(globalData, globalObject);
+ globalObject->finishCreation(globalData);
return globalObject;
}
@@ -159,10 +160,17 @@
{
}
- void finishCreation(JSGlobalData& globalData, JSObject* thisValue)
+ void finishCreation(JSGlobalData& globalData)
{
Base::finishCreation(globalData);
structure()->setGlobalObject(globalData, this);
+ init(this);
+ }
+
+ void finishCreation(JSGlobalData& globalData, JSGlobalThis* thisValue)
+ {
+ Base::finishCreation(globalData);
+ structure()->setGlobalObject(globalData, this);
init(thisValue);
}
Added: trunk/Source/_javascript_Core/runtime/JSGlobalThis.h (0 => 96836)
--- trunk/Source/_javascript_Core/runtime/JSGlobalThis.h (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalThis.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSGlobalThis_h
+#define JSGlobalThis_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class JSGlobalThis : public JSNonFinalObject {
+public:
+ typedef JSNonFinalObject Base;
+
+ static JSGlobalThis* create(JSGlobalData& globalData, Structure* structure)
+ {
+ JSGlobalThis* globalThis = new (allocateCell<JSGlobalThis>(globalData.heap)) JSGlobalThis(globalData, structure);
+ globalThis->finishCreation(globalData);
+ return globalThis;
+ }
+
+protected:
+ JSGlobalThis(JSGlobalData& globalData, Structure* structure)
+ : JSNonFinalObject(globalData, structure)
+ {
+ }
+
+ void finishCreation(JSGlobalData& globalData)
+ {
+ Base::finishCreation(globalData);
+ }
+};
+
+}
+
+#endif
Modified: trunk/Source/_javascript_Core/testRegExp.cpp (96835 => 96836)
--- trunk/Source/_javascript_Core/testRegExp.cpp 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Core/testRegExp.cpp 2011-10-06 18:17:07 UTC (rev 96836)
@@ -124,7 +124,7 @@
protected:
void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
{
- Base::finishCreation(globalData, this);
+ Base::finishCreation(globalData);
UNUSED_PARAM(arguments);
}
};
Modified: trunk/Source/_javascript_Glue/ChangeLog (96835 => 96836)
--- trunk/Source/_javascript_Glue/ChangeLog 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Glue/ChangeLog 2011-10-06 18:17:07 UTC (rev 96836)
@@ -1,3 +1,18 @@
+2011-10-05 Gavin Barraclough <[email protected]>
+
+ 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.
+
+ * JSRun.h:
+ (JSGlueGlobalObject::create):
+ - Don't pass the thisValue to JSGlobalObject::finishCreation.
+
2011-10-01 Geoffrey Garen <[email protected]>
Removed redundant helper functions for allocating Strong handles
Modified: trunk/Source/_javascript_Glue/JSRun.h (96835 => 96836)
--- trunk/Source/_javascript_Glue/JSRun.h 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/_javascript_Glue/JSRun.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -42,7 +42,7 @@
{
Structure* userObjectStructure = UserObjectImp::createStructure(globalData, 0, jsNull());
JSGlueGlobalObject* object = new (allocateCell<JSGlueGlobalObject>(globalData.heap)) JSGlueGlobalObject(globalData, structure, userObjectStructure, flags);
- object->finishCreation(globalData, object);
+ object->finishCreation(globalData);
return object;
}
Modified: trunk/Source/WebCore/ChangeLog (96835 => 96836)
--- trunk/Source/WebCore/ChangeLog 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/ChangeLog 2011-10-06 18:17:07 UTC (rev 96836)
@@ -1,3 +1,31 @@
+2011-10-05 Gavin Barraclough <[email protected]>
+
+ 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.
+
+ * 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.
+
2011-10-06 Anna Cavender <[email protected]>
Fix CodeGeneratorV8 for EnabledAtRuntime when class has no parent class.
Added: trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalThis.h (0 => 96836)
--- trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalThis.h (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalThis.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_JSGlobalThis_h
+#define WebCore_FWD_JSGlobalThis_h
+#include <_javascript_Core/JSGlobalThis.h>
+#endif
Modified: trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp (96835 => 96836)
--- trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp 2011-10-06 18:17:07 UTC (rev 96836)
@@ -53,8 +53,14 @@
{
}
-void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData, JSObject* thisValue)
+void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData)
{
+ Base::finishCreation(globalData);
+ ASSERT(inherits(&s_info));
+}
+
+void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData, JSGlobalThis* thisValue)
+{
Base::finishCreation(globalData, thisValue);
ASSERT(inherits(&s_info));
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.h (96835 => 96836)
--- trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.h 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -28,6 +28,7 @@
#define JSDOMGlobalObject_h
#include <runtime/JSGlobalObject.h>
+#include <runtime/JSGlobalThis.h>
namespace WebCore {
@@ -48,7 +49,8 @@
JSDOMGlobalObject(JSC::JSGlobalData&, JSC::Structure*, PassRefPtr<DOMWrapperWorld>);
virtual ~JSDOMGlobalObject();
- void finishCreation(JSC::JSGlobalData&, JSC::JSObject* thisValue);
+ void finishCreation(JSC::JSGlobalData&);
+ void finishCreation(JSC::JSGlobalData&, JSC::JSGlobalThis*);
public:
JSDOMStructureMap& structures() { return m_structures; }
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h (96835 => 96836)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -30,14 +30,15 @@
#define JSDOMWindowShell_h
#include "JSDOMWindow.h"
+#include <runtime/JSGlobalThis.h>
namespace WebCore {
class DOMWindow;
class Frame;
- class JSDOMWindowShell : public JSC::JSNonFinalObject {
- typedef JSC::JSNonFinalObject Base;
+ class JSDOMWindowShell : public JSC::JSGlobalThis {
+ typedef JSC::JSGlobalThis Base;
public:
JSDOMWindowShell(PassRefPtr<DOMWindow>, JSC::Structure*, DOMWrapperWorld*);
virtual ~JSDOMWindowShell();
Modified: trunk/Source/WebCore/bindings/js/JSWorkerContextBase.cpp (96835 => 96836)
--- trunk/Source/WebCore/bindings/js/JSWorkerContextBase.cpp 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/bindings/js/JSWorkerContextBase.cpp 2011-10-06 18:17:07 UTC (rev 96836)
@@ -54,9 +54,9 @@
{
}
-void JSWorkerContextBase::finishCreation(JSGlobalData& globalData, JSWorkerContextBase* thisValue)
+void JSWorkerContextBase::finishCreation(JSGlobalData& globalData)
{
- Base::finishCreation(globalData, thisValue);
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
}
Modified: trunk/Source/WebCore/bindings/js/JSWorkerContextBase.h (96835 => 96836)
--- trunk/Source/WebCore/bindings/js/JSWorkerContextBase.h 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/bindings/js/JSWorkerContextBase.h 2011-10-06 18:17:07 UTC (rev 96836)
@@ -55,7 +55,7 @@
protected:
JSWorkerContextBase(JSC::JSGlobalData&, JSC::Structure*, PassRefPtr<WorkerContext>);
- void finishCreation(JSC::JSGlobalData&, JSWorkerContextBase*);
+ void finishCreation(JSC::JSGlobalData&);
private:
RefPtr<WorkerContext> m_impl;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (96835 => 96836)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-10-06 18:10:08 UTC (rev 96835)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-10-06 18:17:07 UTC (rev 96836)
@@ -738,7 +738,7 @@
push(@headerContent, " static $className* create(JSC::JSGlobalData& globalData, JSC::Structure* structure, PassRefPtr<$implType> impl)\n");
push(@headerContent, " {\n");
push(@headerContent, " $className* ptr = new (JSC::allocateCell<$className>(globalData.heap)) ${className}(globalData, structure, impl);\n");
- push(@headerContent, " ptr->finishCreation(globalData, ptr);\n");
+ push(@headerContent, " ptr->finishCreation(globalData);\n");
push(@headerContent, " return ptr;\n");
push(@headerContent, " }\n\n");
} else {