Bug 178210 - WebAssembly: Wasm functions should have either JSFunctionType or TypeOfShouldCallGetCallData
Summary: WebAssembly: Wasm functions should have either JSFunctionType or TypeOfShould...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-12 06:22 PDT by Yusuke Suzuki
Modified: 2017-10-12 19:14 PDT (History)
7 users (show)

See Also:


Attachments
Patch (8.94 KB, patch)
2017-10-12 07:10 PDT, Yusuke Suzuki
sbarati: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Yusuke Suzuki 2017-10-12 07:10:43 PDT
Created attachment 323524 [details]
Patch
Comment 2 JF Bastien 2017-10-12 08:32:41 PDT
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 3 Yusuke Suzuki 2017-10-12 19:09:38 PDT
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.
Comment 4 Yusuke Suzuki 2017-10-12 19:13:27 PDT
Committed r223274: <https://trac.webkit.org/changeset/223274>
Comment 5 Radar WebKit Bug Importer 2017-10-12 19:14:28 PDT
<rdar://problem/34969307>