Changeset 207825 in webkit
- Timestamp:
- Oct 25, 2016 10:23:53 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r207824 r207825 1 2016-10-25 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly JS API: implement Module 4 5 This implementation allows us to: 6 - Syncrhonously create a WebAssembly.Module with a typed array. 7 - Creates a compilation plan. 8 - Parse the Module and creates corresponding code. 9 - Throw WebAssembly.CompileError with mildly helpful [*] error messages on 10 failure. 11 12 Consult the API documentation for expected behavior: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodule-constructor 13 14 For now the implementation discards the generated code. 15 16 The next steps will be: 17 - Expose a Module's exports. 18 - Implement WebAssembly.Instance, which allows instantiating and running a 19 compiled Module. 20 - Beef up the testing infrastructure under JSTests/wasm so that more complex 21 modules can be created and tested (instead of writing the bits by hand). 22 23 This patch also: 24 - Adds assert.instanceof in assert.js. 25 - Refactors Wasm::Parser and friends to accept const uint8_t* as well as a 26 Vector, to avoid copying when invoked synchronously. 27 - Remove useless Structure from some of the wasm constructors: they're already 28 on the JSGlobalObject, visited properly and all. 29 - Fix off-by-one error in parsing: Parser::parseUInt32 failed if the integer 30 was exactly at end of file. 31 32 [*] On error messages while parsing: I filed https://bugs.webkit.org/show_bug.cgi?id=163919 33 34 WebAssembly JS API: implement Module 35 https://bugs.webkit.org/show_bug.cgi?id=163903 36 37 Reviewed by Keith Miller. 38 39 * wasm/assert.js: use underscore in name, and remove when exporting to avoid clasing with builtin names 40 (const._notUndef): 41 (const._isUndef): 42 (const._eq): 43 (const._ge): 44 (const._throws): 45 * wasm/js-api/test_basic_api.js: test the WebAssembly.Module API 46 (const.c.in.constructorProperties.switch): 47 1 48 2016-10-25 Keith Miller <keith_miller@apple.com> 2 49 -
trunk/JSTests/wasm/assert.js
r207572 r207825 24 24 */ 25 25 26 export constnotUndef = (v) => {26 const _notUndef = (v) => { 27 27 if (typeof v === "undefined") 28 28 throw new Error("Shouldn't be undefined"); 29 29 }; 30 30 31 export constisUndef = (v) => {31 const _isUndef = (v) => { 32 32 if (typeof v !== "undefined") 33 33 throw new Error("Should be undefined"); 34 34 }; 35 35 36 export consteq = (lhs, rhs) => {36 const _eq = (lhs, rhs) => { 37 37 if (lhs !== rhs) 38 38 throw new Error(`Not the same: "${lhs}" and "${rhs}"`); 39 39 }; 40 40 41 export constge = (lhs, rhs) => {42 notUndef(lhs);43 notUndef(rhs);41 const _ge = (lhs, rhs) => { 42 _notUndef(lhs); 43 _notUndef(rhs); 44 44 if (!(lhs >= rhs)) 45 45 throw new Error(`Expected: "${lhs}" < "${rhs}"`); 46 46 }; 47 47 48 export constthrows = (func, type, message, ...args) => {48 const _throws = (func, type, message, ...args) => { 49 49 try { 50 50 func(...args); … … 56 56 throw new Error(`Expected to throw a ${type.name} with message "${message}"`); 57 57 }; 58 59 const _instanceof = (obj, type) => obj instanceof type; 60 61 // Use underscore names to avoid clashing with builtin names. 62 export { 63 _notUndef as notUndef, 64 _isUndef as isUndef, 65 _eq as eq, 66 _ge as ge, 67 _throws as throws, 68 _instanceof as instanceof, 69 }; -
trunk/JSTests/wasm/js-api/test_basic_api.js
r207650 r207825 1 1 import * as assert from '../assert.js'; 2 2 import * as utilities from '../utilities.js'; 3 4 const version = 0xC; 5 const emptyModule = Uint8Array.of(0x0, 0x61, 0x73, 0x6d, version, 0x00, 0x00, 0x00); 3 6 4 7 const checkOwnPropertyDescriptor = (obj, prop, expect) => { … … 15 18 }; 16 19 const constructorProperties = { 17 "Module": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 , isError: false},18 "Instance": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 , isError: false},19 "Memory": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 , isError: false},20 "Table": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 , isError: false},21 "CompileError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 , isError: true},22 "RuntimeError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 , isError: true},20 "Module": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 }, 21 "Instance": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 }, 22 "Memory": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 }, 23 "Table": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 }, 24 "CompileError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 }, 25 "RuntimeError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 }, 23 26 }; 24 27 … … 45 48 checkOwnPropertyDescriptor(WebAssembly[c], "prototype", { typeofvalue: "object", writable: false, configurable: false, enumerable: false }); 46 49 assert.throws(() => WebAssembly[c](), TypeError, `calling WebAssembly.${c} constructor without new is invalid`); 47 if (constructorProperties[c].isError) { 50 switch (c) { 51 case "Module": 52 for (const invalid of [undefined, "", 1, {}, []]) 53 assert.throws(() => new WebAssembly[c](invalid), TypeError, `first argument to WebAssembly.Module must be an ArrayBufferView or an ArrayBuffer (evaluating 'new WebAssembly[c](invalid)')`); 54 for (const buffer of [new ArrayBuffer(), new DataView(new ArrayBuffer()), new Int8Array(), new Uint8Array(), new Uint8ClampedArray(), new Int16Array(), new Uint16Array(), new Int32Array(), new Uint32Array(), new Float32Array(), new Float64Array()]) 55 // FIXME the following should be WebAssembly.CompileError. https://bugs.webkit.org/show_bug.cgi?id=163768 56 assert.throws(() => new WebAssembly[c](buffer), Error, `Module is 0 bytes, expected at least 8 bytes (evaluating 'new WebAssembly[c](buffer)')`); 57 assert.instanceof(new WebAssembly[c](emptyModule), WebAssembly.Module); 58 // FIXME test neutered TypedArray and TypedArrayView. https://bugs.webkit.org/show_bug.cgi?id=163899 59 break; 60 case "Instance": 61 // FIXME Implement and test these APIs further. For now they just throw. https://bugs.webkit.org/show_bug.cgi?id=159775 62 assert.throws(() => new WebAssembly[c](), Error, `WebAssembly doesn't yet implement the ${c} constructor property`); 63 break; 64 case "Memory": 65 // FIXME Implement and test these APIs further. For now they just throw. https://bugs.webkit.org/show_bug.cgi?id=159775 66 assert.throws(() => new WebAssembly[c](), Error, `WebAssembly doesn't yet implement the ${c} constructor property`); 67 break; 68 case "Table": 69 // FIXME Implement and test these APIs further. For now they just throw. https://bugs.webkit.org/show_bug.cgi?id=159775 70 assert.throws(() => new WebAssembly[c](), Error, `WebAssembly doesn't yet implement the ${c} constructor property`); 71 break; 72 case "CompileError": 73 case "RuntimeError": { 48 74 const e = new WebAssembly[c]; 49 75 assert.eq(e instanceof WebAssembly[c], true); … … 55 81 const e2 = new WebAssembly[c](sillyString); 56 82 assert.eq(e2.message, sillyString); 83 } break; 84 default: throw new Error(`Implementation error: unexpected constructor property "${c}"`); 57 85 } 58 86 } 59 87 60 88 // FIXME Implement and test these APIs further. For now they just throw. https://bugs.webkit.org/show_bug.cgi?id=159775 61 62 89 for (const f in functionProperties) { 63 90 assert.throws(() => WebAssembly[f](), Error, `WebAssembly doesn't yet implement the ${f} function property`); 64 91 } 65 66 for (const c in constructorProperties) {67 if (!constructorProperties[c].isError)68 assert.throws(() => new WebAssembly[c](), Error, `WebAssembly doesn't yet implement the ${c} constructor property`);69 } -
trunk/Source/JavaScriptCore/ChangeLog
r207824 r207825 1 2016-10-25 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly JS API: implement Module 4 5 This implementation allows us to: 6 - Syncrhonously create a WebAssembly.Module with a typed array. 7 - Creates a compilation plan. 8 - Parse the Module and creates corresponding code. 9 - Throw WebAssembly.CompileError with mildly helpful [*] error messages on 10 failure. 11 12 Consult the API documentation for expected behavior: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodule-constructor 13 14 For now the implementation discards the generated code. 15 16 The next steps will be: 17 - Expose a Module's exports. 18 - Implement WebAssembly.Instance, which allows instantiating and running a 19 compiled Module. 20 - Beef up the testing infrastructure under JSTests/wasm so that more complex 21 modules can be created and tested (instead of writing the bits by hand). 22 23 This patch also: 24 - Adds assert.instanceof in assert.js. 25 - Refactors Wasm::Parser and friends to accept const uint8_t* as well as a 26 Vector, to avoid copying when invoked synchronously. 27 - Remove useless Structure from some of the wasm constructors: they're already 28 on the JSGlobalObject, visited properly and all. 29 - Fix off-by-one error in parsing: Parser::parseUInt32 failed if the integer 30 was exactly at end of file. 31 32 [*] On error messages while parsing: I filed https://bugs.webkit.org/show_bug.cgi?id=163919 33 34 WebAssembly JS API: implement Module 35 https://bugs.webkit.org/show_bug.cgi?id=163903 36 37 Reviewed by Keith Miller. 38 39 * runtime/ExceptionHelpers.cpp: 40 (JSC::defaultSourceAppender): make this public so that WebAssembly can use it: it generates those fancy (evaluating '...') messages at the end 41 * runtime/ExceptionHelpers.h: 42 * runtime/JSGlobalObject.cpp: 43 (JSC::JSGlobalObject::init): remove the useless Structure from the WebAssembly objects (it's already in this file, no need to hold two references and visit them twice) 44 * testWasm.cpp: 45 (runWasmTests): update API 46 * wasm/WasmB3IRGenerator.cpp: 47 (JSC::Wasm::parseAndCompile): use updated API 48 * wasm/WasmB3IRGenerator.h: 49 * wasm/WasmFunctionParser.h: 50 (JSC::Wasm::FunctionParser<Context>::FunctionParser): use updated API 51 (JSC::Wasm::FunctionParser<Context>::parseExpression): use updated API 52 * wasm/WasmModuleParser.cpp: 53 (JSC::Wasm::ModuleParser::parse): generate error messages 54 * wasm/WasmModuleParser.h: 55 (JSC::Wasm::ModuleParser::ModuleParser): 56 (JSC::Wasm::ModuleParser::failed): 57 (JSC::Wasm::ModuleParser::errorMessage): 58 (JSC::Wasm::ModuleParser::functionInformation): 59 (JSC::Wasm::ModuleParser::memory): 60 * wasm/WasmParser.h: use update non-public API 61 (JSC::Wasm::Parser::parseVarUInt32): 62 (JSC::Wasm::Parser::parseVarUInt64): 63 (JSC::Wasm::Parser::source): 64 (JSC::Wasm::Parser::length): 65 (JSC::Wasm::Parser::Parser): 66 (JSC::Wasm::Parser::consumeCharacter): 67 (JSC::Wasm::Parser::consumeString): 68 (JSC::Wasm::Parser::parseUInt32): 69 (JSC::Wasm::Parser::parseUInt7): 70 * wasm/WasmPlan.cpp: 71 (JSC::Wasm::Plan::Plan): 72 (JSC::Wasm::Plan::~Plan): 73 * wasm/WasmPlan.h: 74 (JSC::Wasm::Plan::failed): 75 (JSC::Wasm::Plan::errorMessage): 76 (JSC::Wasm::Plan::resultSize): 77 (JSC::Wasm::Plan::result): 78 (JSC::Wasm::Plan::memory): 79 * wasm/js/JSWebAssemblyCompileError.cpp: 80 (JSC::createWebAssemblyCompileError): makes it easier to throw a WebAssembly.CompileError from Module 81 * wasm/js/JSWebAssemblyCompileError.h: 82 * wasm/js/WebAssemblyCompileErrorConstructor.cpp: 83 (JSC::WebAssemblyCompileErrorConstructor::create): 84 (JSC::WebAssemblyCompileErrorConstructor::finishCreation): 85 * wasm/js/WebAssemblyCompileErrorConstructor.h: 86 * wasm/js/WebAssemblyInstanceConstructor.cpp: 87 (JSC::WebAssemblyInstanceConstructor::create): 88 (JSC::WebAssemblyInstanceConstructor::finishCreation): 89 (JSC::WebAssemblyInstanceConstructor::visitChildren): 90 * wasm/js/WebAssemblyInstanceConstructor.h: 91 * wasm/js/WebAssemblyMemoryConstructor.cpp: 92 (JSC::WebAssemblyMemoryConstructor::create): 93 (JSC::WebAssemblyMemoryConstructor::finishCreation): 94 (JSC::WebAssemblyMemoryConstructor::visitChildren): 95 * wasm/js/WebAssemblyMemoryConstructor.h: 96 * wasm/js/WebAssemblyModuleConstructor.cpp: 97 (JSC::constructJSWebAssemblyModule): 98 (JSC::WebAssemblyModuleConstructor::create): 99 (JSC::WebAssemblyModuleConstructor::finishCreation): 100 (JSC::WebAssemblyModuleConstructor::visitChildren): 101 * wasm/js/WebAssemblyModuleConstructor.h: 102 * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: 103 (JSC::WebAssemblyRuntimeErrorConstructor::create): 104 (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation): 105 * wasm/js/WebAssemblyRuntimeErrorConstructor.h: 106 * wasm/js/WebAssemblyTableConstructor.cpp: 107 (JSC::WebAssemblyTableConstructor::create): 108 (JSC::WebAssemblyTableConstructor::finishCreation): 109 (JSC::WebAssemblyTableConstructor::visitChildren): 110 * wasm/js/WebAssemblyTableConstructor.h: 111 1 112 2016-10-25 Keith Miller <keith_miller@apple.com> 2 113 -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r206476 r207825 102 102 } 103 103 104 staticString defaultSourceAppender(const String& originalMessage, const String& sourceText, RuntimeType, ErrorInstance::SourceTextWhereErrorOccurred occurrence)104 String defaultSourceAppender(const String& originalMessage, const String& sourceText, RuntimeType, ErrorInstance::SourceTextWhereErrorOccurred occurrence) 105 105 { 106 106 if (occurrence == ErrorInstance::FoundApproximateSource) -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.h
r206525 r207825 37 37 38 38 typedef JSObject* (*ErrorFactory)(ExecState*, const String&, ErrorInstance::SourceAppender); 39 40 String defaultSourceAppender(const String&, const String&, RuntimeType, ErrorInstance::SourceTextWhereErrorOccurred); 39 41 40 42 JSObject* createTerminatedExecutionException(VM*); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r207650 r207825 833 833 auto* prototype = Prototype::create(vm, this, Prototype::createStructure(vm, this, base)); \ 834 834 auto* structure = JSObj::createStructure(vm, this, prototype); \ 835 auto* constructor = Constructor::create(vm, Constructor::createStructure(vm, this, this->functionPrototype()), prototype , structure); \835 auto* constructor = Constructor::create(vm, Constructor::createStructure(vm, this, this->functionPrototype()), prototype); \ 836 836 prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, constructor, DontEnum); \ 837 837 m_ ## lowerName ## Prototype.set(vm, this, prototype); \ -
trunk/Source/JavaScriptCore/testWasm.cpp
r207781 r207825 291 291 292 292 Plan plan(*vm, vector); 293 if (plan. result.size() != 2 || !plan.result[0] || !plan.result[1]) {294 dataLogLn("Module failed to compile correctly."); 295 CRASH(); 296 } 297 298 // Test this doesn't crash. 299 CHECK(isIdentical(invoke<float>(*plan.result [1]->jsEntryPoint, { boxf(0.0), boxf(1.5) }), -1.5f));300 CHECK(isIdentical(invoke<float>(*plan.result [1]->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 87.6234f));301 CHECK(isIdentical(invoke<float>(*plan.result [0]->jsEntryPoint, { boxf(0.0), boxf(1.5) }), -1.5f));302 CHECK(isIdentical(invoke<float>(*plan.result [0]->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 87.6234f));293 if (plan.failed() || plan.resultSize() != 2 || !plan.result(0) || !plan.result(1)) { 294 dataLogLn("Module failed to compile correctly."); 295 CRASH(); 296 } 297 298 // Test this doesn't crash. 299 CHECK(isIdentical(invoke<float>(*plan.result(1)->jsEntryPoint, { boxf(0.0), boxf(1.5) }), -1.5f)); 300 CHECK(isIdentical(invoke<float>(*plan.result(1)->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 87.6234f)); 301 CHECK(isIdentical(invoke<float>(*plan.result(0)->jsEntryPoint, { boxf(0.0), boxf(1.5) }), -1.5f)); 302 CHECK(isIdentical(invoke<float>(*plan.result(0)->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 87.6234f)); 303 303 } 304 304 … … 320 320 321 321 Plan plan(*vm, vector); 322 if (plan. result.size() != 2 || !plan.result[0] || !plan.result[1]) {323 dataLogLn("Module failed to compile correctly."); 324 CRASH(); 325 } 326 327 // Test this doesn't crash. 328 CHECK(isIdentical(invoke<float>(*plan.result [1]->jsEntryPoint, { boxf(0.0), boxf(1.5) }), 1.5f));329 CHECK(isIdentical(invoke<float>(*plan.result [1]->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 112.6234f));330 CHECK(isIdentical(invoke<float>(*plan.result [0]->jsEntryPoint, { boxf(0.0), boxf(1.5) }), 1.5f));331 CHECK(isIdentical(invoke<float>(*plan.result [0]->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 112.6234f));322 if (plan.failed() || plan.resultSize() != 2 || !plan.result(0) || !plan.result(1)) { 323 dataLogLn("Module failed to compile correctly."); 324 CRASH(); 325 } 326 327 // Test this doesn't crash. 328 CHECK(isIdentical(invoke<float>(*plan.result(1)->jsEntryPoint, { boxf(0.0), boxf(1.5) }), 1.5f)); 329 CHECK(isIdentical(invoke<float>(*plan.result(1)->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 112.6234f)); 330 CHECK(isIdentical(invoke<float>(*plan.result(0)->jsEntryPoint, { boxf(0.0), boxf(1.5) }), 1.5f)); 331 CHECK(isIdentical(invoke<float>(*plan.result(0)->jsEntryPoint, { boxf(100.1234), boxf(12.5) }), 112.6234f)); 332 332 } 333 333 … … 354 354 355 355 Plan plan(*vm, vector); 356 if (plan. result.size() != 2 || !plan.result[0] || !plan.result[1]) {357 dataLogLn("Module failed to compile correctly."); 358 CRASH(); 359 } 360 361 // Test this doesn't crash. 362 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(0) }), 0);363 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(100) }), 1200);364 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(1) }), 12);365 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(2), box(3), box(4), box(5), box(6), box(7), box(8), box(9), box(10), box(11), box(12) }), 78);366 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(2), box(3), box(4), box(5), box(6), box(7), box(8), box(9), box(10), box(11), box(100) }), 166);356 if (plan.failed() || plan.resultSize() != 2 || !plan.result(0) || !plan.result(1)) { 357 dataLogLn("Module failed to compile correctly."); 358 CRASH(); 359 } 360 361 // Test this doesn't crash. 362 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(0) }), 0); 363 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(100) }), 1200); 364 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(1) }), 12); 365 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(2), box(3), box(4), box(5), box(6), box(7), box(8), box(9), box(10), box(11), box(12) }), 78); 366 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(2), box(3), box(4), box(5), box(6), box(7), box(8), box(9), box(10), box(11), box(100) }), 166); 367 367 } 368 368 … … 388 388 389 389 Plan plan(*vm, vector); 390 if (plan. result.size() != 1 || !plan.result[0]) {391 dataLogLn("Module failed to compile correctly."); 392 CRASH(); 393 } 394 395 // Test this doesn't crash. 396 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 1);397 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1) }), 1);398 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2) }), 2);399 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(4) }), 24);390 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 391 dataLogLn("Module failed to compile correctly."); 392 CRASH(); 393 } 394 395 // Test this doesn't crash. 396 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 1); 397 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1) }), 1); 398 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2) }), 2); 399 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(4) }), 24); 400 400 } 401 401 … … 417 417 418 418 Plan plan(*vm, vector); 419 if (plan.result .size() != 2 || !plan.result[0] || !plan.result[1]) {420 dataLogLn("Module failed to compile correctly."); 421 CRASH(); 422 } 423 424 // Test this doesn't crash. 425 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(0), box(0) }), 0);426 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(100), box(0) }), 100);427 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(1), box(15) }), 16);428 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 0);429 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100) }), 200);430 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1) }), 2);419 if (plan.resultSize() != 2 || !plan.result(0) || !plan.result(1)) { 420 dataLogLn("Module failed to compile correctly."); 421 CRASH(); 422 } 423 424 // Test this doesn't crash. 425 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(0), box(0) }), 0); 426 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(100), box(0) }), 100); 427 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(1), box(15) }), 16); 428 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 0); 429 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100) }), 200); 430 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1) }), 2); 431 431 } 432 432 … … 448 448 449 449 Plan plan(*vm, vector); 450 if (plan. result.size() != 2 || !plan.result[0] || !plan.result[1]) {451 dataLogLn("Module failed to compile correctly."); 452 CRASH(); 453 } 454 455 // Test this doesn't crash. 456 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(0) }), 0);457 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(100) }), 100);458 CHECK_EQ(invoke<int>(*plan.result [1]->jsEntryPoint, { box(1) }), 1);459 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 0);460 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100) }), 100);461 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1) }), 1);450 if (plan.failed() || plan.resultSize() != 2 || !plan.result(0) || !plan.result(1)) { 451 dataLogLn("Module failed to compile correctly."); 452 CRASH(); 453 } 454 455 // Test this doesn't crash. 456 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(0) }), 0); 457 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(100) }), 100); 458 CHECK_EQ(invoke<int>(*plan.result(1)->jsEntryPoint, { box(1) }), 1); 459 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 0); 460 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100) }), 100); 461 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1) }), 1); 462 462 } 463 463 … … 481 481 482 482 Plan plan(*vm, vector); 483 if (plan. result.size() != 1 || !plan.result[0]) {484 dataLogLn("Module failed to compile correctly."); 485 CRASH(); 486 } 487 488 // Test this doesn't crash. 489 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(10) }), 0);490 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(2) }), 100);491 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(100) }), 1);483 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 484 dataLogLn("Module failed to compile correctly."); 485 CRASH(); 486 } 487 488 // Test this doesn't crash. 489 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(10) }), 0); 490 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(2) }), 100); 491 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(100) }), 1); 492 492 } 493 493 … … 511 511 512 512 Plan plan(*vm, vector); 513 if (plan. result.size() != 1 || !plan.result[0]) {514 dataLogLn("Module failed to compile correctly."); 515 CRASH(); 516 } 517 518 // Test this doesn't crash. 519 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(10) }), 0);520 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(2) }), 100);521 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(100) }), 1);513 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 514 dataLogLn("Module failed to compile correctly."); 515 CRASH(); 516 } 517 518 // Test this doesn't crash. 519 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(10) }), 0); 520 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(2) }), 100); 521 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(100) }), 1); 522 522 } 523 523 … … 551 551 552 552 Plan plan(*vm, vector); 553 if (plan. result.size() != 1 || !plan.result[0]) {554 dataLogLn("Module failed to compile correctly."); 555 CRASH(); 556 } 557 ASSERT(plan.memory ->size());553 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 554 dataLogLn("Module failed to compile correctly."); 555 CRASH(); 556 } 557 ASSERT(plan.memory()->size()); 558 558 559 559 // Test this doesn't crash. 560 560 unsigned length = 5; 561 561 unsigned offset = sizeof(uint32_t); 562 uint32_t* memory = static_cast<uint32_t*>(plan.memory ->memory());563 invoke<void>(*plan.result [0]->jsEntryPoint, { box(100), box(offset), box(length) });562 uint32_t* memory = static_cast<uint32_t*>(plan.memory()->memory()); 563 invoke<void>(*plan.result(0)->jsEntryPoint, { box(100), box(offset), box(length) }); 564 564 offset /= sizeof(uint32_t); 565 565 CHECK_EQ(memory[offset - 1], 0u); … … 570 570 length = 10; 571 571 offset = 5 * sizeof(uint32_t); 572 invoke<void>(*plan.result [0]->jsEntryPoint, { box(5), box(offset), box(length) });572 invoke<void>(*plan.result(0)->jsEntryPoint, { box(5), box(offset), box(length) }); 573 573 offset /= sizeof(uint32_t); 574 574 CHECK_EQ(memory[offset - 1], 100u); … … 606 606 607 607 Plan plan(*vm, vector); 608 if (plan. result.size() != 1 || !plan.result[0]) {609 dataLogLn("Module failed to compile correctly."); 610 CRASH(); 611 } 612 ASSERT(plan.memory ->size());608 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 609 dataLogLn("Module failed to compile correctly."); 610 CRASH(); 611 } 612 ASSERT(plan.memory()->size()); 613 613 614 614 // Test this doesn't crash. 615 615 unsigned length = 5; 616 616 unsigned offset = 1; 617 uint8_t* memory = static_cast<uint8_t*>(plan.memory ->memory());618 invoke<void>(*plan.result [0]->jsEntryPoint, { box(100), box(offset), box(length) });617 uint8_t* memory = static_cast<uint8_t*>(plan.memory()->memory()); 618 invoke<void>(*plan.result(0)->jsEntryPoint, { box(100), box(offset), box(length) }); 619 619 CHECK_EQ(memory[offset - 1], 0u); 620 620 CHECK_EQ(memory[offset + length], 0u); … … 624 624 length = 10; 625 625 offset = 5; 626 invoke<void>(*plan.result [0]->jsEntryPoint, { box(5), box(offset), box(length) });626 invoke<void>(*plan.result(0)->jsEntryPoint, { box(5), box(offset), box(length) }); 627 627 CHECK_EQ(memory[offset - 1], 100u); 628 628 CHECK_EQ(memory[offset + length], 0u); … … 650 650 651 651 Plan plan(*vm, vector); 652 if (plan. result.size() != 1 || !plan.result[0]) {653 dataLogLn("Module failed to compile correctly."); 654 CRASH(); 655 } 656 ASSERT(plan.memory ->size());657 658 // Test this doesn't crash. 659 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(10) }), 0);660 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(2) }), 100);661 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(100) }), 1);652 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 653 dataLogLn("Module failed to compile correctly."); 654 CRASH(); 655 } 656 ASSERT(plan.memory()->size()); 657 658 // Test this doesn't crash. 659 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(10) }), 0); 660 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(2) }), 100); 661 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(100) }), 1); 662 662 } 663 663 … … 681 681 682 682 Plan plan(*vm, vector); 683 if (plan. result.size() != 1 || !plan.result[0]) {684 dataLogLn("Module failed to compile correctly."); 685 CRASH(); 686 } 687 688 // Test this doesn't crash. 689 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 0);690 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100) }), 100);691 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1) }), 1);683 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 684 dataLogLn("Module failed to compile correctly."); 685 CRASH(); 686 } 687 688 // Test this doesn't crash. 689 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 0); 690 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100) }), 100); 691 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1) }), 1); 692 692 } 693 693 … … 711 711 712 712 Plan plan(*vm, vector); 713 if (plan. result.size() != 1 || !plan.result[0]) {714 dataLogLn("Module failed to compile correctly."); 715 CRASH(); 716 } 717 718 // Test this doesn't crash. 719 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(10) }), 0);720 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(2) }), 100);721 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(100) }), 1);722 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(-12), box(plan.memory->size() - sizeof(uint64_t)) }), -12);713 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 714 dataLogLn("Module failed to compile correctly."); 715 CRASH(); 716 } 717 718 // Test this doesn't crash. 719 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(10) }), 0); 720 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(2) }), 100); 721 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(100) }), 1); 722 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(-12), box(plan.memory()->size() - sizeof(uint64_t)) }), -12); 723 723 } 724 724 … … 742 742 743 743 Plan plan(*vm, vector); 744 if (plan. result.size() != 1 || !plan.result[0]) {745 dataLogLn("Module failed to compile correctly."); 746 CRASH(); 747 } 748 749 // Test this doesn't crash. 750 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(10) }), 0);751 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(2) }), 100);752 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(100) }), 1);744 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 745 dataLogLn("Module failed to compile correctly."); 746 CRASH(); 747 } 748 749 // Test this doesn't crash. 750 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(10) }), 0); 751 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(2) }), 100); 752 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(100) }), 1); 753 753 } 754 754 … … 782 782 783 783 Plan plan(*vm, vector); 784 if (plan. result.size() != 1 || !plan.result[0]) {785 dataLogLn("Module failed to compile correctly."); 786 CRASH(); 787 } 788 ASSERT(plan.memory ->size());784 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 785 dataLogLn("Module failed to compile correctly."); 786 CRASH(); 787 } 788 ASSERT(plan.memory()->size()); 789 789 790 790 // Test this doesn't crash. 791 791 unsigned length = 5; 792 792 unsigned offset = sizeof(uint32_t); 793 uint32_t* memory = static_cast<uint32_t*>(plan.memory ->memory());794 invoke<void>(*plan.result [0]->jsEntryPoint, { box(100), box(offset), box(length) });793 uint32_t* memory = static_cast<uint32_t*>(plan.memory()->memory()); 794 invoke<void>(*plan.result(0)->jsEntryPoint, { box(100), box(offset), box(length) }); 795 795 offset /= sizeof(uint32_t); 796 796 CHECK_EQ(memory[offset - 1], 0u); … … 801 801 length = 10; 802 802 offset = 5 * sizeof(uint32_t); 803 invoke<void>(*plan.result [0]->jsEntryPoint, { box(5), box(offset), box(length) });803 invoke<void>(*plan.result(0)->jsEntryPoint, { box(5), box(offset), box(length) }); 804 804 offset /= sizeof(uint32_t); 805 805 CHECK_EQ(memory[offset - 1], 100u); … … 837 837 838 838 Plan plan(*vm, vector); 839 if (plan. result.size() != 1 || !plan.result[0]) {840 dataLogLn("Module failed to compile correctly."); 841 CRASH(); 842 } 843 ASSERT(plan.memory ->size());839 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 840 dataLogLn("Module failed to compile correctly."); 841 CRASH(); 842 } 843 ASSERT(plan.memory()->size()); 844 844 845 845 // Test this doesn't crash. 846 846 unsigned length = 5; 847 847 unsigned offset = 1; 848 uint8_t* memory = static_cast<uint8_t*>(plan.memory ->memory());849 invoke<void>(*plan.result [0]->jsEntryPoint, { box(100), box(offset), box(length) });848 uint8_t* memory = static_cast<uint8_t*>(plan.memory()->memory()); 849 invoke<void>(*plan.result(0)->jsEntryPoint, { box(100), box(offset), box(length) }); 850 850 CHECK_EQ(memory[offset - 1], 0u); 851 851 CHECK_EQ(memory[offset + length], 0u); … … 855 855 length = 10; 856 856 offset = 5; 857 invoke<void>(*plan.result [0]->jsEntryPoint, { box(5), box(offset), box(length) });857 invoke<void>(*plan.result(0)->jsEntryPoint, { box(5), box(offset), box(length) }); 858 858 CHECK_EQ(memory[offset - 1], 100u); 859 859 CHECK_EQ(memory[offset + length], 0u); … … 881 881 882 882 Plan plan(*vm, vector); 883 if (plan. result.size() != 1 || !plan.result[0]) {884 dataLogLn("Module failed to compile correctly."); 885 CRASH(); 886 } 887 ASSERT(plan.memory ->size());888 889 // Test this doesn't crash. 890 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(10) }), 0);891 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(2) }), 100);892 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(100) }), 1);883 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 884 dataLogLn("Module failed to compile correctly."); 885 CRASH(); 886 } 887 ASSERT(plan.memory()->size()); 888 889 // Test this doesn't crash. 890 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(10) }), 0); 891 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(2) }), 100); 892 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(100) }), 1); 893 893 } 894 894 … … 912 912 913 913 Plan plan(*vm, vector); 914 if (plan. result.size() != 1 || !plan.result[0]) {915 dataLogLn("Module failed to compile correctly."); 916 CRASH(); 917 } 918 919 // Test this doesn't crash. 920 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 0);921 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100) }), 100);922 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1) }), 1);914 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 915 dataLogLn("Module failed to compile correctly."); 916 CRASH(); 917 } 918 919 // Test this doesn't crash. 920 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 0); 921 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100) }), 100); 922 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1) }), 1); 923 923 } 924 924 … … 942 942 943 943 Plan plan(*vm, vector); 944 if (plan. result.size() != 1 || !plan.result[0]) {945 dataLogLn("Module failed to compile correctly."); 946 CRASH(); 947 } 948 949 // Test this doesn't crash. 950 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(1) }), 1);951 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(0) }), 1);952 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(1) }), 1);953 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(2) }), 1);954 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(2) }), 0);955 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(1) }), 0);956 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(6) }), 1);957 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(6) }), 1);944 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 945 dataLogLn("Module failed to compile correctly."); 946 CRASH(); 947 } 948 949 // Test this doesn't crash. 950 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(1) }), 1); 951 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(0) }), 1); 952 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(1) }), 1); 953 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(2) }), 1); 954 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(2) }), 0); 955 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(1) }), 0); 956 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(6) }), 1); 957 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(6) }), 1); 958 958 } 959 959 … … 983 983 984 984 Plan plan(*vm, vector); 985 if (plan. result.size() != 1 || !plan.result[0]) {986 dataLogLn("Module failed to compile correctly."); 987 CRASH(); 988 } 989 990 // Test this doesn't crash. 991 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(1) }), 1);992 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(0) }), 0);993 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(1) }), 0);994 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(2) }), 1);995 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(2) }), 0);996 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(1) }), 0);997 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(6) }), 1);998 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(6) }), 0);985 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 986 dataLogLn("Module failed to compile correctly."); 987 CRASH(); 988 } 989 990 // Test this doesn't crash. 991 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(1) }), 1); 992 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(0) }), 0); 993 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(1) }), 0); 994 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(2) }), 1); 995 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(2) }), 0); 996 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(1) }), 0); 997 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(6) }), 1); 998 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(6) }), 0); 999 999 } 1000 1000 … … 1010 1010 1011 1011 Plan plan(*vm, vector); 1012 if (plan. result.size() != 1 || !plan.result[0]) {1013 dataLogLn("Module failed to compile correctly."); 1014 CRASH(); 1015 } 1016 1017 // Test this doesn't crash. 1018 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { }), 5);1012 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1013 dataLogLn("Module failed to compile correctly."); 1014 CRASH(); 1015 } 1016 1017 // Test this doesn't crash. 1018 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { }), 5); 1019 1019 } 1020 1020 … … 1031 1031 1032 1032 Plan plan(*vm, vector); 1033 if (plan. result.size() != 1 || !plan.result[0]) {1034 dataLogLn("Module failed to compile correctly."); 1035 CRASH(); 1036 } 1037 1038 // Test this doesn't crash. 1039 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { }), 11);1033 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1034 dataLogLn("Module failed to compile correctly."); 1035 CRASH(); 1036 } 1037 1038 // Test this doesn't crash. 1039 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { }), 11); 1040 1040 } 1041 1041 … … 1051 1051 1052 1052 Plan plan(*vm, vector); 1053 if (plan. result.size() != 1 || !plan.result[0]) {1054 dataLogLn("Module failed to compile correctly."); 1055 CRASH(); 1056 } 1057 1058 // Test this doesn't crash. 1059 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { }), 11);1053 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1054 dataLogLn("Module failed to compile correctly."); 1055 CRASH(); 1056 } 1057 1058 // Test this doesn't crash. 1059 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { }), 11); 1060 1060 } 1061 1061 … … 1071 1071 1072 1072 Plan plan(*vm, vector); 1073 if (plan. result.size() != 1 || !plan.result[0]) {1074 dataLogLn("Module failed to compile correctly."); 1075 CRASH(); 1076 } 1077 1078 // Test this doesn't crash. 1079 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { }), 11);1073 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1074 dataLogLn("Module failed to compile correctly."); 1075 CRASH(); 1076 } 1077 1078 // Test this doesn't crash. 1079 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { }), 11); 1080 1080 } 1081 1081 … … 1090 1090 1091 1091 Plan plan(*vm, vector); 1092 if (plan. result.size() != 1 || !plan.result[0]) {1093 dataLogLn("Module failed to compile correctly."); 1094 CRASH(); 1095 } 1096 1097 // Test this doesn't crash. 1098 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(1) }), 1);1099 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(1) }), 101);1100 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(-1), box(1)}), 0);1101 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(std::numeric_limits<int>::max()), box(1) }), std::numeric_limits<int>::min());1092 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1093 dataLogLn("Module failed to compile correctly."); 1094 CRASH(); 1095 } 1096 1097 // Test this doesn't crash. 1098 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(1) }), 1); 1099 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(1) }), 101); 1100 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(-1), box(1)}), 0); 1101 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(std::numeric_limits<int>::max()), box(1) }), std::numeric_limits<int>::min()); 1102 1102 } 1103 1103 … … 1119 1119 1120 1120 Plan plan(*vm, vector); 1121 if (plan. result.size() != 1 || !plan.result[0]) {1122 dataLogLn("Module failed to compile correctly."); 1123 CRASH(); 1124 } 1125 1126 // Test this doesn't crash. 1127 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 0);1128 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(10) }), 10);1121 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1122 dataLogLn("Module failed to compile correctly."); 1123 CRASH(); 1124 } 1125 1126 // Test this doesn't crash. 1127 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 0); 1128 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(10) }), 10); 1129 1129 } 1130 1130 … … 1155 1155 1156 1156 Plan plan(*vm, vector); 1157 if (plan. result.size() != 1 || !plan.result[0]) {1158 dataLogLn("Module failed to compile correctly."); 1159 CRASH(); 1160 } 1161 1162 // Test this doesn't crash. 1163 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0) }), 0);1164 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1) }), 1);1165 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2)}), 3);1166 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100) }), 5050);1157 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1158 dataLogLn("Module failed to compile correctly."); 1159 CRASH(); 1160 } 1161 1162 // Test this doesn't crash. 1163 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0) }), 0); 1164 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1) }), 1); 1165 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2)}), 3); 1166 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100) }), 5050); 1167 1167 } 1168 1168 … … 1199 1199 1200 1200 Plan plan(*vm, vector); 1201 if (plan. result.size() != 1 || !plan.result[0]) {1202 dataLogLn("Module failed to compile correctly."); 1203 CRASH(); 1204 } 1205 1206 // Test this doesn't crash. 1207 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(1) }), 0);1208 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(0) }), 0);1209 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(1) }), 2);1210 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(2) }), 2);1211 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(2) }), 4);1212 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(6) }), 12);1213 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(6) }), 600);1214 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(100) }), 10000);1201 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1202 dataLogLn("Module failed to compile correctly."); 1203 CRASH(); 1204 } 1205 1206 // Test this doesn't crash. 1207 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(1) }), 0); 1208 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(0) }), 0); 1209 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(1) }), 2); 1210 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(2) }), 2); 1211 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(2) }), 4); 1212 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(6) }), 12); 1213 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(6) }), 600); 1214 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(100) }), 10000); 1215 1215 } 1216 1216 … … 1252 1252 1253 1253 Plan plan(*vm, vector); 1254 if (plan. result.size() != 1 || !plan.result[0]) {1255 dataLogLn("Module failed to compile correctly."); 1256 CRASH(); 1257 } 1258 1259 // Test this doesn't crash. 1260 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(0), box(1) }), 1);1261 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(0) }), 0);1262 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(1) }), 0);1263 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(2) }), 1);1264 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(2) }), 0);1265 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(1), box(1) }), 0);1266 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(2), box(6) }), 1);1267 CHECK_EQ(invoke<int>(*plan.result [0]->jsEntryPoint, { box(100), box(6) }), 0);1254 if (plan.failed() || plan.resultSize() != 1 || !plan.result(0)) { 1255 dataLogLn("Module failed to compile correctly."); 1256 CRASH(); 1257 } 1258 1259 // Test this doesn't crash. 1260 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(0), box(1) }), 1); 1261 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(0) }), 0); 1262 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(1) }), 0); 1263 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(2) }), 1); 1264 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(2) }), 0); 1265 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(1), box(1) }), 0); 1266 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(2), box(6) }), 1); 1267 CHECK_EQ(invoke<int>(*plan.result(0)->jsEntryPoint, { box(100), box(6) }), 0); 1268 1268 } 1269 1269 -
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
r207824 r207825 719 719 } 720 720 721 std::unique_ptr<FunctionCompilation> parseAndCompile(VM& vm, Vector<uint8_t>& source, Memory* memory, FunctionInformation info, const Vector<FunctionInformation>& functions, unsigned optLevel)721 std::unique_ptr<FunctionCompilation> parseAndCompile(VM& vm, const uint8_t* functionStart, size_t functionLength, Memory* memory, const Signature* signature, const Vector<FunctionInformation>& functions, unsigned optLevel) 722 722 { 723 723 auto result = std::make_unique<FunctionCompilation>(); … … 725 725 Procedure procedure; 726 726 B3IRGenerator context(memory, procedure, result->unlinkedCalls); 727 FunctionParser<B3IRGenerator> parser(context, source, info, functions);727 FunctionParser<B3IRGenerator> parser(context, functionStart, functionLength, signature, functions); 728 728 if (!parser.parse()) 729 729 RELEASE_ASSERT_NOT_REACHED(); … … 737 737 738 738 result->code = std::make_unique<Compilation>(vm, procedure, optLevel); 739 result->jsEntryPoint = createJSWrapper(vm, info.signature, result->code->code(), memory);739 result->jsEntryPoint = createJSWrapper(vm, signature, result->code->code(), memory); 740 740 return result; 741 741 } -
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.h
r207693 r207825 38 38 class Memory; 39 39 40 std::unique_ptr<FunctionCompilation> parseAndCompile(VM&, Vector<uint8_t>&, Memory*, FunctionInformation, const Vector<FunctionInformation>&, unsigned optLevel = 1);40 std::unique_ptr<FunctionCompilation> parseAndCompile(VM&, const uint8_t*, size_t, Memory*, const Signature*, const Vector<FunctionInformation>&, unsigned optLevel = 1); 41 41 42 42 } } // namespace JSC::Wasm -
trunk/Source/JavaScriptCore/wasm/WasmFunctionParser.h
r207781 r207825 45 45 typedef typename Context::ControlType ControlType; 46 46 47 FunctionParser(Context&, const Vector<uint8_t>& sourceBuffer, const FunctionInformation&, const Vector<FunctionInformation>& functions);47 FunctionParser(Context&, const uint8_t* functionStart, size_t functionLength, const Signature*, const Vector<FunctionInformation>& functions); 48 48 49 49 bool WARN_UNUSED_RETURN parse(); … … 60 60 Vector<ExpressionType, 1> m_expressionStack; 61 61 Vector<ControlType> m_controlStack; 62 const Signature &m_signature;62 const Signature* m_signature; 63 63 const Vector<FunctionInformation>& m_functions; 64 64 unsigned m_unreachableBlocks { 0 }; … … 66 66 67 67 template<typename Context> 68 FunctionParser<Context>::FunctionParser(Context& context, const Vector<uint8_t>& sourceBuffer, const FunctionInformation& info, const Vector<FunctionInformation>& functions)69 : Parser( sourceBuffer, info.start, info.end)68 FunctionParser<Context>::FunctionParser(Context& context, const uint8_t* functionStart, size_t functionLength, const Signature* signature, const Vector<FunctionInformation>& functions) 69 : Parser(functionStart, functionLength) 70 70 , m_context(context) 71 , m_signature( *info.signature)71 , m_signature(signature) 72 72 , m_functions(functions) 73 73 { 74 74 if (verbose) 75 dataLogLn("Parsing function starting at: ", info.start, " ending at: ", info.end);76 m_context.addArguments(m_signature .arguments);75 dataLogLn("Parsing function starting at: ", (uintptr_t)functionStart, " of length: ", functionLength); 76 m_context.addArguments(m_signature->arguments); 77 77 } 78 78 … … 310 310 case OpType::Return: { 311 311 Vector<ExpressionType, 1> returnValues; 312 if (m_signature .returnType != Void)312 if (m_signature->returnType != Void) 313 313 returnValues.append(m_expressionStack.takeLast()); 314 314 -
trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp
r207693 r207825 42 42 bool ModuleParser::parse() 43 43 { 44 if (m_sourceLength < 8) 45 return false; 46 if (!consumeCharacter(0)) 47 return false; 48 if (!consumeString("asm")) 49 return false; 44 const size_t minSize = 8; 45 if (length() < minSize) { 46 m_errorMessage = "Module is " + String::number(length()) + " bytes, expected at least " + String::number(minSize) + " bytes"; 47 return false; 48 } 49 if (!consumeCharacter(0) || !consumeString("asm")) { 50 m_errorMessage = "Modules doesn't start with '\\0asm'"; 51 return false; 52 } 50 53 51 54 // Skip the version number for now since we don't do anything with it. 52 55 uint32_t versionNumber; 53 if (!parseUInt32(versionNumber)) 54 return false; 55 56 if (versionNumber != magicNumber) 57 return false; 56 if (!parseUInt32(versionNumber)) { 57 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 58 m_errorMessage = "couldn't parse version number"; 59 return false; 60 } 61 62 if (versionNumber != magicNumber) { 63 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 64 m_errorMessage = "unexpected version number"; 65 return false; 66 } 58 67 59 68 … … 62 71 63 72 Sections::Section previousSection = Sections::Unknown; 64 while (m_offset < m_sourceLength) {73 while (m_offset < length()) { 65 74 if (verbose) 66 75 dataLogLn("Starting to parse next section at offset: ", m_offset); 67 76 68 77 uint8_t sectionByte; 69 if (!parseUInt7(sectionByte)) 70 return false; 78 if (!parseUInt7(sectionByte)) { 79 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 80 m_errorMessage = "couldn't get section byte"; 81 return false; 82 } 71 83 72 84 if (verbose) … … 79 91 } else { 80 92 uint32_t sectionNameLength; 81 if (!parseVarUInt32(sectionNameLength)) 82 return false; 93 if (!parseVarUInt32(sectionNameLength)) { 94 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 95 m_errorMessage = "couldn't get section name length"; 96 return false; 97 } 83 98 84 99 // Make sure we can read up to the section's size. 85 if (m_offset + sectionNameLength + WTF::LEBDecoder::max32BitLEBByteLength >= m_sourceLength) 86 return false; 100 if (m_offset + sectionNameLength + WTF::LEBDecoder::max32BitLEBByteLength >= length()) { 101 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 102 m_errorMessage = "section length is bigger than actual size"; 103 return false; 104 } 87 105 88 106 // We don't support any custom sections yet. … … 91 109 } 92 110 93 if (!Sections::validateOrder(previousSection, section)) 94 return false; 111 if (!Sections::validateOrder(previousSection, section)) { 112 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 113 m_errorMessage = "invalid section order"; 114 return false; 115 } 95 116 96 117 uint32_t sectionLength; 97 if (!parseVarUInt32(sectionLength)) 98 return false; 118 if (!parseVarUInt32(sectionLength)) { 119 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 120 m_errorMessage = "couldn't get section length"; 121 return false; 122 } 99 123 100 124 unsigned end = m_offset + sectionLength; … … 105 129 if (verbose) 106 130 dataLogLn("Parsing Memory."); 107 if (!parseMemory()) 108 return false; 131 if (!parseMemory()) { 132 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 133 m_errorMessage = "couldn't parse memory"; 134 return false; 135 } 109 136 break; 110 137 } … … 113 140 if (verbose) 114 141 dataLogLn("Parsing types."); 115 if (!parseFunctionTypes()) 116 return false; 142 if (!parseFunctionTypes()) { 143 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 144 m_errorMessage = "couldn't parse types"; 145 return false; 146 } 117 147 break; 118 148 } … … 121 151 if (verbose) 122 152 dataLogLn("Parsing function signatures."); 123 if (!parseFunctionSignatures()) 124 return false; 153 if (!parseFunctionSignatures()) { 154 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 155 m_errorMessage = "couldn't parse function signatures"; 156 return false; 157 } 125 158 break; 126 159 } … … 129 162 if (verbose) 130 163 dataLogLn("Parsing function definitions."); 131 if (!parseFunctionDefinitions()) 132 return false; 164 if (!parseFunctionDefinitions()) { 165 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 166 m_errorMessage = "couldn't parse function definitions"; 167 return false; 168 } 133 169 break; 134 170 } … … 147 183 dataLogLn("Finished parsing section."); 148 184 149 if (end != m_offset) 150 return false; 185 if (end != m_offset) { 186 // FIXME improve error message https://bugs.webkit.org/show_bug.cgi?id=163919 187 m_errorMessage = "parsing ended before the end of the section"; 188 return false; 189 } 151 190 152 191 previousSection = section; … … 154 193 155 194 // TODO 195 m_failed = false; 156 196 return true; 157 197 } -
trunk/Source/JavaScriptCore/wasm/WasmModuleParser.h
r207693 r207825 40 40 static const unsigned magicNumber = 0xc; 41 41 42 ModuleParser(const uint8_t* sourceBuffer, size_t sourceLength) 43 : Parser(sourceBuffer, sourceLength) 44 { 45 } 42 46 ModuleParser(const Vector<uint8_t>& sourceBuffer) 43 : Parser(sourceBuffer , 0, sourceBuffer.size())47 : Parser(sourceBuffer.data(), sourceBuffer.size()) 44 48 { 45 49 } 46 50 47 51 bool WARN_UNUSED_RETURN parse(); 52 bool WARN_UNUSED_RETURN failed() const { return m_failed; } 53 const String& errorMessage() const 54 { 55 RELEASE_ASSERT(failed()); 56 return m_errorMessage; 57 } 48 58 49 const Vector<FunctionInformation>& functionInformation() const { return m_functions; } 50 std::unique_ptr<Memory>& memory() { return m_memory; } 59 const Vector<FunctionInformation>& functionInformation() const 60 { 61 RELEASE_ASSERT(!failed()); 62 return m_functions; 63 } 64 std::unique_ptr<Memory>& memory() 65 { 66 RELEASE_ASSERT(!failed()); 67 return m_memory; 68 } 51 69 52 70 private: … … 60 78 Vector<Signature> m_signatures; 61 79 std::unique_ptr<Memory> m_memory; 80 bool m_failed { true }; 81 String m_errorMessage; 62 82 }; 63 83 -
trunk/Source/JavaScriptCore/wasm/WasmParser.h
r207693 r207825 39 39 class Parser { 40 40 protected: 41 Parser(const Vector<uint8_t>&, size_t start, size_t end);41 Parser(const uint8_t*, size_t); 42 42 43 43 bool WARN_UNUSED_RETURN consumeCharacter(char); … … 47 47 bool WARN_UNUSED_RETURN parseUInt7(uint8_t& result); 48 48 bool WARN_UNUSED_RETURN parseUInt32(uint32_t& result); 49 bool WARN_UNUSED_RETURN parseVarUInt32(uint32_t& result) { return WTF::LEBDecoder::decodeUInt32(m_source.data(), m_sourceLength, m_offset, result); } 50 bool WARN_UNUSED_RETURN parseVarUInt64(uint64_t& result) { return WTF::LEBDecoder::decodeUInt64(m_source.data(), m_sourceLength, m_offset, result); } 51 49 bool WARN_UNUSED_RETURN parseVarUInt32(uint32_t& result) { return WTF::LEBDecoder::decodeUInt32(m_source, m_sourceLength, m_offset, result); } 50 bool WARN_UNUSED_RETURN parseVarUInt64(uint64_t& result) { return WTF::LEBDecoder::decodeUInt64(m_source, m_sourceLength, m_offset, result); } 52 51 53 52 bool WARN_UNUSED_RETURN parseValueType(Type& result); 54 53 55 const Vector<uint8_t>& m_source; 54 const uint8_t* source() const { return m_source; } 55 size_t length() const { return m_sourceLength; } 56 57 size_t m_offset = 0; 58 59 private: 60 const uint8_t* m_source; 56 61 size_t m_sourceLength; 57 size_t m_offset;58 62 }; 59 63 60 ALWAYS_INLINE Parser::Parser(const Vector<uint8_t>& sourceBuffer, size_t start, size_t end)64 ALWAYS_INLINE Parser::Parser(const uint8_t* sourceBuffer, size_t sourceLength) 61 65 : m_source(sourceBuffer) 62 , m_sourceLength(end) 63 , m_offset(start) 66 , m_sourceLength(sourceLength) 64 67 { 65 ASSERT(end <= sourceBuffer.size());66 ASSERT(start < end);67 68 } 68 69 69 70 ALWAYS_INLINE bool Parser::consumeCharacter(char c) 70 71 { 71 if (m_offset >= m_sourceLength)72 if (m_offset >= length()) 72 73 return false; 73 if (c == m_source[m_offset]) {74 if (c == source()[m_offset]) { 74 75 m_offset++; 75 76 return true; … … 81 82 { 82 83 unsigned start = m_offset; 83 if (m_offset >= m_sourceLength)84 if (m_offset >= length()) 84 85 return false; 85 for ( unsignedi = 0; str[i]; i++) {86 for (size_t i = 0; str[i]; i++) { 86 87 if (!consumeCharacter(str[i])) { 87 88 m_offset = start; … … 94 95 ALWAYS_INLINE bool Parser::parseUInt32(uint32_t& result) 95 96 { 96 if ( m_sourceLength < 4 || m_offset >= m_sourceLength- 4)97 if (length() < 4 || m_offset > length() - 4) 97 98 return false; 98 result = *reinterpret_cast<const uint32_t*>( m_source.data() + m_offset);99 result = *reinterpret_cast<const uint32_t*>(source() + m_offset); 99 100 m_offset += 4; 100 101 return true; … … 103 104 ALWAYS_INLINE bool Parser::parseUInt7(uint8_t& result) 104 105 { 105 if (m_offset >= m_sourceLength)106 if (m_offset >= length()) 106 107 return false; 107 result = m_source[m_offset++];108 result = source()[m_offset++]; 108 109 return result < 0x80; 109 110 } -
trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp
r207693 r207825 38 38 39 39 static const bool verbose = false; 40 41 Plan::Plan(VM& vm, Vector<uint8_t> source) 42 : Plan(vm, source.data(), source.size()) 43 { 44 } 40 45 41 Plan::Plan(VM& vm, Vector<uint8_t> source)46 Plan::Plan(VM& vm, const uint8_t* source, size_t sourceLength) 42 47 { 43 48 if (verbose) 44 49 dataLogLn("Starting plan."); 45 ModuleParser moduleParser(source );50 ModuleParser moduleParser(source, sourceLength); 46 51 if (!moduleParser.parse()) { 47 dataLogLn("Parsing module failed."); 52 dataLogLn("Parsing module failed: ", moduleParser.errorMessage()); 53 m_errorMessage = moduleParser.errorMessage(); 48 54 return; 49 55 } … … 55 61 if (verbose) 56 62 dataLogLn("Processing funcion starting at: ", info.start, " and ending at: ", info.end); 57 result.append(parseAndCompile(vm, source, moduleParser.memory().get(), info, moduleParser.functionInformation())); 63 const uint8_t* functionStart = source + info.start; 64 size_t functionLength = info.end - info.start; 65 ASSERT(functionLength <= sourceLength); 66 m_result.append(parseAndCompile(vm, functionStart, functionLength, moduleParser.memory().get(), info.signature, moduleParser.functionInformation())); 58 67 } 59 68 60 69 // Patch the call sites for each function. 61 for (std::unique_ptr<FunctionCompilation>& functionPtr : result) {70 for (std::unique_ptr<FunctionCompilation>& functionPtr : m_result) { 62 71 FunctionCompilation* function = functionPtr.get(); 63 72 for (auto& call : function->unlinkedCalls) 64 MacroAssembler::repatchCall(call.callLocation, CodeLocationLabel( result[call.functionIndex]->code->code()));73 MacroAssembler::repatchCall(call.callLocation, CodeLocationLabel(m_result[call.functionIndex]->code->code())); 65 74 } 66 75 67 memory = WTFMove(moduleParser.memory()); 76 m_memory = WTFMove(moduleParser.memory()); 77 m_failed = false; 68 78 } 79 80 Plan::~Plan() { } 69 81 70 82 } } // namespace JSC::Wasm -
trunk/Source/JavaScriptCore/wasm/WasmPlan.h
r207693 r207825 37 37 class Memory; 38 38 39 // TODO: This should create a Wasm Module not a list of functions.40 39 class Plan { 41 40 public: 42 JS_EXPORT_PRIVATE Plan(VM&, Vector<uint8_t> source); 41 JS_EXPORT_PRIVATE Plan(VM&, Vector<uint8_t>); 42 JS_EXPORT_PRIVATE Plan(VM&, const uint8_t*, size_t); 43 JS_EXPORT_PRIVATE ~Plan(); 43 44 44 Vector<std::unique_ptr<FunctionCompilation>> result; 45 std::unique_ptr<Memory> memory; 45 bool WARN_UNUSED_RETURN failed() const { return m_failed; } 46 const String& errorMessage() const 47 { 48 RELEASE_ASSERT(failed()); 49 return m_errorMessage; 50 } 51 size_t resultSize() const 52 { 53 RELEASE_ASSERT(!failed()); 54 return m_result.size(); 55 } 56 const FunctionCompilation* result(size_t n) const 57 { 58 RELEASE_ASSERT(!failed()); 59 return m_result.at(n).get(); 60 } 61 const Memory* memory() const 62 { 63 RELEASE_ASSERT(!failed()); 64 return m_memory.get(); 65 } 66 67 private: 68 Vector<std::unique_ptr<FunctionCompilation>> m_result; 69 std::unique_ptr<Memory> m_memory; 70 bool m_failed { true }; 71 String m_errorMessage; 46 72 }; 47 73 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp
r207650 r207825 48 48 const ClassInfo JSWebAssemblyCompileError::s_info = { "WebAssembly.CompileError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyCompileError) }; 49 49 50 51 JSObject* createWebAssemblyCompileError(ExecState* exec, const String& message) 52 { 53 ASSERT(!message.isEmpty()); 54 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 55 return ErrorInstance::create(exec, globalObject->vm(), globalObject->WebAssemblyCompileErrorStructure(), message, defaultSourceAppender, TypeNothing, true); 56 } 57 50 58 } // namespace JSC 51 59 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h
r207650 r207825 48 48 }; 49 49 50 JSObject* createWebAssemblyCompileError(ExecState*, const String&); 51 50 52 } // namespace JSC 51 53 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp
r207650 r207825 49 49 auto& vm = state->vm(); 50 50 auto scope = DECLARE_THROW_SCOPE(vm); 51 JSValue message = state->argument Count() ? state->argument(0) : jsUndefined();51 JSValue message = state->argument(0); 52 52 auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->callee())->globalObject()->WebAssemblyCompileErrorStructure()); 53 53 RETURN_IF_EXCEPTION(scope, encodedJSValue()); … … 62 62 } 63 63 64 WebAssemblyCompileErrorConstructor* WebAssemblyCompileErrorConstructor::create(VM& vm, Structure* structure, WebAssemblyCompileErrorPrototype* thisPrototype , Structure* thisStructure)64 WebAssemblyCompileErrorConstructor* WebAssemblyCompileErrorConstructor::create(VM& vm, Structure* structure, WebAssemblyCompileErrorPrototype* thisPrototype) 65 65 { 66 66 auto* constructor = new (NotNull, allocateCell<WebAssemblyCompileErrorConstructor>(vm.heap)) WebAssemblyCompileErrorConstructor(vm, structure); 67 constructor->finishCreation(vm, thisPrototype , thisStructure);67 constructor->finishCreation(vm, thisPrototype); 68 68 return constructor; 69 69 } … … 74 74 } 75 75 76 void WebAssemblyCompileErrorConstructor::finishCreation(VM& vm, WebAssemblyCompileErrorPrototype* prototype , Structure*)76 void WebAssemblyCompileErrorConstructor::finishCreation(VM& vm, WebAssemblyCompileErrorPrototype* prototype) 77 77 { 78 78 Base::finishCreation(vm, ASCIILiteral("CompileError")); -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.h
r207650 r207825 40 40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 static WebAssemblyCompileErrorConstructor* create(VM&, Structure*, WebAssemblyCompileErrorPrototype* , Structure*);42 static WebAssemblyCompileErrorConstructor* create(VM&, Structure*, WebAssemblyCompileErrorPrototype*); 43 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 44 44 … … 46 46 47 47 protected: 48 void finishCreation(VM&, WebAssemblyCompileErrorPrototype* , Structure*);48 void finishCreation(VM&, WebAssemblyCompileErrorPrototype*); 49 49 50 50 private: -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp
r207650 r207825 58 58 } 59 59 60 WebAssemblyInstanceConstructor* WebAssemblyInstanceConstructor::create(VM& vm, Structure* structure, WebAssemblyInstancePrototype* thisPrototype , Structure* thisStructure)60 WebAssemblyInstanceConstructor* WebAssemblyInstanceConstructor::create(VM& vm, Structure* structure, WebAssemblyInstancePrototype* thisPrototype) 61 61 { 62 62 auto* constructor = new (NotNull, allocateCell<WebAssemblyInstanceConstructor>(vm.heap)) WebAssemblyInstanceConstructor(vm, structure); 63 constructor->finishCreation(vm, thisPrototype , thisStructure);63 constructor->finishCreation(vm, thisPrototype); 64 64 return constructor; 65 65 } … … 70 70 } 71 71 72 void WebAssemblyInstanceConstructor::finishCreation(VM& vm, WebAssemblyInstancePrototype* prototype , Structure* structure)72 void WebAssemblyInstanceConstructor::finishCreation(VM& vm, WebAssemblyInstancePrototype* prototype) 73 73 { 74 74 Base::finishCreation(vm, ASCIILiteral("Instance")); 75 75 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 76 76 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 77 m_InstanceStructure.set(vm, this, structure);78 77 } 79 78 … … 100 99 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 101 100 Base::visitChildren(thisObject, visitor); 102 visitor.append(&thisObject->m_InstanceStructure);103 101 } 104 102 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.h
r207650 r207825 40 40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 static WebAssemblyInstanceConstructor* create(VM&, Structure*, WebAssemblyInstancePrototype* , Structure*);42 static WebAssemblyInstanceConstructor* create(VM&, Structure*, WebAssemblyInstancePrototype*); 43 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 44 44 45 45 DECLARE_INFO; 46 46 47 Structure* InstanceStructure() const { return m_InstanceStructure.get(); }48 49 47 protected: 50 void finishCreation(VM&, WebAssemblyInstancePrototype* , Structure*);48 void finishCreation(VM&, WebAssemblyInstancePrototype*); 51 49 52 50 private: … … 55 53 static CallType getCallData(JSCell*, CallData&); 56 54 static void visitChildren(JSCell*, SlotVisitor&); 57 58 WriteBarrier<Structure> m_InstanceStructure;59 55 }; 60 56 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp
r207650 r207825 58 58 } 59 59 60 WebAssemblyMemoryConstructor* WebAssemblyMemoryConstructor::create(VM& vm, Structure* structure, WebAssemblyMemoryPrototype* thisPrototype , Structure* thisStructure)60 WebAssemblyMemoryConstructor* WebAssemblyMemoryConstructor::create(VM& vm, Structure* structure, WebAssemblyMemoryPrototype* thisPrototype) 61 61 { 62 62 auto* constructor = new (NotNull, allocateCell<WebAssemblyMemoryConstructor>(vm.heap)) WebAssemblyMemoryConstructor(vm, structure); 63 constructor->finishCreation(vm, thisPrototype , thisStructure);63 constructor->finishCreation(vm, thisPrototype); 64 64 return constructor; 65 65 } … … 70 70 } 71 71 72 void WebAssemblyMemoryConstructor::finishCreation(VM& vm, WebAssemblyMemoryPrototype* prototype , Structure* structure)72 void WebAssemblyMemoryConstructor::finishCreation(VM& vm, WebAssemblyMemoryPrototype* prototype) 73 73 { 74 74 Base::finishCreation(vm, ASCIILiteral("Memory")); 75 75 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 76 76 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 77 m_MemoryStructure.set(vm, this, structure);78 77 } 79 78 … … 100 99 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 101 100 Base::visitChildren(thisObject, visitor); 102 visitor.append(&thisObject->m_MemoryStructure);103 101 } 104 102 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.h
r207650 r207825 40 40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 static WebAssemblyMemoryConstructor* create(VM&, Structure*, WebAssemblyMemoryPrototype* , Structure*);42 static WebAssemblyMemoryConstructor* create(VM&, Structure*, WebAssemblyMemoryPrototype*); 43 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 44 44 45 45 DECLARE_INFO; 46 46 47 Structure* MemoryStructure() const { return m_MemoryStructure.get(); }48 49 47 protected: 50 void finishCreation(VM&, WebAssemblyMemoryPrototype* , Structure*);48 void finishCreation(VM&, WebAssemblyMemoryPrototype*); 51 49 52 50 private: … … 55 53 static CallType getCallData(JSCell*, CallData&); 56 54 static void visitChildren(JSCell*, SlotVisitor&); 57 58 WriteBarrier<Structure> m_MemoryStructure;59 55 }; 60 56 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
r207650 r207825 29 29 #if ENABLE(WEBASSEMBLY) 30 30 31 #include "ExceptionHelpers.h" 31 32 #include "FunctionPrototype.h" 33 #include "JSArrayBuffer.h" 32 34 #include "JSCInlines.h" 35 #include "JSTypedArrays.h" 36 #include "JSWebAssemblyCompileError.h" 37 #include "JSWebAssemblyModule.h" 38 #include "WasmPlan.h" 33 39 #include "WebAssemblyModulePrototype.h" 34 40 … … 46 52 static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyModule(ExecState* state) 47 53 { 48 VM& vm = state->vm();54 auto& vm = state->vm(); 49 55 auto scope = DECLARE_THROW_SCOPE(vm); 50 return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the Module constructor property")))); 56 JSValue val = state->argument(0); 57 JSArrayBuffer* arrayBuffer = val.getObject() ? jsDynamicCast<JSArrayBuffer*>(val.getObject()) : nullptr; 58 JSArrayBufferView* arrayBufferView = val.getObject() ? jsDynamicCast<JSArrayBufferView*>(val.getObject()) : nullptr; 59 if (!(arrayBuffer || arrayBufferView)) 60 return JSValue::encode(throwException(state, scope, createTypeError(state, ASCIILiteral("first argument to WebAssembly.Module must be an ArrayBufferView or an ArrayBuffer"), defaultSourceAppender, runtimeTypeForValue(val)))); 61 62 if (arrayBufferView ? arrayBufferView->isNeutered() : arrayBuffer->impl()->isNeutered()) 63 return JSValue::encode(throwException(state, scope, createTypeError(state, ASCIILiteral("underlying TypedArray has been detatched from the ArrayBuffer"), defaultSourceAppender, runtimeTypeForValue(val)))); 64 65 size_t byteOffset = arrayBufferView ? arrayBufferView->byteOffset() : 0; 66 size_t byteSize = arrayBufferView ? arrayBufferView->length() : arrayBuffer->impl()->byteLength(); 67 const auto* base = arrayBufferView ? static_cast<uint8_t*>(arrayBufferView->vector()) : static_cast<uint8_t*>(arrayBuffer->impl()->data()); 68 69 Wasm::Plan plan(vm, base + byteOffset, byteSize); 70 if (plan.failed()) 71 return JSValue::encode(throwException(state, scope, createWebAssemblyCompileError(state, plan.errorMessage()))); 72 73 // FIXME take content from Plan. 74 75 auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->callee())->globalObject()->WebAssemblyModuleStructure()); 76 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 77 return JSValue::encode(JSWebAssemblyModule::create(vm, structure)); 51 78 } 52 79 … … 58 85 } 59 86 60 WebAssemblyModuleConstructor* WebAssemblyModuleConstructor::create(VM& vm, Structure* structure, WebAssemblyModulePrototype* thisPrototype , Structure* thisStructure)87 WebAssemblyModuleConstructor* WebAssemblyModuleConstructor::create(VM& vm, Structure* structure, WebAssemblyModulePrototype* thisPrototype) 61 88 { 62 89 auto* constructor = new (NotNull, allocateCell<WebAssemblyModuleConstructor>(vm.heap)) WebAssemblyModuleConstructor(vm, structure); 63 constructor->finishCreation(vm, thisPrototype , thisStructure);90 constructor->finishCreation(vm, thisPrototype); 64 91 return constructor; 65 92 } … … 70 97 } 71 98 72 void WebAssemblyModuleConstructor::finishCreation(VM& vm, WebAssemblyModulePrototype* prototype , Structure* structure)99 void WebAssemblyModuleConstructor::finishCreation(VM& vm, WebAssemblyModulePrototype* prototype) 73 100 { 74 101 Base::finishCreation(vm, ASCIILiteral("Module")); 75 102 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 76 103 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 77 m_ModuleStructure.set(vm, this, structure);78 104 } 79 105 … … 100 126 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 101 127 Base::visitChildren(thisObject, visitor); 102 visitor.append(&thisObject->m_ModuleStructure);103 128 } 104 129 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.h
r207650 r207825 40 40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 static WebAssemblyModuleConstructor* create(VM&, Structure*, WebAssemblyModulePrototype* , Structure*);42 static WebAssemblyModuleConstructor* create(VM&, Structure*, WebAssemblyModulePrototype*); 43 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 44 44 45 45 DECLARE_INFO; 46 46 47 Structure* ModuleStructure() const { return m_ModuleStructure.get(); }48 49 47 protected: 50 void finishCreation(VM&, WebAssemblyModulePrototype* , Structure*);48 void finishCreation(VM&, WebAssemblyModulePrototype*); 51 49 52 50 private: … … 55 53 static CallType getCallData(JSCell*, CallData&); 56 54 static void visitChildren(JSCell*, SlotVisitor&); 57 58 WriteBarrier<Structure> m_ModuleStructure;59 55 }; 60 56 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
r207650 r207825 62 62 } 63 63 64 WebAssemblyRuntimeErrorConstructor* WebAssemblyRuntimeErrorConstructor::create(VM& vm, Structure* structure, WebAssemblyRuntimeErrorPrototype* thisPrototype , Structure* thisStructure)64 WebAssemblyRuntimeErrorConstructor* WebAssemblyRuntimeErrorConstructor::create(VM& vm, Structure* structure, WebAssemblyRuntimeErrorPrototype* thisPrototype) 65 65 { 66 66 auto* constructor = new (NotNull, allocateCell<WebAssemblyRuntimeErrorConstructor>(vm.heap)) WebAssemblyRuntimeErrorConstructor(vm, structure); 67 constructor->finishCreation(vm, thisPrototype , thisStructure);67 constructor->finishCreation(vm, thisPrototype); 68 68 return constructor; 69 69 } … … 74 74 } 75 75 76 void WebAssemblyRuntimeErrorConstructor::finishCreation(VM& vm, WebAssemblyRuntimeErrorPrototype* prototype , Structure*)76 void WebAssemblyRuntimeErrorConstructor::finishCreation(VM& vm, WebAssemblyRuntimeErrorPrototype* prototype) 77 77 { 78 78 Base::finishCreation(vm, ASCIILiteral("RuntimeError")); -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.h
r207650 r207825 40 40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 static WebAssemblyRuntimeErrorConstructor* create(VM&, Structure*, WebAssemblyRuntimeErrorPrototype* , Structure*);42 static WebAssemblyRuntimeErrorConstructor* create(VM&, Structure*, WebAssemblyRuntimeErrorPrototype*); 43 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 44 44 … … 46 46 47 47 protected: 48 void finishCreation(VM&, WebAssemblyRuntimeErrorPrototype* , Structure*);48 void finishCreation(VM&, WebAssemblyRuntimeErrorPrototype*); 49 49 50 50 private: -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp
r207650 r207825 58 58 } 59 59 60 WebAssemblyTableConstructor* WebAssemblyTableConstructor::create(VM& vm, Structure* structure, WebAssemblyTablePrototype* thisPrototype , Structure* thisStructure)60 WebAssemblyTableConstructor* WebAssemblyTableConstructor::create(VM& vm, Structure* structure, WebAssemblyTablePrototype* thisPrototype) 61 61 { 62 62 auto* constructor = new (NotNull, allocateCell<WebAssemblyTableConstructor>(vm.heap)) WebAssemblyTableConstructor(vm, structure); 63 constructor->finishCreation(vm, thisPrototype , thisStructure);63 constructor->finishCreation(vm, thisPrototype); 64 64 return constructor; 65 65 } … … 70 70 } 71 71 72 void WebAssemblyTableConstructor::finishCreation(VM& vm, WebAssemblyTablePrototype* prototype , Structure* structure)72 void WebAssemblyTableConstructor::finishCreation(VM& vm, WebAssemblyTablePrototype* prototype) 73 73 { 74 74 Base::finishCreation(vm, ASCIILiteral("Table")); 75 75 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 76 76 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 77 m_TableStructure.set(vm, this, structure);78 77 } 79 78 … … 100 99 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 101 100 Base::visitChildren(thisObject, visitor); 102 visitor.append(&thisObject->m_TableStructure);103 101 } 104 102 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.h
r207650 r207825 40 40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 static WebAssemblyTableConstructor* create(VM&, Structure*, WebAssemblyTablePrototype* , Structure*);42 static WebAssemblyTableConstructor* create(VM&, Structure*, WebAssemblyTablePrototype*); 43 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 44 44 45 45 DECLARE_INFO; 46 46 47 Structure* TableStructure() const { return m_TableStructure.get(); }48 49 47 protected: 50 void finishCreation(VM&, WebAssemblyTablePrototype* , Structure*);48 void finishCreation(VM&, WebAssemblyTablePrototype*); 51 49 52 50 private: … … 55 53 static CallType getCallData(JSCell*, CallData&); 56 54 static void visitChildren(JSCell*, SlotVisitor&); 57 58 WriteBarrier<Structure> m_TableStructure;59 55 }; 60 56
Note: See TracChangeset
for help on using the changeset viewer.