Diff
Modified: trunk/JSTests/ChangeLog (207649 => 207650)
--- trunk/JSTests/ChangeLog 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/JSTests/ChangeLog 2016-10-21 01:19:24 UTC (rev 207650)
@@ -1,3 +1,29 @@
+2016-10-20 JF Bastien <[email protected]>
+
+ WebAssembly API: implement exception constructors properly
+
+ - Rename WebAssemblyObject to JSWebAssembly for consistency.
+ - WebAssembly object now has its own prototype: add WebAssemblyPrototype, and
+ use it to register JSWebAssembly's function properties through auto-generated
+ .lut.h, instead of manually.
+ - The error constructors used to throw (e.g. `new WebAssembly.CompileError()`).
+ - Register WebAssembly's constructors from the global object, and hold a
+ reference to their structure and prototype so that invoking the constructor
+ can use the structure directly from the global object.
+ - Add a prototype base field to global object creation. Previous ones all had
+ Object's prototype as their base, but WebAssembly's error constructors have
+ Error as their base.
+ - Test for the error object's correctness.
+ - Add missing #if ENABLE(WEBASSEMBLY)
+
+ WebAssembly API: implement exception constructors properly
+ https://bugs.webkit.org/show_bug.cgi?id=163699
+
+ Reviewed by Keith Miller.
+
+ * wasm/js-api/test_basic_api.js:
+ (const.c.in.constructorProperties): more tests
+
2016-10-20 Caitlin Potter <[email protected]>
[JSC] disallow references to `await` in AsyncFunction formal parameters
Modified: trunk/JSTests/wasm/js-api/test_basic_api.js (207649 => 207650)
--- trunk/JSTests/wasm/js-api/test_basic_api.js 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/JSTests/wasm/js-api/test_basic_api.js 2016-10-21 01:19:24 UTC (rev 207650)
@@ -27,6 +27,9 @@
checkOwnPropertyDescriptor(utilities.global, "WebAssembly", { typeofvalue: "object", writable: true, configurable: true, enumerable: false });
assert.eq(String(WebAssembly), "[object WebAssembly]");
assert.isUndef(WebAssembly.length);
+assert.eq(WebAssembly instanceof Object, true);
+assert.throws(() => WebAssembly(), TypeError, `WebAssembly is not a function. (In 'WebAssembly()', 'WebAssembly' is an instance of WebAssembly)`);
+assert.throws(() => new WebAssembly(), TypeError, `WebAssembly is not a constructor (evaluating 'new WebAssembly()')`);
for (const f in functionProperties) {
assert.notUndef(WebAssembly[f]);
@@ -39,10 +42,19 @@
assert.eq(WebAssembly[c].name, c);
assert.eq(WebAssembly[c].length, constructorProperties[c].length);
checkOwnPropertyDescriptor(WebAssembly, c, constructorProperties[c]);
- // Check the constructor's prototype.
checkOwnPropertyDescriptor(WebAssembly[c], "prototype", { typeofvalue: "object", writable: false, configurable: false, enumerable: false });
- assert.eq(String(WebAssembly[c].prototype), `[object WebAssembly.${c}.prototype]`);
assert.throws(() => WebAssembly[c](), TypeError, `calling WebAssembly.${c} constructor without new is invalid`);
+ if (constructorProperties[c].isError) {
+ const e = new WebAssembly[c];
+ assert.eq(e instanceof WebAssembly[c], true);
+ assert.eq(e instanceof Error, true);
+ assert.eq(e instanceof TypeError, false);
+ assert.eq(e.message, "");
+ assert.eq(typeof e.stack, "string");
+ const sillyString = "uh-oh!";
+ const e2 = new WebAssembly[c](sillyString);
+ assert.eq(e2.message, sillyString);
+ }
}
// FIXME Implement and test these APIs further. For now they just throw. https://bugs.webkit.org/show_bug.cgi?id=159775
@@ -51,5 +63,7 @@
assert.throws(() => WebAssembly[f](), Error, `WebAssembly doesn't yet implement the ${f} function property`);
}
-for (const c in constructorProperties)
- assert.throws(() => new WebAssembly[c](), Error, `WebAssembly doesn't yet implement the ${c} constructor property`);
+for (const c in constructorProperties) {
+ if (!constructorProperties[c].isError)
+ assert.throws(() => new WebAssembly[c](), Error, `WebAssembly doesn't yet implement the ${c} constructor property`);
+}
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (207649 => 207650)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2016-10-21 01:19:24 UTC (rev 207650)
@@ -861,12 +861,12 @@
tools/JSDollarVMPrototype.cpp
wasm/JSWASMModule.cpp
+ wasm/JSWebAssembly.cpp
wasm/WASMB3IRGenerator.cpp
wasm/WASMCallingConvention.cpp
wasm/WASMMemory.cpp
wasm/WASMModuleParser.cpp
wasm/WASMPlan.cpp
- wasm/WebAssemblyObject.cpp
wasm/js/JSWebAssemblyCompileError.cpp
wasm/js/JSWebAssemblyInstance.cpp
@@ -882,6 +882,7 @@
wasm/js/WebAssemblyMemoryPrototype.cpp
wasm/js/WebAssemblyModuleConstructor.cpp
wasm/js/WebAssemblyModulePrototype.cpp
+ wasm/js/WebAssemblyPrototype.cpp
wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
wasm/js/WebAssemblyRuntimeErrorPrototype.cpp
wasm/js/WebAssemblyTableConstructor.cpp
@@ -946,6 +947,7 @@
wasm/js/WebAssemblyMemoryPrototype.cpp
wasm/js/WebAssemblyModuleConstructor.cpp
wasm/js/WebAssemblyModulePrototype.cpp
+ wasm/js/WebAssemblyPrototype.cpp
wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
wasm/js/WebAssemblyRuntimeErrorPrototype.cpp
wasm/js/WebAssemblyTableConstructor.cpp
Modified: trunk/Source/_javascript_Core/ChangeLog (207649 => 207650)
--- trunk/Source/_javascript_Core/ChangeLog 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-10-21 01:19:24 UTC (rev 207650)
@@ -1,3 +1,91 @@
+2016-10-20 JF Bastien <[email protected]>
+
+ WebAssembly API: implement exception constructors properly
+
+ - Rename WebAssemblyObject to JSWebAssembly for consistency.
+ - WebAssembly object now has its own prototype: add WebAssemblyPrototype, and
+ use it to register JSWebAssembly's function properties through auto-generated
+ .lut.h, instead of manually.
+ - The error constructors used to throw (e.g. `new WebAssembly.CompileError()`).
+ - Register WebAssembly's constructors from the global object, and hold a
+ reference to their structure and prototype so that invoking the constructor
+ can use the structure directly from the global object.
+ - Add a prototype base field to global object creation. Previous ones all had
+ Object's prototype as their base, but WebAssembly's error constructors have
+ Error as their base.
+ - Test for the error object's correctness.
+ - Add missing #if ENABLE(WEBASSEMBLY)
+
+ WebAssembly API: implement exception constructors properly
+ https://bugs.webkit.org/show_bug.cgi?id=163699
+
+ Reviewed by Keith Miller.
+
+ * CMakeLists.txt: rename WebAssemblyObject -> JSWebAssembly; add a .lut.h file
+ * DerivedSources.make: new .lut.h file
+ * _javascript_Core.xcodeproj/project.pbxproj: ditto
+ * runtime/JSGlobalObject.cpp: new prototypeBase macro
+ (JSC::JSGlobalObject::init): register WebAssembly constructors here
+ (JSC::JSGlobalObject::visitChildren): use the macro to visit
+ * runtime/JSGlobalObject.h: declare the WebAssembly constructor macro
+ * wasm/JSWebAssembly.cpp: Copied from Source/_javascript_Core/wasm/WebAssemblyObject.h.
+ (JSC::JSWebAssembly::create):
+ (JSC::JSWebAssembly::createStructure):
+ (JSC::JSWebAssembly::finishCreation):
+ (JSC::JSWebAssembly::JSWebAssembly):
+ * wasm/JSWebAssembly.h: Renamed from Source/_javascript_Core/wasm/WebAssemblyObject.h.
+ * wasm/WebAssemblyObject.cpp: Removed.
+ * wasm/js/JSWebAssemblyCompileError.cpp:
+ * wasm/js/JSWebAssemblyCompileError.h:
+ (JSC::JSWebAssemblyCompileError::create): string convenience
+ * wasm/js/JSWebAssemblyInstance.cpp:
+ * wasm/js/JSWebAssemblyInstance.h:
+ * wasm/js/JSWebAssemblyMemory.cpp:
+ * wasm/js/JSWebAssemblyMemory.h:
+ * wasm/js/JSWebAssemblyModule.cpp:
+ * wasm/js/JSWebAssemblyModule.h:
+ * wasm/js/JSWebAssemblyRuntimeError.cpp:
+ * wasm/js/JSWebAssemblyRuntimeError.h:
+ (JSC::JSWebAssemblyRuntimeError::create): string convenience
+ * wasm/js/JSWebAssemblyTable.cpp:
+ * wasm/js/JSWebAssemblyTable.h:
+ * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
+ (JSC::constructJSWebAssemblyCompileError):don't throw, create the object
+ (JSC::WebAssemblyCompileErrorConstructor::finishCreation):no need for the structure, it's on the global object
+ * wasm/js/WebAssemblyCompileErrorConstructor.h:
+ * wasm/js/WebAssemblyCompileErrorPrototype.cpp:
+ * wasm/js/WebAssemblyCompileErrorPrototype.h:
+ * wasm/js/WebAssemblyInstanceConstructor.cpp:
+ * wasm/js/WebAssemblyInstanceConstructor.h:
+ * wasm/js/WebAssemblyInstancePrototype.cpp:
+ * wasm/js/WebAssemblyInstancePrototype.h:
+ * wasm/js/WebAssemblyMemoryConstructor.cpp:
+ * wasm/js/WebAssemblyMemoryConstructor.h:
+ * wasm/js/WebAssemblyMemoryPrototype.cpp:
+ * wasm/js/WebAssemblyMemoryPrototype.h:
+ * wasm/js/WebAssemblyModuleConstructor.cpp:
+ * wasm/js/WebAssemblyModuleConstructor.h:
+ * wasm/js/WebAssemblyModulePrototype.cpp:
+ * wasm/js/WebAssemblyModulePrototype.h:
+ * wasm/js/WebAssemblyPrototype.cpp: Copied from Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.cpp.
+ (JSC::webAssemblyFunctionValidate):
+ (JSC::webAssemblyFunctionCompile):
+ (JSC::WebAssemblyPrototype::create):
+ (JSC::WebAssemblyPrototype::createStructure):
+ (JSC::WebAssemblyPrototype::finishCreation):
+ (JSC::WebAssemblyPrototype::WebAssemblyPrototype):
+ * wasm/js/WebAssemblyPrototype.h: Copied from Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.h.
+ * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
+ (JSC::constructJSWebAssemblyRuntimeError):don't throw, create the object
+ (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation):no need for the structure, it's on the global object
+ * wasm/js/WebAssemblyRuntimeErrorConstructor.h:
+ * wasm/js/WebAssemblyRuntimeErrorPrototype.cpp:
+ * wasm/js/WebAssemblyRuntimeErrorPrototype.h:
+ * wasm/js/WebAssemblyTableConstructor.cpp:
+ * wasm/js/WebAssemblyTableConstructor.h:
+ * wasm/js/WebAssemblyTablePrototype.cpp:
+ * wasm/js/WebAssemblyTablePrototype.h:
+
2016-10-19 Myles C. Maxfield <[email protected]>
[macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9
Modified: trunk/Source/_javascript_Core/DerivedSources.make (207649 => 207650)
--- trunk/Source/_javascript_Core/DerivedSources.make 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/DerivedSources.make 2016-10-21 01:19:24 UTC (rev 207650)
@@ -168,6 +168,7 @@
WebAssemblyMemoryPrototype.lut.h \
WebAssemblyModuleConstructor.lut.h \
WebAssemblyModulePrototype.lut.h \
+ WebAssemblyPrototype.lut.h \
WebAssemblyRuntimeErrorConstructor.lut.h \
WebAssemblyRuntimeErrorPrototype.lut.h \
WebAssemblyTableConstructor.lut.h \
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (207649 => 207650)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-10-21 01:19:24 UTC (rev 207650)
@@ -1879,8 +1879,6 @@
A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7FCC26D17A0B6AA00786D1A /* FTLSwitchCase.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FCC26C17A0B6AA00786D1A /* FTLSwitchCase.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8A4748E151A8306004123FF /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A8A4748D151A8306004123FF /* libWTF.a */; };
- AD2FCB881DAEBF3C00B3E736 /* WebAssemblyObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCB861DAEBF3700B3E736 /* WebAssemblyObject.cpp */; };
- AD2FCB891DAEBF3F00B3E736 /* WebAssemblyObject.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCB871DAEBF3700B3E736 /* WebAssemblyObject.h */; };
AD2FCBE21DB58DAD00B3E736 /* JSWebAssemblyCompileError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCBA61DB58DA400B3E736 /* JSWebAssemblyCompileError.cpp */; };
AD2FCBE31DB58DAD00B3E736 /* JSWebAssemblyCompileError.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCBA71DB58DA400B3E736 /* JSWebAssemblyCompileError.h */; };
AD2FCBE41DB58DAD00B3E736 /* JSWebAssemblyInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCBA81DB58DA400B3E736 /* JSWebAssemblyInstance.cpp */; };
@@ -1929,6 +1927,10 @@
AD2FCC1F1DB59CB200B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC131DB59C5900B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h */; };
AD2FCC201DB59CB200B3E736 /* WebAssemblyTableConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */; };
AD2FCC211DB59CB200B3E736 /* WebAssemblyTablePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */; };
+ AD2FCC2C1DB838FD00B3E736 /* WebAssemblyPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */; };
+ AD2FCC2D1DB838FD00B3E736 /* WebAssemblyPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */; };
+ AD2FCC301DB83D4900B3E736 /* JSWebAssembly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCC2E1DB839F700B3E736 /* JSWebAssembly.cpp */; };
+ AD2FCC311DB83D4900B3E736 /* JSWebAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC2F1DB839F700B3E736 /* JSWebAssembly.h */; };
AD86A93E1AA4D88D002FE77F /* WeakGCMapInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = AD86A93D1AA4D87C002FE77F /* WeakGCMapInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
ADDB1F6318D77DBE009B58A8 /* OpaqueRootSet.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
ADE39FFF16DD144B0003CD4A /* PropertyTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */; };
@@ -4259,8 +4261,6 @@
A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyTable.cpp; sourceTree = "<group>"; };
- AD2FCB861DAEBF3700B3E736 /* WebAssemblyObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebAssemblyObject.cpp; sourceTree = "<group>"; };
- AD2FCB871DAEBF3700B3E736 /* WebAssemblyObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyObject.h; sourceTree = "<group>"; };
AD2FCB8C1DB5844000B3E736 /* JSWebAssemblyModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyModule.cpp; path = js/JSWebAssemblyModule.cpp; sourceTree = "<group>"; };
AD2FCB8D1DB5844000B3E736 /* JSWebAssemblyModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyModule.h; path = js/JSWebAssemblyModule.h; sourceTree = "<group>"; };
AD2FCB981DB585A600B3E736 /* WebAssemblyModuleConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyModuleConstructor.cpp; path = js/WebAssemblyModuleConstructor.cpp; sourceTree = "<group>"; };
@@ -4309,6 +4309,10 @@
AD2FCC131DB59C5900B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyRuntimeErrorPrototype.lut.h; sourceTree = "<group>"; };
AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyTableConstructor.lut.h; sourceTree = "<group>"; };
AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyTablePrototype.lut.h; sourceTree = "<group>"; };
+ AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyPrototype.cpp; path = js/WebAssemblyPrototype.cpp; sourceTree = "<group>"; };
+ AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyPrototype.h; path = js/WebAssemblyPrototype.h; sourceTree = "<group>"; };
+ AD2FCC2E1DB839F700B3E736 /* JSWebAssembly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebAssembly.cpp; sourceTree = "<group>"; };
+ AD2FCC2F1DB839F700B3E736 /* JSWebAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebAssembly.h; sourceTree = "<group>"; };
AD86A93D1AA4D87C002FE77F /* WeakGCMapInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMapInlines.h; sourceTree = "<group>"; };
ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpaqueRootSet.h; sourceTree = "<group>"; };
B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedInstructionStream.h; sourceTree = "<group>"; };
@@ -5803,9 +5807,9 @@
7B98D1331B60CD1E0023B1A4 /* wasm */ = {
isa = PBXGroup;
children = (
+ AD2FCC2E1DB839F700B3E736 /* JSWebAssembly.cpp */,
+ AD2FCC2F1DB839F700B3E736 /* JSWebAssembly.h */,
AD2FCB8A1DB5840000B3E736 /* js */,
- AD2FCB861DAEBF3700B3E736 /* WebAssemblyObject.cpp */,
- AD2FCB871DAEBF3700B3E736 /* WebAssemblyObject.h */,
7B98D1341B60CD5A0023B1A4 /* JSWASMModule.cpp */,
7B98D1351B60CD5A0023B1A4 /* JSWASMModule.h */,
53F40E8E1D5902820099A1B6 /* WASMB3IRGenerator.cpp */,
@@ -7312,6 +7316,8 @@
AD2FCB8A1DB5840000B3E736 /* js */ = {
isa = PBXGroup;
children = (
+ AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */,
+ AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */,
AD2FCBA61DB58DA400B3E736 /* JSWebAssemblyCompileError.cpp */,
AD2FCBA71DB58DA400B3E736 /* JSWebAssemblyCompileError.h */,
AD2FCBA81DB58DA400B3E736 /* JSWebAssemblyInstance.cpp */,
@@ -7615,7 +7621,6 @@
0FC97F34182020D7002C9B26 /* CodeBlockJettisoningWatchpoint.h in Headers */,
0FD8A31417D4326C00CA2C40 /* CodeBlockSet.h in Headers */,
0F96EBB316676EF6008BADE3 /* CodeBlockWithJITType.h in Headers */,
- AD2FCB891DAEBF3F00B3E736 /* WebAssemblyObject.h in Headers */,
A77F1822164088B200640A47 /* CodeCache.h in Headers */,
99CC0B6318BE9950006CEBCC /* CodeGeneratorReplayInputs.py in Headers */,
99CC0B6218BE9946006CEBCC /* CodeGeneratorReplayInputsTemplates.py in Headers */,
@@ -7739,6 +7744,7 @@
A7D89CF617A0B8CC00773AD8 /* DFGCriticalEdgeBreakingPhase.h in Headers */,
0FFFC95A14EF90A900C72532 /* DFGCSEPhase.h in Headers */,
0F2FC77316E12F740038D976 /* DFGDCEPhase.h in Headers */,
+ AD2FCC311DB83D4900B3E736 /* JSWebAssembly.h in Headers */,
0F8F2B9A172F0501007DBDA5 /* DFGDesiredIdentifiers.h in Headers */,
8B9F6D561D5912FA001C739F /* IterationKind.h in Headers */,
0FFC92141B94E83E0071DD66 /* DFGDesiredInferredType.h in Headers */,
@@ -8510,6 +8516,7 @@
A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
A5BA15F0182345AF00A82E69 /* RemoteInspectionTarget.h in Headers */,
A5BA15EB182340B400A82E69 /* RemoteConnectionToTarget.h in Headers */,
+ AD2FCC2D1DB838FD00B3E736 /* WebAssemblyPrototype.h in Headers */,
A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
DC2143071CA32E55000A8869 /* ICStats.h in Headers */,
@@ -9450,6 +9457,7 @@
0F8F14351ADF090100ED792C /* DFGMovHintRemovalPhase.cpp in Sources */,
0FF2CD5B1B61A4F8004955A8 /* DFGMultiGetByOffsetData.cpp in Sources */,
A737810D1799EA2E00817533 /* DFGNaturalLoops.cpp in Sources */,
+ AD2FCC301DB83D4900B3E736 /* JSWebAssembly.cpp in Sources */,
79B00CBE1C6AB07E0088C65D /* ProxyObject.cpp in Sources */,
792CB3491C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp in Sources */,
0FF0F19C16B72A03005DF95B /* DFGNode.cpp in Sources */,
@@ -9717,6 +9725,7 @@
147F39D6107EC37600427A48 /* JSCJSValue.cpp in Sources */,
1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */,
86E3C616167BABEE006D760A /* JSContext.mm in Sources */,
+ AD2FCC2C1DB838FD00B3E736 /* WebAssemblyPrototype.cpp in Sources */,
14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */,
A72028B61797601E0098028C /* JSCTestRunnerUtils.cpp in Sources */,
0F2B66EB17B6B5AB00A7AE3F /* JSDataView.cpp in Sources */,
@@ -9938,7 +9947,6 @@
7905BB681D12050E0019FE57 /* InlineAccess.cpp in Sources */,
0FE050271AA9095600D33B33 /* ScopedArguments.cpp in Sources */,
0FE0502F1AAA806900D33B33 /* ScopedArgumentsTable.cpp in Sources */,
- AD2FCB881DAEBF3C00B3E736 /* WebAssemblyObject.cpp in Sources */,
992ABCF91BEA9BD2006403A0 /* RemoteAutomationTarget.cpp in Sources */,
0FE0502A1AA9095600D33B33 /* ScopeOffset.cpp in Sources */,
0FA7A8EE18CE4FD80052371D /* ScratchRegisterAllocator.cpp in Sources */,
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -108,6 +108,7 @@
#include "JSTypedArrays.h"
#include "JSWeakMap.h"
#include "JSWeakSet.h"
+#include "JSWebAssembly.h"
#include "JSWithScope.h"
#include "LazyClassStructureInlines.h"
#include "LazyPropertyInlines.h"
@@ -154,7 +155,6 @@
#include "WeakMapPrototype.h"
#include "WeakSetConstructor.h"
#include "WeakSetPrototype.h"
-#include "WebAssemblyObject.h"
#include <wtf/RandomNumber.h>
#if ENABLE(INTL)
@@ -541,8 +541,8 @@
m_parseIntFunction.set(vm, this, JSFunction::create(vm, this, 2, vm.propertyNames->parseInt.string(), globalFuncParseInt, NoIntrinsic));
putDirectWithoutTransition(vm, vm.propertyNames->parseInt, m_parseIntFunction.get(), DontEnum);
-#define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
-m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_objectPrototype.get()))); \
+#define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
+m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_ ## prototypeBase ## Prototype.get()))); \
m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, this, m_ ## lowerName ## Prototype.get()));
FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
@@ -549,10 +549,10 @@
#undef CREATE_PROTOTYPE_FOR_SIMPLE_TYPE
-#define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
m_ ## properName ## Structure.initLater(\
[] (LazyClassStructure::Initializer& init) { \
- init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->m_objectPrototype.get()))); \
+ init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->m_ ## prototypeBase ## Prototype.get()))); \
init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \
init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->m_functionPrototype.get()), jsCast<capitalName ## Prototype*>(init.prototype), init.global->m_speciesGetterSetter.get())); \
});
@@ -563,7 +563,7 @@
m_iteratorPrototype.set(vm, this, IteratorPrototype::create(vm, this, IteratorPrototype::createStructure(vm, this, m_objectPrototype.get())));
-#define CREATE_PROTOTYPE_FOR_DERIVED_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define CREATE_PROTOTYPE_FOR_DERIVED_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
m_ ## lowerName ## Structure.initLater( \
[] (const Initializer<Structure>& init) { \
JSObject* prototype = capitalName ## Prototype::create(init.vm, init.owner, capitalName ## Prototype::createStructure(init.vm, init.owner, init.owner->m_iteratorPrototype.get())); \
@@ -590,7 +590,7 @@
m_regExpConstructor.set(vm, this, RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get(), m_speciesGetterSetter.get()));
-#define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), m_speciesGetterSetter.get()); \
m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, DontEnum); \
@@ -646,7 +646,7 @@
putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().ObjectPrivateName(), objectConstructor, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().ArrayPrivateName(), arrayConstructor, DontEnum | DontDelete | ReadOnly);
-#define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Constructor, DontEnum); \
FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)
@@ -820,14 +820,28 @@
#if ENABLE(WEBASSEMBLY)
if (Options::useWebAssembly()) {
- auto* wasm = WebAssemblyObject::create(vm, this, WebAssemblyObject::createStructure(vm, this, m_objectPrototype.get()));
- putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), wasm, DontEnum);
- GlobalPropertyInfo extraStaticGlobals[] = {
-#define REGISTER_WASM_CONSTRUCTOR_AS_GLOBAL_PROPERTY(NAME, ...) \
- GlobalPropertyInfo(vm.propertyNames->builtinNames().NAME ## PrivateName(), wasm->getDirect(vm, Identifier::fromString(exec, #NAME)), DontEnum | DontDelete | ReadOnly),
- FOR_EACH_WASM_CONSTRUCTOR_PROPERTY(REGISTER_WASM_CONSTRUCTOR_AS_GLOBAL_PROPERTY)
- };
- addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals));
+ auto* webAssemblyPrototype = WebAssemblyPrototype::create(vm, this, WebAssemblyPrototype::createStructure(vm, this, m_objectPrototype.get()));
+ m_webAssemblyStructure.set(vm, this, JSWebAssembly::createStructure(vm, this, webAssemblyPrototype));
+ auto* webAssembly = JSWebAssembly::create(vm, this, m_webAssemblyStructure.get());
+ putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), webAssembly, DontEnum);
+
+#define CREATE_WEBASSEMBLY_CONSTRUCTOR(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) do { \
+ typedef capitalName ## Prototype Prototype; \
+ typedef capitalName ## Constructor Constructor; \
+ typedef JS ## capitalName JSObj; \
+ auto* base = m_ ## prototypeBase ## Prototype.get(); \
+ auto* prototype = Prototype::create(vm, this, Prototype::createStructure(vm, this, base)); \
+ auto* structure = JSObj::createStructure(vm, this, prototype); \
+ auto* constructor = Constructor::create(vm, Constructor::createStructure(vm, this, this->functionPrototype()), prototype, structure); \
+ prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, constructor, DontEnum); \
+ m_ ## lowerName ## Prototype.set(vm, this, prototype); \
+ m_ ## properName ## Structure.set(vm, this, structure); \
+ webAssembly->putDirectWithoutTransition(vm, Identifier::fromString(this->globalExec(), #jsName), constructor, DontEnum); \
+ } while (0);
+
+ FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(CREATE_WEBASSEMBLY_CONSTRUCTOR)
+
+#undef CREATE_WEBASSEMBLY_CONSTRUCTOR
}
#endif // ENABLE(WEBASSEMBLY)
@@ -1142,15 +1156,20 @@
visitor.append(&thisObject->m_proxyRevokeStructure);
visitor.append(&thisObject->m_moduleLoaderStructure);
-#define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName) \
+#define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
visitor.append(&thisObject->m_ ## lowerName ## Prototype); \
visitor.append(&thisObject->m_ ## properName ## Structure); \
FOR_EACH_SIMPLE_BUILTIN_TYPE(VISIT_SIMPLE_TYPE)
+
+#if ENABLE(WEBASSEMBLY)
+ visitor.append(&thisObject->m_webAssemblyStructure);
+ FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(VISIT_SIMPLE_TYPE)
+#endif // ENABLE(WEBASSEMBLY)
#undef VISIT_SIMPLE_TYPE
-#define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName) \
+#define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
thisObject->m_ ## properName ## Structure.visit(visitor);
FOR_EACH_LAZY_BUILTIN_TYPE(VISIT_LAZY_TYPE)
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (207649 => 207650)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -95,16 +95,16 @@
struct ActivationStackNode;
struct HashTable;
-#define DEFINE_STANDARD_BUILTIN(macro, upperName, lowerName) macro(upperName, lowerName, lowerName, JS ## upperName, upperName)
+#define DEFINE_STANDARD_BUILTIN(macro, upperName, lowerName) macro(upperName, lowerName, lowerName, JS ## upperName, upperName, object)
#define FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \
- macro(String, string, stringObject, StringObject, String) \
- macro(Symbol, symbol, symbolObject, SymbolObject, Symbol) \
- macro(Number, number, numberObject, NumberObject, Number) \
- macro(Error, error, error, ErrorInstance, Error) \
- macro(Map, map, map, JSMap, Map) \
- macro(JSPromise, promise, promise, JSPromise, Promise) \
- macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer) \
+ macro(String, string, stringObject, StringObject, String, object) \
+ macro(Symbol, symbol, symbolObject, SymbolObject, Symbol, object) \
+ macro(Number, number, numberObject, NumberObject, Number, object) \
+ macro(Error, error, error, ErrorInstance, Error, object) \
+ macro(Map, map, map, JSMap, Map, object) \
+ macro(JSPromise, promise, promise, JSPromise, Promise, object) \
+ macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer, object) \
#define FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(macro) \
DEFINE_STANDARD_BUILTIN(macro, MapIterator, mapIterator) \
@@ -117,16 +117,28 @@
#define FOR_EACH_SIMPLE_BUILTIN_TYPE(macro) \
FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \
- macro(JSInternalPromise, internalPromise, internalPromise, JSInternalPromise, InternalPromise) \
+ macro(JSInternalPromise, internalPromise, internalPromise, JSInternalPromise, InternalPromise, object) \
#define FOR_EACH_LAZY_BUILTIN_TYPE(macro) \
- macro(Set, set, set, JSSet, Set) \
- macro(Date, date, date, DateInstance, Date) \
- macro(Boolean, boolean, booleanObject, BooleanObject, Boolean) \
+ macro(Set, set, set, JSSet, Set, object) \
+ macro(Date, date, date, DateInstance, Date, object) \
+ macro(Boolean, boolean, booleanObject, BooleanObject, Boolean, object) \
DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \
DEFINE_STANDARD_BUILTIN(macro, WeakSet, weakSet) \
-#define DECLARE_SIMPLE_BUILTIN_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#if ENABLE(WEBASSEMBLY)
+#define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro) \
+ macro(WebAssemblyCompileError, webAssemblyCompileError, WebAssemblyCompileError, WebAssemblyCompileError, CompileError, error) \
+ macro(WebAssemblyInstance, webAssemblyInstance, WebAssemblyInstance, WebAssemblyInstance, Instance, object) \
+ macro(WebAssemblyMemory, webAssemblyMemory, WebAssemblyMemory, WebAssemblyMemory, Memory, object) \
+ macro(WebAssemblyModule, webAssemblyModule, WebAssemblyModule, WebAssemblyModule, Module, object) \
+ macro(WebAssemblyRuntimeError, webAssemblyRuntimeError, WebAssemblyRuntimeError, WebAssemblyRuntimeError, RuntimeError, error) \
+ macro(WebAssemblyTable, webAssemblyTable, WebAssemblyTable, WebAssemblyTable, Table, object)
+#else
+#define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro)
+#endif // ENABLE(WEBASSEMBLY)
+
+#define DECLARE_SIMPLE_BUILTIN_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
class JS ## capitalName; \
class capitalName ## Prototype; \
class capitalName ## Constructor;
@@ -135,6 +147,7 @@
FOR_EACH_SIMPLE_BUILTIN_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)
FOR_EACH_LAZY_BUILTIN_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)
FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)
+FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)
#undef DECLARE_SIMPLE_BUILTIN_TYPE
@@ -305,20 +318,25 @@
WriteBarrier<Structure> m_proxyRevokeStructure;
WriteBarrier<Structure> m_moduleLoaderStructure;
-#define DEFINE_STORAGE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define DEFINE_STORAGE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
WriteBarrier<capitalName ## Prototype> m_ ## lowerName ## Prototype; \
WriteBarrier<Structure> m_ ## properName ## Structure;
FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE)
+
+#if ENABLE(WEBASSEMBLY)
+ WriteBarrier<Structure> m_webAssemblyStructure;
+ FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE)
+#endif // ENABLE(WEBASSEMBLY)
#undef DEFINE_STORAGE_FOR_SIMPLE_TYPE
-#define DEFINE_STORAGE_FOR_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define DEFINE_STORAGE_FOR_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
LazyProperty<JSGlobalObject, Structure> m_ ## properName ## Structure;
FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_STORAGE_FOR_ITERATOR_TYPE)
#undef DEFINE_STORAGE_FOR_ITERATOR_TYPE
-#define DEFINE_STORAGE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define DEFINE_STORAGE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
LazyClassStructure m_ ## properName ## Structure;
FOR_EACH_LAZY_BUILTIN_TYPE(DEFINE_STORAGE_FOR_LAZY_TYPE)
#undef DEFINE_STORAGE_FOR_LAZY_TYPE
@@ -606,14 +624,15 @@
JSArrayBufferPrototype* arrayBufferPrototype() const { return m_arrayBufferPrototype.get(); }
-#define DEFINE_ACCESSORS_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define DEFINE_ACCESSORS_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
Structure* properName ## Structure() { return m_ ## properName ## Structure.get(); }
FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE)
+ FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE)
#undef DEFINE_ACCESSORS_FOR_SIMPLE_TYPE
-#define DEFINE_ACCESSORS_FOR_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define DEFINE_ACCESSORS_FOR_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
Structure* properName ## Structure() { return m_ ## properName ## Structure.get(this); }
FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_ACCESSORS_FOR_ITERATOR_TYPE)
@@ -620,7 +639,7 @@
#undef DEFINE_ACCESSORS_FOR_ITERATOR_TYPE
-#define DEFINE_ACCESSORS_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+#define DEFINE_ACCESSORS_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
Structure* properName ## Structure() { return m_ ## properName ## Structure.get(this); }
FOR_EACH_LAZY_BUILTIN_TYPE(DEFINE_ACCESSORS_FOR_LAZY_TYPE)
Copied: trunk/Source/_javascript_Core/wasm/JSWebAssembly.cpp (from rev 207649, trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.cpp) (0 => 207650)
--- trunk/Source/_javascript_Core/wasm/JSWebAssembly.cpp (rev 0)
+++ trunk/Source/_javascript_Core/wasm/JSWebAssembly.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "config.h"
+#include "JSWebAssembly.h"
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "FunctionPrototype.h"
+#include "JSCInlines.h"
+
+namespace JSC {
+
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSWebAssembly);
+
+const ClassInfo JSWebAssembly::s_info = { "WebAssembly", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssembly) };
+
+JSWebAssembly* JSWebAssembly::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+{
+ auto* object = new (NotNull, allocateCell<JSWebAssembly>(vm.heap)) JSWebAssembly(vm, structure);
+ object->finishCreation(vm, globalObject);
+ return object;
+}
+
+Structure* JSWebAssembly::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+{
+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+}
+
+void JSWebAssembly::finishCreation(VM& vm, JSGlobalObject*)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+}
+
+JSWebAssembly::JSWebAssembly(VM& vm, Structure* structure)
+ : JSNonFinalObject(vm, structure)
+{
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Copied: trunk/Source/_javascript_Core/wasm/JSWebAssembly.h (from rev 207649, trunk/Source/_javascript_Core/wasm/WebAssemblyObject.h) (0 => 207650)
--- trunk/Source/_javascript_Core/wasm/JSWebAssembly.h (rev 0)
+++ trunk/Source/_javascript_Core/wasm/JSWebAssembly.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#pragma once
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "JSObject.h"
+#include "js/JSWebAssemblyCompileError.h"
+#include "js/JSWebAssemblyInstance.h"
+#include "js/JSWebAssemblyMemory.h"
+#include "js/JSWebAssemblyModule.h"
+#include "js/JSWebAssemblyRuntimeError.h"
+#include "js/JSWebAssemblyTable.h"
+#include "js/WebAssemblyCompileErrorConstructor.h"
+#include "js/WebAssemblyCompileErrorPrototype.h"
+#include "js/WebAssemblyInstanceConstructor.h"
+#include "js/WebAssemblyInstancePrototype.h"
+#include "js/WebAssemblyMemoryConstructor.h"
+#include "js/WebAssemblyMemoryPrototype.h"
+#include "js/WebAssemblyModuleConstructor.h"
+#include "js/WebAssemblyModulePrototype.h"
+#include "js/WebAssemblyPrototype.h"
+#include "js/WebAssemblyRuntimeErrorConstructor.h"
+#include "js/WebAssemblyRuntimeErrorPrototype.h"
+#include "js/WebAssemblyTableConstructor.h"
+#include "js/WebAssemblyTablePrototype.h"
+
+namespace JSC {
+
+class JSWebAssembly : public JSNonFinalObject {
+public:
+ typedef JSNonFinalObject Base;
+
+ static JSWebAssembly* create(VM&, JSGlobalObject*, Structure*);
+ static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
+
+ DECLARE_INFO;
+
+protected:
+ void finishCreation(VM&, JSGlobalObject*);
+
+private:
+ JSWebAssembly(VM&, Structure*);
+};
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Deleted: trunk/Source/_javascript_Core/wasm/WebAssemblyObject.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/WebAssemblyObject.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/WebAssemblyObject.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#include "config.h"
-#include "WebAssemblyObject.h"
-
-#include "FunctionPrototype.h"
-#include "JSCInlines.h"
-#include "js/JSWebAssemblyCompileError.h"
-#include "js/JSWebAssemblyInstance.h"
-#include "js/JSWebAssemblyMemory.h"
-#include "js/JSWebAssemblyModule.h"
-#include "js/JSWebAssemblyRuntimeError.h"
-#include "js/JSWebAssemblyTable.h"
-#include "js/WebAssemblyCompileErrorConstructor.h"
-#include "js/WebAssemblyCompileErrorPrototype.h"
-#include "js/WebAssemblyInstanceConstructor.h"
-#include "js/WebAssemblyInstancePrototype.h"
-#include "js/WebAssemblyMemoryConstructor.h"
-#include "js/WebAssemblyMemoryPrototype.h"
-#include "js/WebAssemblyModuleConstructor.h"
-#include "js/WebAssemblyModulePrototype.h"
-#include "js/WebAssemblyRuntimeErrorConstructor.h"
-#include "js/WebAssemblyRuntimeErrorPrototype.h"
-#include "js/WebAssemblyTableConstructor.h"
-#include "js/WebAssemblyTablePrototype.h"
-
-namespace JSC {
-
-STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(WebAssemblyObject);
-
-#define DECLARE_WASM_OBJECT_FUNCTION(NAME, ...) EncodedJSValue JSC_HOST_CALL wasmObjectFunc ## NAME(ExecState*);
-FOR_EACH_WASM_FUNCTION_PROPERTY(DECLARE_WASM_OBJECT_FUNCTION)
-
-const ClassInfo WebAssemblyObject::s_info = { "WebAssembly", &Base::s_info, 0, CREATE_METHOD_TABLE(WebAssemblyObject) };
-
-WebAssemblyObject* WebAssemblyObject::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-{
- auto* object = new (NotNull, allocateCell<WebAssemblyObject>(vm.heap)) WebAssemblyObject(vm, structure);
- object->finishCreation(vm, globalObject);
- return object;
-}
-
-Structure* WebAssemblyObject::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-{
- return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-}
-
-void WebAssemblyObject::finishCreation(VM& vm, JSGlobalObject* globalObject)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(info()));
-
-#define SET_UP_WASM_CONSTRUCTOR_PROPERTY(NAME, ...) \
- auto* prototype ## NAME = WebAssembly ## NAME ## Prototype::create(vm, globalObject, WebAssembly ## NAME ## Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); \
- auto* structure ## NAME = JSWebAssembly ## NAME::createStructure(vm, globalObject, prototype ## NAME); \
- auto* constructor ## NAME = WebAssembly ## NAME ## Constructor::create(vm, WebAssembly ## NAME ## Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), prototype ## NAME, structure ## NAME); \
- prototype ## NAME->putDirectWithoutTransition(vm, vm.propertyNames->constructor, constructor ## NAME, DontEnum);
- FOR_EACH_WASM_CONSTRUCTOR_PROPERTY(SET_UP_WASM_CONSTRUCTOR_PROPERTY)
-
-#define REGISTER_WASM_CONSTRUCTOR_PROPERTY(NAME, ...) \
- putDirectWithoutTransition(vm, Identifier::fromString(globalObject->globalExec(), #NAME), constructor ## NAME, DontEnum);
- FOR_EACH_WASM_CONSTRUCTOR_PROPERTY(REGISTER_WASM_CONSTRUCTOR_PROPERTY)
-
-#define REGISTER_WASM_FUNCTION_PROPERTY(NAME, LENGTH) \
- putDirectNativeFunction(vm, globalObject, Identifier::fromString(&vm, #NAME), LENGTH, wasmObjectFunc ## NAME, NoIntrinsic, DontEnum);
- FOR_EACH_WASM_FUNCTION_PROPERTY(REGISTER_WASM_FUNCTION_PROPERTY)
-}
-
-WebAssemblyObject::WebAssemblyObject(VM& vm, Structure* structure)
- : JSNonFinalObject(vm, structure)
-{
-}
-
-// ------------------------------ Functions --------------------------------
-
-EncodedJSValue JSC_HOST_CALL wasmObjectFuncvalidate(ExecState* state)
-{
- VM& vm = state->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the validate function property"))));
-}
-
-EncodedJSValue JSC_HOST_CALL wasmObjectFunccompile(ExecState* state)
-{
- VM& vm = state->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the compile function property"))));
-}
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/wasm/WebAssemblyObject.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/WebAssemblyObject.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/WebAssemblyObject.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#pragma once
-
-#include "JSObject.h"
-
-namespace JSC {
-
-class WebAssemblyObject : public JSNonFinalObject {
-public:
- typedef JSNonFinalObject Base;
-
- static WebAssemblyObject* create(VM&, JSGlobalObject*, Structure*);
- static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
-
- DECLARE_INFO;
-
-protected:
- void finishCreation(VM&, JSGlobalObject*);
-
-private:
- WebAssemblyObject(VM&, Structure*);
-};
-
-// Name, functionLength
-#define FOR_EACH_WASM_CONSTRUCTOR_PROPERTY(DO) \
- DO(Module, 1) \
- DO(Instance, 2) \
- DO(Memory, 1) \
- DO(Table, 1) \
- DO(CompileError, 1) \
- DO(RuntimeError, 1)
-
-// Name, functionLength
-#define FOR_EACH_WASM_FUNCTION_PROPERTY(DO) \
- DO(validate, 1) \
- DO(compile, 1)
-
-} // namespace JSC
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "JSWebAssemblyCompileError.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "JSCInlines.h"
namespace JSC {
@@ -46,3 +48,5 @@
const ClassInfo JSWebAssemblyCompileError::s_info = { "WebAssembly.CompileError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyCompileError) };
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "ErrorInstance.h"
namespace JSC {
@@ -34,6 +36,10 @@
typedef ErrorInstance Base;
static JSWebAssemblyCompileError* create(ExecState*, Structure*, const String&, bool);
+ static JSWebAssemblyCompileError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
+ {
+ return create(exec, structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), useCurrentFrame);
+ }
DECLARE_INFO;
@@ -42,3 +48,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "JSWebAssemblyInstance.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "JSCInlines.h"
namespace JSC {
@@ -69,3 +71,5 @@
const ClassInfo JSWebAssemblyInstance::s_info = { "WebAssembly.Instance", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyInstance) };
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -47,3 +49,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "JSWebAssemblyMemory.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "JSCInlines.h"
namespace JSC {
@@ -69,3 +71,5 @@
const ClassInfo JSWebAssemblyMemory::s_info = { "WebAssembly.Memory", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyMemory) };
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -47,3 +49,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "JSWebAssemblyModule.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "JSCInlines.h"
namespace JSC {
@@ -69,3 +71,5 @@
const ClassInfo JSWebAssemblyModule::s_info = { "WebAssembly.Module", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyModule) };
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -47,3 +49,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "JSWebAssemblyRuntimeError.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "JSCInlines.h"
namespace JSC {
@@ -46,3 +48,5 @@
const ClassInfo JSWebAssemblyRuntimeError::s_info = { "WebAssembly.RuntimeError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyRuntimeError) };
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "ErrorInstance.h"
namespace JSC {
@@ -34,6 +36,10 @@
typedef ErrorInstance Base;
static JSWebAssemblyRuntimeError* create(ExecState*, Structure*, const String&, bool);
+ static JSWebAssemblyRuntimeError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
+ {
+ return create(exec, structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), useCurrentFrame);
+ }
DECLARE_INFO;
@@ -42,3 +48,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "JSWebAssemblyTable.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "JSCInlines.h"
namespace JSC {
@@ -69,3 +71,5 @@
const ClassInfo JSWebAssemblyTable::s_info = { "WebAssembly.Table", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyTable) };
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -47,3 +49,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,8 +26,11 @@
#include "config.h"
#include "WebAssemblyCompileErrorConstructor.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
+#include "JSWebAssemblyCompileError.h"
#include "WebAssemblyCompileErrorPrototype.h"
#include "WebAssemblyCompileErrorConstructor.lut.h"
@@ -43,9 +46,12 @@
static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyCompileError(ExecState* state)
{
- VM& vm = state->vm();
+ auto& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the CompileError constructor property"))));
+ JSValue message = state->argumentCount() ? state->argument(0) : jsUndefined();
+ auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->callee())->globalObject()->WebAssemblyCompileErrorStructure());
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ return JSValue::encode(JSWebAssemblyCompileError::create(state, structure, message, false));
}
static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyCompileError(ExecState* state)
@@ -67,12 +73,11 @@
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
-void WebAssemblyCompileErrorConstructor::finishCreation(VM& vm, WebAssemblyCompileErrorPrototype* prototype, Structure* structure)
+void WebAssemblyCompileErrorConstructor::finishCreation(VM& vm, WebAssemblyCompileErrorPrototype* prototype, Structure*)
{
Base::finishCreation(vm, ASCIILiteral("CompileError"));
- putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly);
+ putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, ReadOnly | DontEnum | DontDelete);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
- m_CompileErrorStructure.set(vm, this, structure);
}
WebAssemblyCompileErrorConstructor::WebAssemblyCompileErrorConstructor(VM& vm, Structure* structure)
@@ -92,12 +97,6 @@
return CallType::Host;
}
-void WebAssemblyCompileErrorConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
- auto* thisObject = jsCast<WebAssemblyCompileErrorConstructor*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, info());
- Base::visitChildren(thisObject, visitor);
- visitor.append(&thisObject->m_CompileErrorStructure);
-}
+} // namespace JSC
-} // namespace JSC
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "InternalFunction.h"
#include "JSObject.h"
@@ -42,8 +44,6 @@
DECLARE_INFO;
- Structure* CompileErrorStructure() const { return m_CompileErrorStructure.get(); }
-
protected:
void finishCreation(VM&, WebAssemblyCompileErrorPrototype*, Structure*);
@@ -51,9 +51,8 @@
WebAssemblyCompileErrorConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
- static void visitChildren(JSCell*, SlotVisitor&);
-
- WriteBarrier<Structure> m_CompileErrorStructure;
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyCompileErrorPrototype.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
@@ -63,3 +65,5 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -48,3 +50,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyInstanceConstructor.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
#include "WebAssemblyInstancePrototype.h"
@@ -101,3 +103,6 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
+
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "InternalFunction.h"
#include "JSObject.h"
@@ -57,3 +59,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstancePrototype.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstancePrototype.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstancePrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyInstancePrototype.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
@@ -63,3 +65,5 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstancePrototype.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstancePrototype.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstancePrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -48,3 +50,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyMemoryConstructor.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
#include "WebAssemblyMemoryPrototype.h"
@@ -101,3 +103,6 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
+
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "InternalFunction.h"
#include "JSObject.h"
@@ -57,3 +59,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyMemoryPrototype.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
@@ -63,3 +65,5 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -48,3 +50,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyModuleConstructor.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
#include "WebAssemblyModulePrototype.h"
@@ -101,3 +103,6 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
+
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "InternalFunction.h"
#include "JSObject.h"
@@ -57,3 +59,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModulePrototype.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModulePrototype.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModulePrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyModulePrototype.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
@@ -63,3 +65,5 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModulePrototype.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModulePrototype.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModulePrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -48,3 +50,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Copied: trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.cpp (from rev 207649, trunk/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorPrototype.cpp) (0 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.cpp (rev 0)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "config.h"
+#include "WebAssemblyPrototype.h"
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "FunctionPrototype.h"
+#include "JSCInlines.h"
+
+namespace JSC {
+
+static EncodedJSValue JSC_HOST_CALL webAssemblyFunctionValidate(ExecState* state)
+{
+ VM& vm = state->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the validate function property"))));
+}
+
+static EncodedJSValue JSC_HOST_CALL webAssemblyFunctionCompile(ExecState* state)
+{
+ VM& vm = state->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the compile function property"))));
+}
+
+}
+
+#include "WebAssemblyPrototype.lut.h"
+
+namespace JSC {
+
+const ClassInfo WebAssemblyPrototype::s_info = { "WebAssembly.prototype", &Base::s_info, &prototypeTableWebAssembly, CREATE_METHOD_TABLE(WebAssemblyPrototype) };
+
+/* Source for WebAssemblyPrototype.lut.h
+ @begin prototypeTableWebAssembly
+ validate webAssemblyFunctionValidate DontEnum|Function 1
+ compile webAssemblyFunctionCompile DontEnum|Function 1
+ @end
+ */
+
+WebAssemblyPrototype* WebAssemblyPrototype::create(VM& vm, JSGlobalObject*, Structure* structure)
+{
+ auto* object = new (NotNull, allocateCell<WebAssemblyPrototype>(vm.heap)) WebAssemblyPrototype(vm, structure);
+ object->finishCreation(vm);
+ return object;
+}
+
+Structure* WebAssemblyPrototype::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+{
+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+}
+
+void WebAssemblyPrototype::finishCreation(VM& vm)
+{
+ Base::finishCreation(vm);
+}
+
+WebAssemblyPrototype::WebAssemblyPrototype(VM& vm, Structure* structure)
+ : Base(vm, structure)
+{
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Copied: trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.h (from rev 207649, trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryPrototype.h) (0 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.h (rev 0)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#pragma once
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "JSDestructibleObject.h"
+#include "JSObject.h"
+
+namespace JSC {
+
+class WebAssemblyPrototype : public JSNonFinalObject {
+public:
+ typedef JSNonFinalObject Base;
+ static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
+
+ static WebAssemblyPrototype* create(VM&, JSGlobalObject*, Structure*);
+ static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
+
+ DECLARE_INFO;
+
+protected:
+ void finishCreation(VM&);
+
+private:
+ WebAssemblyPrototype(VM&, Structure*);
+};
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,8 +26,11 @@
#include "config.h"
#include "WebAssemblyRuntimeErrorConstructor.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
+#include "JSWebAssemblyRuntimeError.h"
#include "WebAssemblyRuntimeErrorPrototype.h"
#include "WebAssemblyRuntimeErrorConstructor.lut.h"
@@ -43,9 +46,12 @@
static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyRuntimeError(ExecState* state)
{
- VM& vm = state->vm();
+ auto& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the RuntimeError constructor property"))));
+ JSValue message = state->argumentCount() ? state->argument(0) : jsUndefined();
+ auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->callee())->globalObject()->WebAssemblyRuntimeErrorStructure());
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ return JSValue::encode(JSWebAssemblyRuntimeError::create(state, structure, message, false));
}
static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyRuntimeError(ExecState* state)
@@ -67,12 +73,11 @@
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
-void WebAssemblyRuntimeErrorConstructor::finishCreation(VM& vm, WebAssemblyRuntimeErrorPrototype* prototype, Structure* structure)
+void WebAssemblyRuntimeErrorConstructor::finishCreation(VM& vm, WebAssemblyRuntimeErrorPrototype* prototype, Structure*)
{
Base::finishCreation(vm, ASCIILiteral("RuntimeError"));
- putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly);
+ putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, ReadOnly | DontEnum | DontDelete);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
- m_RuntimeErrorStructure.set(vm, this, structure);
}
WebAssemblyRuntimeErrorConstructor::WebAssemblyRuntimeErrorConstructor(VM& vm, Structure* structure)
@@ -92,12 +97,6 @@
return CallType::Host;
}
-void WebAssemblyRuntimeErrorConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
- auto* thisObject = jsCast<WebAssemblyRuntimeErrorConstructor*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, info());
- Base::visitChildren(thisObject, visitor);
- visitor.append(&thisObject->m_RuntimeErrorStructure);
-}
+} // namespace JSC
-} // namespace JSC
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "InternalFunction.h"
#include "JSObject.h"
@@ -42,8 +44,6 @@
DECLARE_INFO;
- Structure* RuntimeErrorStructure() const { return m_RuntimeErrorStructure.get(); }
-
protected:
void finishCreation(VM&, WebAssemblyRuntimeErrorPrototype*, Structure*);
@@ -51,9 +51,8 @@
WebAssemblyRuntimeErrorConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
- static void visitChildren(JSCell*, SlotVisitor&);
-
- WriteBarrier<Structure> m_RuntimeErrorStructure;
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorPrototype.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorPrototype.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorPrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyRuntimeErrorPrototype.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
@@ -63,3 +65,5 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorPrototype.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorPrototype.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorPrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -48,3 +50,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyTableConstructor.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
#include "WebAssemblyTablePrototype.h"
@@ -101,3 +103,6 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
+
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "InternalFunction.h"
#include "JSObject.h"
@@ -57,3 +59,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.cpp (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.cpp 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.cpp 2016-10-21 01:19:24 UTC (rev 207650)
@@ -26,6 +26,8 @@
#include "config.h"
#include "WebAssemblyTablePrototype.h"
+#if ENABLE(WEBASSEMBLY)
+
#include "FunctionPrototype.h"
#include "JSCInlines.h"
@@ -63,3 +65,5 @@
}
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.h (207649 => 207650)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.h 2016-10-21 01:17:31 UTC (rev 207649)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyTablePrototype.h 2016-10-21 01:19:24 UTC (rev 207650)
@@ -25,6 +25,8 @@
#pragma once
+#if ENABLE(WEBASSEMBLY)
+
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -48,3 +50,5 @@
};
} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)