V8 WebAssembly imports not working with bound functions
Reported by
alex.ber...@gmail.com,
Aug 3 2016
|
||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Vivaldi/1.2.490.43
Steps to reproduce the problem:
const instance = Wasm.instantiateModule(code, {
'ethereum': {
'sstore': ethInterface.sstore.bind(ethInterface), // fails
'sload': function () {}, // works, obviously
'return': function () {}.bind('test'), // fails
}
})
WasmModule::Instantiate(): Import #0 module="ethereum" function="sstore" error: not a function
What is the expected behavior?
That bound functions work the same way as normal functions.
What went wrong?
Cannot use bound functions with Wasm.instantiateModule. Only regular functions work.
As a workaround I'm using a Function.bind polyfill, which ensures the bound function is a regular function.
I assume native bound functions are handled differently within V8 for optimisation reasons.
The line which causes the above error message: https://github.com/v8/v8/blob/master/src/wasm/wasm-module.cc#L496
Did this work before? N/A
Chrome version: 51.0.2704.103 Channel: n/a
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 22.0 r0
Originally reported to node.js: https://github.com/nodejs/node/issues/7953
,
Aug 3 2016
,
Aug 16 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by ahaas@chromium.org
, Aug 3 2016Components: -Blink Blink>JavaScript>WebAssembly
Owner: ahaas@chromium.org
Status: Assigned (was: Unconfirmed)