Changeset 223274 in webkit
- Timestamp:
- Oct 12, 2017 7:13:20 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r223239 r223274 1 2017-10-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 WebAssembly: Wasm functions should have either JSFunctionType or TypeOfShouldCallGetCallData 4 https://bugs.webkit.org/show_bug.cgi?id=178210 5 6 Reviewed by Saam Barati. 7 8 * wasm/function-tests/trap-from-start-async.js: 9 (async.StartTrapsAsync): 10 * wasm/function-tests/trap-from-start.js: 11 (StartTraps): 12 * wasm/js-api/web-assembly-function.js: 13 (assert.eq.Object.getPrototypeOf): 14 * wasm/js-api/wrapper-function.js: 15 (return.new.WebAssembly.Module): 16 (assert.throws.makeInstance): Deleted. 17 (assert.throws.Bar): Deleted. 18 (assert.throws): Deleted. 19 1 20 2017-09-29 Filip Pizlo <fpizlo@apple.com> 2 21 -
trunk/JSTests/wasm/function-tests/trap-from-start-async.js
r219969 r223274 63 63 for (let i = 0; i < table.length; ++i) { 64 64 switch (i) { 65 case 4: assert.is Object(table.get(i)); break;66 case 5: assert.is Object(table.get(i)); break;65 case 4: assert.isFunction(table.get(i)); break; 66 case 5: assert.isFunction(table.get(i)); break; 67 67 default: assert.eq(table.get(i), null); break; 68 68 } -
trunk/JSTests/wasm/function-tests/trap-from-start.js
r219969 r223274 62 62 for (let i = 0; i < table.length; ++i) { 63 63 switch (i) { 64 case 4: assert.is Object(table.get(i)); break;65 case 5: assert.is Object(table.get(i)); break;64 case 4: assert.isFunction(table.get(i)); break; 65 case 5: assert.isFunction(table.get(i)); break; 66 66 default: assert.eq(table.get(i), null); break; 67 67 } -
trunk/JSTests/wasm/js-api/web-assembly-function.js
r213313 r223274 19 19 20 20 assert.eq(Object.getPrototypeOf(instance.exports.foo), Function.prototype); 21 { 22 assert.truthy(typeof instance.exports.foo === "function", "is_function bytecode should handle wasm function."); 23 let value = typeof instance.exports.foo; 24 assert.eq(value, "function", "the result of typeof should be 'function'"); 25 } -
trunk/JSTests/wasm/js-api/wrapper-function.js
r217921 r223274 49 49 } 50 50 51 { 52 assert.truthy(typeof instance.exports.func === "function", "is_function bytecode should handle wrapper function."); 53 let value = typeof instance.exports.func; 54 assert.eq(value, "function", "the result of typeof should be 'function'"); 55 } 51 56 } 52 57 -
trunk/Source/JavaScriptCore/ChangeLog
r223248 r223274 1 2017-10-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 WebAssembly: Wasm functions should have either JSFunctionType or TypeOfShouldCallGetCallData 4 https://bugs.webkit.org/show_bug.cgi?id=178210 5 6 Reviewed by Saam Barati. 7 8 In Wasm, we have two JS functions exposed to users: WebAssemblyFunction and WebAssemblyWrapperFunction. 9 The former is an exported wasm function and the latter is an imported & exported function. Since they 10 have [[Call]], they should be categorized into "function" in typeof operation. 11 12 However, these functions do not implement our function protocol correctly. They inherit JSFunction. 13 But JSType of WebAssemblyFunction is WebAssemblyFunctionType, and one of WebAssemblyWrapperFunction is 14 ObjectType. Since both do not have TypeOfShouldCallGetCallData, they return "object" when performing 15 typeof operation. 16 17 In this patch, we address the above issue by the following 2 fixes. 18 19 1. We add TypeOfShouldCallGetCallData to WebAssemblyFunction. This is the same way how we implement 20 InternalFunction. Since WebAssemblyFunction requires WebAssemblyFunctionType for fast checking in Wasm 21 implementation, we cannot make this JSFunctionType. 22 23 2. On the other hand, WebAssemblyWrapperFunction does not require a specific JSType. So this patch 24 changes JSType of WebAssemblyWrapperFunction to JSFunctionType. JSFunctionType can be usable for derived 25 classes of JSFunction (e.g. JSCustomGetterSetterFunction). 26 27 * wasm/js/WebAssemblyFunction.h: 28 (JSC::WebAssemblyFunction::signatureIndex const): Deleted. 29 (JSC::WebAssemblyFunction::wasmEntrypointLoadLocation const): Deleted. 30 (JSC::WebAssemblyFunction::callableFunction const): Deleted. 31 (JSC::WebAssemblyFunction::jsEntrypoint): Deleted. 32 (JSC::WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation): Deleted. 33 * wasm/js/WebAssemblyWrapperFunction.cpp: 34 (JSC::WebAssemblyWrapperFunction::createStructure): 35 * wasm/js/WebAssemblyWrapperFunction.h: 36 (JSC::WebAssemblyWrapperFunction::signatureIndex const): Deleted. 37 (JSC::WebAssemblyWrapperFunction::wasmEntrypointLoadLocation const): Deleted. 38 (JSC::WebAssemblyWrapperFunction::callableFunction const): Deleted. 39 (JSC::WebAssemblyWrapperFunction::function): Deleted. 40 1 41 2017-10-12 Per Arne Vollan <pvollan@apple.com> 2 42 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h
r217645 r223274 42 42 } 43 43 44 class WebAssemblyFunction : public WebAssemblyFunctionBase {44 class WebAssemblyFunction final : public WebAssemblyFunctionBase { 45 45 public: 46 46 using Base = WebAssemblyFunctionBase; 47 47 48 const static unsigned StructureFlags = Base::StructureFlags ;48 const static unsigned StructureFlags = Base::StructureFlags | TypeOfShouldCallGetCallData; 49 49 50 50 DECLARE_EXPORT_INFO; -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.cpp
r223002 r223274 80 80 { 81 81 ASSERT(globalObject); 82 return Structure::create(vm, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), info());82 return Structure::create(vm, globalObject, prototype, TypeInfo(JSFunctionType, StructureFlags), info()); 83 83 } 84 84 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.h
r217017 r223274 33 33 namespace JSC { 34 34 35 class WebAssemblyWrapperFunction : public WebAssemblyFunctionBase {35 class WebAssemblyWrapperFunction final : public WebAssemblyFunctionBase { 36 36 public: 37 37 using Base = WebAssemblyFunctionBase;
Note: See TracChangeset
for help on using the changeset viewer.