WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch
0001-WebAssembly-API-implement-exception-constructors-pro.patch (text/plain), 64.16 KB, created by
JF Bastien
on 2016-10-20 16:55:09 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
JF Bastien
Created:
2016-10-20 16:55:09 PDT
Size:
64.16 KB
patch
obsolete
>From 245a04f735a9731bf274968b7a9b25b0206b5a0a Mon Sep 17 00:00:00 2001 >From: JF Bastien <jfbastien@apple.com> >Date: Wed, 19 Oct 2016 15:44:43 -0700 >Subject: [PATCH] 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 thow (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. >--- > JSTests/ChangeLog | 25 +++++ > JSTests/wasm/js-api/test_basic_api.js | 22 +++- > Source/JavaScriptCore/CMakeLists.txt | 4 +- > Source/JavaScriptCore/ChangeLog | 57 +++++++++++ > Source/JavaScriptCore/DerivedSources.make | 1 + > .../JavaScriptCore.xcodeproj/project.pbxproj | 24 +++-- > Source/JavaScriptCore/runtime/JSGlobalObject.cpp | 55 ++++++---- > Source/JavaScriptCore/runtime/JSGlobalObject.h | 57 +++++++---- > Source/JavaScriptCore/wasm/JSWebAssembly.cpp | 61 +++++++++++ > Source/JavaScriptCore/wasm/JSWebAssembly.h | 67 ++++++++++++ > Source/JavaScriptCore/wasm/WebAssemblyObject.cpp | 113 --------------------- > .../wasm/js/JSWebAssemblyCompileError.h | 4 + > .../wasm/js/JSWebAssemblyRuntimeError.h | 4 + > .../wasm/js/WebAssemblyCompileErrorConstructor.cpp | 21 ++-- > .../wasm/js/WebAssemblyCompileErrorConstructor.h | 5 - > .../wasm/js/WebAssemblyPrototype.cpp | 85 ++++++++++++++++ > .../WebAssemblyPrototype.h} | 24 ++--- > .../wasm/js/WebAssemblyRuntimeErrorConstructor.cpp | 21 ++-- > .../wasm/js/WebAssemblyRuntimeErrorConstructor.h | 5 - > 19 files changed, 438 insertions(+), 217 deletions(-) > create mode 100644 Source/JavaScriptCore/wasm/JSWebAssembly.cpp > create mode 100644 Source/JavaScriptCore/wasm/JSWebAssembly.h > delete mode 100644 Source/JavaScriptCore/wasm/WebAssemblyObject.cpp > create mode 100644 Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp > rename Source/JavaScriptCore/wasm/{WebAssemblyObject.h => js/WebAssemblyPrototype.h} (74%) > >diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog >index dd37502..2655e46 100644 >--- a/JSTests/ChangeLog >+++ b/JSTests/ChangeLog >@@ -1,3 +1,28 @@ >+2016-10-20 JF Bastien <jfbastien@apple.com> >+ >+ 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 thow (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. >+ >+ WebAssembly API: implement exception constructors properly >+ https://bugs.webkit.org/show_bug.cgi?id=163699 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wasm/js-api/test_basic_api.js: >+ (const.c.in.constructorProperties): more tests >+ > 2016-10-20 Caitlin Potter <caitp@igalia.com> > > [JSC] disallow references to `await` in AsyncFunction formal parameters >diff --git a/JSTests/wasm/js-api/test_basic_api.js b/JSTests/wasm/js-api/test_basic_api.js >index bbd50b5..c4e1927 100644 >--- a/JSTests/wasm/js-api/test_basic_api.js >+++ b/JSTests/wasm/js-api/test_basic_api.js >@@ -27,6 +27,9 @@ assert.notUndef(WebAssembly); > 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 @@ for (const c in constructorProperties) { > 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 @@ for (const f in functionProperties) { > 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`); >+} >diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt >index 968d075..97741fe 100644 >--- a/Source/JavaScriptCore/CMakeLists.txt >+++ b/Source/JavaScriptCore/CMakeLists.txt >@@ -861,12 +861,12 @@ set(JavaScriptCore_SOURCES > 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 @@ set(JavaScriptCore_SOURCES > 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 @@ set(JavaScriptCore_OBJECT_LUT_SOURCES > 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 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index a541adc..b7f25e9 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,60 @@ >+2016-10-20 JF Bastien <jfbastien@apple.com> >+ >+ 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 thow (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. >+ >+ WebAssembly API: implement exception constructors properly >+ https://bugs.webkit.org/show_bug.cgi?id=163699 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * CMakeLists.txt: rename WebAssemblyObject -> JSWebAssembly; add a .lut.h file >+ * DerivedSources.make: new .lut.h file >+ * JavaScriptCore.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/JavaScriptCore/wasm/WebAssemblyObject.h. >+ (JSC::JSWebAssembly::create): >+ (JSC::JSWebAssembly::createStructure): >+ (JSC::JSWebAssembly::finishCreation): >+ (JSC::JSWebAssembly::JSWebAssembly): >+ * wasm/JSWebAssembly.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyObject.h. >+ * wasm/WebAssemblyObject.cpp: Removed. >+ * wasm/js/JSWebAssemblyCompileError.h: >+ (JSC::JSWebAssemblyCompileError::create): string convenience >+ * wasm/js/JSWebAssemblyRuntimeError.h: >+ (JSC::JSWebAssemblyRuntimeError::create): string convenience >+ * 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/WebAssemblyPrototype.cpp: Added. >+ (JSC::webAssemblyFunctionValidate): >+ (JSC::webAssemblyFunctionCompile): >+ (JSC::WebAssemblyPrototype::create): >+ (JSC::WebAssemblyPrototype::createStructure): >+ (JSC::WebAssemblyPrototype::finishCreation): >+ (JSC::WebAssemblyPrototype::WebAssemblyPrototype): >+ * wasm/js/WebAssemblyPrototype.h: Renamed from Source/JavaScriptCore/wasm/WebAssemblyObject.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: >+ > 2016-10-19 Myles C. Maxfield <mmaxfield@apple.com> > > [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9 >diff --git a/Source/JavaScriptCore/DerivedSources.make b/Source/JavaScriptCore/DerivedSources.make >index eecb53c..6630537 100644 >--- a/Source/JavaScriptCore/DerivedSources.make >+++ b/Source/JavaScriptCore/DerivedSources.make >@@ -168,6 +168,7 @@ OBJECT_LUT_HEADERS = \ > WebAssemblyMemoryPrototype.lut.h \ > WebAssemblyModuleConstructor.lut.h \ > WebAssemblyModulePrototype.lut.h \ >+ WebAssemblyPrototype.lut.h \ > WebAssemblyRuntimeErrorConstructor.lut.h \ > WebAssemblyRuntimeErrorPrototype.lut.h \ > WebAssemblyTableConstructor.lut.h \ >diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >index aecd1b2..0966e47 100644 >--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >@@ -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 */, >diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >index 15a9410..f48cbcf 100644 >--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >@@ -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,18 +541,18 @@ void JSGlobalObject::init(VM& vm) > 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) > > #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_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, th > > 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_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, th > > 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 @@ m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->c > 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 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct > > #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 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) > 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) >diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h >index 25bde2b..40846ce 100644 >--- a/Source/JavaScriptCore/runtime/JSGlobalObject.h >+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h >@@ -95,16 +95,16 @@ class VariableEnvironment; > 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 @@ struct HashTable; > > #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 @@ class IteratorPrototype; > 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 @@ public: > 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,21 +624,22 @@ public: > > 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) > > #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) >diff --git a/Source/JavaScriptCore/wasm/JSWebAssembly.cpp b/Source/JavaScriptCore/wasm/JSWebAssembly.cpp >new file mode 100644 >index 0000000..92d7419 >--- /dev/null >+++ b/Source/JavaScriptCore/wasm/JSWebAssembly.cpp >@@ -0,0 +1,61 @@ >+/* >+ * 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" >+ >+#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 >diff --git a/Source/JavaScriptCore/wasm/JSWebAssembly.h b/Source/JavaScriptCore/wasm/JSWebAssembly.h >new file mode 100644 >index 0000000..b60c681 >--- /dev/null >+++ b/Source/JavaScriptCore/wasm/JSWebAssembly.h >@@ -0,0 +1,67 @@ >+/* >+ * 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" >+#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 >diff --git a/Source/JavaScriptCore/wasm/WebAssemblyObject.cpp b/Source/JavaScriptCore/wasm/WebAssemblyObject.cpp >deleted file mode 100644 >index 9372fb4..0000000 >--- a/Source/JavaScriptCore/wasm/WebAssemblyObject.cpp >+++ /dev/null >@@ -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 >diff --git a/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h b/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h >index 1a77efb..df42656 100644 >--- a/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h >+++ b/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h >@@ -34,6 +34,10 @@ public: > 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; > >diff --git a/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h b/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h >index c12a1fa..93da9ee 100644 >--- a/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h >+++ b/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h >@@ -34,6 +34,10 @@ public: > 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; > >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp b/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp >index d17864c..e43640c 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp >@@ -28,6 +28,7 @@ > > #include "FunctionPrototype.h" > #include "JSCInlines.h" >+#include "JSWebAssemblyCompileError.h" > #include "WebAssemblyCompileErrorPrototype.h" > > #include "WebAssemblyCompileErrorConstructor.lut.h" >@@ -43,9 +44,12 @@ const ClassInfo WebAssemblyCompileErrorConstructor::s_info = { "Function", &Base > > 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 +71,11 @@ Structure* WebAssemblyCompileErrorConstructor::createStructure(VM& vm, JSGlobalO > 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 +95,4 @@ CallType WebAssemblyCompileErrorConstructor::getCallData(JSCell*, CallData& call > 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 >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.h b/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.h >index 7a524b9..0861258 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.h >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.h >@@ -42,8 +42,6 @@ public: > > DECLARE_INFO; > >- Structure* CompileErrorStructure() const { return m_CompileErrorStructure.get(); } >- > protected: > void finishCreation(VM&, WebAssemblyCompileErrorPrototype*, Structure*); > >@@ -51,9 +49,6 @@ private: > WebAssemblyCompileErrorConstructor(VM&, Structure*); > static ConstructType getConstructData(JSCell*, ConstructData&); > static CallType getCallData(JSCell*, CallData&); >- static void visitChildren(JSCell*, SlotVisitor&); >- >- WriteBarrier<Structure> m_CompileErrorStructure; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp b/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp >new file mode 100644 >index 0000000..f4024c1 >--- /dev/null >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp >@@ -0,0 +1,85 @@ >+/* >+ * 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" >+ >+#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 >diff --git a/Source/JavaScriptCore/wasm/WebAssemblyObject.h b/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h >similarity index 74% >rename from Source/JavaScriptCore/wasm/WebAssemblyObject.h >rename to Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h >index 7b52ca6..1e1f545 100644 >--- a/Source/JavaScriptCore/wasm/WebAssemblyObject.h >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h >@@ -25,38 +25,26 @@ > > #pragma once > >+#include "JSDestructibleObject.h" > #include "JSObject.h" > > namespace JSC { > >-class WebAssemblyObject : public JSNonFinalObject { >+class WebAssemblyPrototype : public JSNonFinalObject { > public: > typedef JSNonFinalObject Base; >+ static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; > >- static WebAssemblyObject* create(VM&, JSGlobalObject*, Structure*); >+ static WebAssemblyPrototype* create(VM&, JSGlobalObject*, Structure*); > static Structure* createStructure(VM&, JSGlobalObject*, JSValue); > > DECLARE_INFO; > > protected: >- void finishCreation(VM&, JSGlobalObject*); >+ void finishCreation(VM&); > > private: >- WebAssemblyObject(VM&, Structure*); >+ WebAssemblyPrototype(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 >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp b/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp >index b3067e5..9b91e96 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp >@@ -28,6 +28,7 @@ > > #include "FunctionPrototype.h" > #include "JSCInlines.h" >+#include "JSWebAssemblyRuntimeError.h" > #include "WebAssemblyRuntimeErrorPrototype.h" > > #include "WebAssemblyRuntimeErrorConstructor.lut.h" >@@ -43,9 +44,12 @@ const ClassInfo WebAssemblyRuntimeErrorConstructor::s_info = { "Function", &Base > > 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 +71,11 @@ Structure* WebAssemblyRuntimeErrorConstructor::createStructure(VM& vm, JSGlobalO > 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 +95,4 @@ CallType WebAssemblyRuntimeErrorConstructor::getCallData(JSCell*, CallData& call > 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 >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.h b/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.h >index 9fc91c7..eb6f749 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.h >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.h >@@ -42,8 +42,6 @@ public: > > DECLARE_INFO; > >- Structure* RuntimeErrorStructure() const { return m_RuntimeErrorStructure.get(); } >- > protected: > void finishCreation(VM&, WebAssemblyRuntimeErrorPrototype*, Structure*); > >@@ -51,9 +49,6 @@ private: > WebAssemblyRuntimeErrorConstructor(VM&, Structure*); > static ConstructType getConstructData(JSCell*, ConstructData&); > static CallType getCallData(JSCell*, CallData&); >- static void visitChildren(JSCell*, SlotVisitor&); >- >- WriteBarrier<Structure> m_RuntimeErrorStructure; > }; > > } // namespace JSC >-- >2.10.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 163699
:
292286
|
292291
|
292293
|
292295