https://twitter.com/fchiba/status/918056577030021121
Created attachment 323524 [details] Patch
Comment on attachment 323524 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=323524&action=review Nice! > JSTests/wasm/js-api/web-assembly-function.js:22 > + assert.truthy(typeof instance.exports.foo === "function", "is_function bytecode should handle wasm function."); We have assert.isFunction > JSTests/wasm/js-api/web-assembly-function.js:24 > + assert.eq(value, "function", "the result of typeof should be 'function'"); Why twice?
Comment on attachment 323524 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=323524&action=review Thank you! >> JSTests/wasm/js-api/web-assembly-function.js:22 >> + assert.truthy(typeof instance.exports.foo === "function", "is_function bytecode should handle wasm function."); > > We have assert.isFunction I would like to keep this as is. This is because I would like to keep this `typeof xxx === 'function'` form. Currently, our bytecode compiler performs pattern matching onto the AST nodes and emit `is_function` specially if it finds `typeof xxx === "function"`. >> JSTests/wasm/js-api/web-assembly-function.js:24 >> + assert.eq(value, "function", "the result of typeof should be 'function'"); > > Why twice? This is because we would like to test `is_function` opcode and `typeof` opcode in bytecode compiler. Our JSC bytecode compiler emits `is_function` if `typeof XXX === "function"` case. The first `truthy` one tests this. And second this one tests `typeof` bytecode operation.
Committed r223274: <https://trac.webkit.org/changeset/223274>
<rdar://problem/34969307>