Changeset 271168 in webkit


Ignore:
Timestamp:
Jan 5, 2021 12:13:38 PM (19 months ago)
Author:
ysuzuki@apple.com
Message:

[WASM] [BigInt] Add I64 to BigInt conversion
https://bugs.webkit.org/show_bug.cgi?id=213528

Reviewed by Michael Saboff.

JSTests:

  • wasm/function-tests/function-import-return-value.js:

(assert.truthy):
(assert.throws):
(assert.eq):

  • wasm/function-tests/i64-conversion.js: Renamed from JSTests/wasm/function-tests/i64-from-js-exceptions.js.

(assert.eq.instance.exports.foo.valueOf):

  • wasm/js-api/global-error.js:
  • wasm/stress/i64-call.js: Added.

(async test):

  • wasm/stress/i64-extract.js: Added.

(testI64):

  • wasm/stress/immutable-globals.js:

(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq):

  • wasm/stress/multi-value-i64.js: Added.

(async test):

  • wasm/stress/mutable-globals.js:

LayoutTests/imported/w3c:

  • web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt:
  • web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt:
  • web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt:
  • web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt:
  • web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt:
  • web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt:
  • web-platform-tests/wasm/jsapi/global/value-get-set.any-expected.txt:
  • web-platform-tests/wasm/jsapi/global/value-get-set.any.worker-expected.txt:
  • web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt:
  • web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt:
  • web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt:
  • web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt:
  • web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any-expected.txt:
  • web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.worker-expected.txt:
  • web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt:
  • web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt:

Source/JavaScriptCore:

This patch implements i64 to BigInt / BigInt to i64 support in WebAssembly to expose i64 features to JS.

  1. Arguments of exposed wasm functions can have i64.
  2. Returned values of exposed wasm functions can have i64.
  3. WebAssembly.Global can expose i64 value to JS.

Currently, we do not support fast JS->Wasm IC for wasm functions including i64 arguments. But this should be supported later
in https://bugs.webkit.org/show_bug.cgi?id=220053.

  • jsc.cpp:

(JSC_DEFINE_HOST_FUNCTION):

  • runtime/BigIntConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::toBigInt): Deleted.

  • runtime/BigIntConstructor.h:
  • runtime/JSBigInt.cpp:

(JSC::JSBigInt::toBigUInt64Heap):

  • runtime/JSBigInt.h:
  • runtime/JSCJSValue.cpp:

(JSC::JSValue::toBigInt const):
(JSC::JSValue::toBigInt64 const):
(JSC::JSValue::toBigUInt64 const):

  • runtime/JSCJSValue.h:
  • wasm/WasmExceptionType.h:
  • wasm/WasmGlobal.cpp:

(JSC::Wasm::Global::get const):
(JSC::Wasm::Global::set):

  • wasm/WasmGlobal.h:
  • wasm/WasmOperations.cpp:

(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):

  • wasm/WasmOperations.h:
  • wasm/js/JSToWasm.cpp:

(JSC::Wasm::marshallJSResult):
(JSC::Wasm::createJSToWasmWrapper):
(JSC::Wasm::boxWasmResult): Deleted.

  • wasm/js/WasmToJS.cpp:

(JSC::Wasm::wasmToJS):
(JSC::Wasm::handleBadI64Use): Deleted.

  • wasm/js/WebAssemblyFunction.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):

  • wasm/js/WebAssemblyGlobalConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • wasm/js/WebAssemblyGlobalPrototype.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • wasm/js/WebAssemblyModuleRecord.cpp:

(JSC::WebAssemblyModuleRecord::link):

Location:
trunk
Files:
3 added
41 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r271164 r271168  
     12021-01-05  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WASM] [BigInt] Add I64 to BigInt conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=213528
     5
     6        Reviewed by Michael Saboff.
     7
     8        * wasm/function-tests/function-import-return-value.js:
     9        (assert.truthy):
     10        (assert.throws):
     11        (assert.eq):
     12        * wasm/function-tests/i64-conversion.js: Renamed from JSTests/wasm/function-tests/i64-from-js-exceptions.js.
     13        (assert.eq.instance.exports.foo.valueOf):
     14        * wasm/js-api/global-error.js:
     15        * wasm/stress/i64-call.js: Added.
     16        (async test):
     17        * wasm/stress/i64-extract.js: Added.
     18        (testI64):
     19        * wasm/stress/immutable-globals.js:
     20        (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq):
     21        * wasm/stress/multi-value-i64.js: Added.
     22        (async test):
     23        * wasm/stress/mutable-globals.js:
     24
    1252021-01-05  Alexey Shvayka  <shvaikalesh@gmail.com>
    226
  • trunk/JSTests/wasm/function-tests/function-import-return-value.js

    r211195 r271168  
    152152    const instance = new WebAssembly.Instance(module, {imp: {func}});
    153153    for (let i = 0; i < 100; i++) {
    154         assert.throws(() => instance.exports.foo(), TypeError, "i64 not allowed as return type or argument to an imported function");
     154        assert.throws(() => instance.exports.foo(), TypeError, "Invalid argument type in ToBigInt operation");
     155    }
     156}
     157
     158{
     159    const builder = new Builder()
     160        .Type().End()
     161        .Import()
     162            .Function("imp", "func", { params: [], ret: "i64"})
     163        .End()
     164        .Function().End()
     165        .Export()
     166            .Function("foo")
     167        .End()
     168        .Code()
     169            .Function("foo", {params: [], ret: "void"})
     170                .Call(0)
     171                .Drop()
     172                .Return()
     173            .End()
     174        .End();
     175
     176
     177    const bin = builder.WebAssembly().get();
     178    const module = new WebAssembly.Module(bin);
     179    const func = () => 20n;
     180    const instance = new WebAssembly.Instance(module, {imp: {func}});
     181    for (let i = 0; i < 100; i++) {
     182        assert.eq(instance.exports.foo(), undefined);
     183    }
     184}
     185
     186{
     187    const builder = new Builder()
     188        .Type().End()
     189        .Import()
     190            .Function("imp", "func", { params: [], ret: "i64"})
     191        .End()
     192        .Function().End()
     193        .Export()
     194            .Function("foo")
     195        .End()
     196        .Code()
     197            .Function("foo", {params: [], ret: "i64"})
     198                .Call(0)
     199                .Return()
     200            .End()
     201        .End();
     202
     203
     204    const bin = builder.WebAssembly().get();
     205    const module = new WebAssembly.Module(bin);
     206    const func = () => 20n;
     207    const instance = new WebAssembly.Instance(module, {imp: {func}});
     208    for (let i = 0; i < 100; i++) {
     209        assert.eq(instance.exports.foo(), 20n);
    155210    }
    156211}
     
    177232    const bin = builder.WebAssembly().get();
    178233    const module = new WebAssembly.Module(bin);
    179     const func = () => 20;
    180     const instance = new WebAssembly.Instance(module, {imp: {func}});
    181     for (let i = 0; i < 100; i++) {
    182         assert.throws(() => instance.exports.foo(), TypeError, "i64 not allowed as return type or argument to an imported function");
    183     }
    184 }
    185 
    186 {
    187     const builder = new Builder()
    188         .Type().End()
    189         .Import()
    190             .Function("imp", "func", { params: ["i64"], ret: "void"})
    191         .End()
    192         .Function().End()
    193         .Export()
    194             .Function("foo")
    195         .End()
    196         .Code()
    197             .Function("foo", {params: [], ret: "void"})
     234    let called = false;
     235    const func = (value) => {
     236        called = true;
     237        assert.eq(value, 20n);
     238    };
     239    const instance = new WebAssembly.Instance(module, {imp: {func}});
     240    for (let i = 0; i < 100; i++) {
     241        called = false;
     242        assert.eq(instance.exports.foo(), undefined);
     243        assert.truthy(called);
     244    }
     245}
     246
     247{
     248    const builder = new Builder()
     249        .Type().End()
     250        .Import()
     251            .Function("imp", "func", { params: ["i64"], ret: "i64"})
     252        .End()
     253        .Function().End()
     254        .Export()
     255            .Function("foo")
     256        .End()
     257        .Code()
     258            .Function("foo", {params: [], ret: "i64"})
    198259                 .I64Const(20)
    199260                .Call(0)
     
    206267    const module = new WebAssembly.Module(bin);
    207268    let called = false;
    208     const func = () => {
     269    const func = (value) => {
    209270        called = true;
    210     }
    211     const instance = new WebAssembly.Instance(module, {imp: {func}});
    212     for (let i = 0; i < 100; i++) {
    213         assert.throws(() => instance.exports.foo(), TypeError, "i64 not allowed as return type or argument to an imported function");
    214         assert.eq(called, false);
     271        return value + 22n;
     272    }
     273    const instance = new WebAssembly.Instance(module, {imp: {func}});
     274    for (let i = 0; i < 100; i++) {
     275        called = false;
     276        assert.eq(instance.exports.foo(), 42n);
     277        assert.truthy(called);
    215278    }
    216279}
     
    242305    const instance = new WebAssembly.Instance(module);
    243306    for (let i = 0; i < 100; i++) {
    244         assert.throws(() => instance.exports.foo(value), Error, "WebAssembly function with an i64 argument can't be called from JavaScript");
    245         assert.eq(called, false);
    246     }
    247 }
     307        assert.throws(() => instance.exports.foo(value), Error, "Invalid argument type in ToBigInt operation");
     308        assert.eq(called, true);
     309    }
     310}
     311
     312{
     313    const builder = new Builder()
     314        .Type().End()
     315        .Function().End()
     316        .Export()
     317            .Function("foo")
     318        .End()
     319        .Code()
     320            .Function("foo", {params: ["i64"], ret: "i64"})
     321                .GetLocal(0)
     322                .Return()
     323            .End()
     324        .End();
     325
     326
     327    const bin = builder.WebAssembly().get();
     328    const module = new WebAssembly.Module(bin);
     329    let called = false;
     330    let value = {
     331        valueOf() {
     332            called = true;
     333            return 42n;
     334        }
     335    };
     336    const instance = new WebAssembly.Instance(module);
     337    for (let i = 0; i < 100; i++) {
     338        called = false;
     339        assert.eq(instance.exports.foo(value), 42n);
     340        assert.eq(called, true);
     341    }
     342}
  • trunk/JSTests/wasm/function-tests/i64-conversion.js

    r271167 r271168  
    3535
    3636const instance = new WebAssembly.Instance(module, imp);
    37 assert.throws(() => instance.exports.foo(20), WebAssembly.RuntimeError, "WebAssembly function with an i64 argument can't be called from JavaScript");
    38 assert.throws(() => instance.exports.foo({valueOf() { throw new Error("Should not be called!"); }}), WebAssembly.RuntimeError, "WebAssembly function with an i64 argument can't be called from JavaScript");
    39 assert.throws(() => instance.exports.bar(), WebAssembly.RuntimeError, "WebAssembly function that returns i64 can't be called from JavaScript");
    40 assert.eq(called, false);
     37assert.throws(() => instance.exports.foo(20), TypeError, "Invalid argument type in ToBigInt operation");
     38assert.eq(instance.exports.foo(20n), undefined);
     39assert.truthy(called);
     40called = false;
     41let convertCalled = false;
     42assert.eq(instance.exports.foo({valueOf() { convertCalled = true; return 20n; }}), undefined);
     43assert.truthy(convertCalled);
     44assert.truthy(called);
     45called = false;
     46assert.eq(instance.exports.bar(), 25n);
     47assert.truthy(called, false);
  • trunk/JSTests/wasm/js-api/global-error.js

    r271145 r271168  
    196196    const module = new WebAssembly.Module(builder.WebAssembly().get());
    197197    let instance = new WebAssembly.Instance(module);
    198     assert.throws(() => instance.exports.bigInt.value, TypeError, "WebAssembly.Global.prototype.value does not work with i64 type");
     198    assert.eq(instance.exports.bigInt.value, 0n);
    199199}
    200200
     
    208208        .Global().GetGlobal("i64", 0, "immutable").End();
    209209    const module = new WebAssembly.Module(builder.WebAssembly().get());
    210     assert.throws(() => new WebAssembly.Instance(module, { imp: { global: undefined } }), WebAssembly.LinkError, "imported global imp:global cannot be an i64 (evaluating 'new WebAssembly.Instance(module, { imp: { global: undefined } })')");
    211 }
     210    assert.throws(() => new WebAssembly.Instance(module, { imp: { global: undefined } }), WebAssembly.LinkError, "imported global imp:global must be a BigInt (evaluating 'new WebAssembly.Instance(module, { imp: { global: undefined } })')");
     211}
  • trunk/JSTests/wasm/stress/immutable-globals.js

    r269552 r271168  
    8989        {
    9090            let binding = instance.exports.i64;
    91             assert.throws(() => binding.value, TypeError, `WebAssembly.Global.prototype.value does not work with i64 type`);
    92             assert.throws(() => binding.value = 42, TypeError, `WebAssembly.Global.prototype.value attempts to modify immutable global value`);
     91            assert.eq(binding.value, 0n);
     92            assert.throws(() => binding.value = 42n, TypeError, `WebAssembly.Global.prototype.value attempts to modify immutable global value`);
    9393            assert.eq(instance.exports.getI64AsI32(), 0);
    9494        }
  • trunk/JSTests/wasm/stress/mutable-globals.js

    r269552 r271168  
    138138        {
    139139            let binding = instance.exports.i64;
    140             assert.throws(() => binding.value, TypeError, `WebAssembly.Global.prototype.value does not work with i64 type`);
    141             assert.throws(() => binding.value = 42, TypeError, `WebAssembly.Global.prototype.value does not work with i64 type`);
    142             assert.eq(instance.exports.getI64AsI32(), 0);
     140            assert.eq(binding.value, 0n);
     141            assert.throws(() => binding.value = 42, TypeError, `Invalid argument type in ToBigInt operation`);
     142            binding.value = 42n;
     143            assert.eq(instance.exports.getI64AsI32(), 42);
    143144            instance.exports.setI32AsI64(20);
    144145            assert.eq(instance.exports.getI64AsI32(), 20);
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r271146 r271168  
     12021-01-05  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WASM] [BigInt] Add I64 to BigInt conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=213528
     5
     6        Reviewed by Michael Saboff.
     7
     8        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt:
     9        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt:
     10        * web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt:
     11        * web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt:
     12        * web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt:
     13        * web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt:
     14        * web-platform-tests/wasm/jsapi/global/value-get-set.any-expected.txt:
     15        * web-platform-tests/wasm/jsapi/global/value-get-set.any.worker-expected.txt:
     16        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt:
     17        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt:
     18        * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt:
     19        * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt:
     20        * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any-expected.txt:
     21        * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.worker-expected.txt:
     22        * web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt:
     23        * web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt:
     24
    1252021-01-05  Manuel Rego Casasnovas  <rego@igalia.com>
    226
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt

    r269866 r271168  
    1 CONSOLE MESSAGE: TypeError: WebAssembly.Global does not accept i64 initial value
    2 
    3 Harness Error (FAIL), message = TypeError: WebAssembly.Global does not accept i64 initial value
    41
    52PASS WebAssembly.instantiate(module): Non-object imports argument: null
     
    7875PASS WebAssembly.instantiate(module): Importing an i32 mutable global with an immutable Global object
    7976PASS WebAssembly.instantiate(module): Importing an i64 mutable global with a primitive value
     77PASS WebAssembly.instantiate(module): Importing an i64 mutable global with an immutable Global object
     78PASS WebAssembly.instantiate(module): Importing an f32 mutable global with a primitive value
     79PASS WebAssembly.instantiate(module): Importing an f32 mutable global with an immutable Global object
     80PASS WebAssembly.instantiate(module): Importing an f64 mutable global with a primitive value
     81PASS WebAssembly.instantiate(module): Importing an f64 mutable global with an immutable Global object
     82PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: undefined
     83PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: null
     84PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: true
     85PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: ""
     86PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: symbol "Symbol()"
     87PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: 1
     88PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: 0.1
     89PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: NaN
     90PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: plain object
     91PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory
     92PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype
     93PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype)
     94PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large)
     95PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: undefined
     96PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: null
     97PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: true
     98PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: ""
     99PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: symbol "Symbol()"
     100PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: 1
     101PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: 0.1
     102PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: NaN
     103PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: plain object
     104PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: WebAssembly.Table
     105PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: WebAssembly.Table.prototype
     106PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype)
     107PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: WebAssembly.Table object (too large)
     108PASS WebAssembly.instantiate(buffer): Non-object imports argument: null
     109PASS WebAssembly.instantiate(buffer): Non-object imports argument: true
     110PASS WebAssembly.instantiate(buffer): Non-object imports argument: ""
     111PASS WebAssembly.instantiate(buffer): Non-object imports argument: symbol "Symbol()"
     112PASS WebAssembly.instantiate(buffer): Non-object imports argument: 1
     113PASS WebAssembly.instantiate(buffer): Non-object imports argument: 0.1
     114PASS WebAssembly.instantiate(buffer): Non-object imports argument: NaN
     115PASS WebAssembly.instantiate(buffer): Non-object module: undefined
     116PASS WebAssembly.instantiate(buffer): Non-object module: null
     117PASS WebAssembly.instantiate(buffer): Non-object module: true
     118PASS WebAssembly.instantiate(buffer): Non-object module: ""
     119PASS WebAssembly.instantiate(buffer): Non-object module: symbol "Symbol()"
     120PASS WebAssembly.instantiate(buffer): Non-object module: 1
     121PASS WebAssembly.instantiate(buffer): Non-object module: 0.1
     122PASS WebAssembly.instantiate(buffer): Non-object module: NaN
     123PASS WebAssembly.instantiate(buffer): Missing imports argument
     124PASS WebAssembly.instantiate(buffer): Imports argument with missing property: undefined
     125PASS WebAssembly.instantiate(buffer): Imports argument with missing property: empty object
     126PASS WebAssembly.instantiate(buffer): Imports argument with missing property: wrong property
     127PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: undefined
     128PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: null
     129PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: true
     130PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: ""
     131PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: symbol "Symbol()"
     132PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: 1
     133PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: 0.1
     134PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: NaN
     135PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: object "[object Object]"
     136PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: undefined
     137PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: null
     138PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: true
     139PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: ""
     140PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: symbol "Symbol()"
     141PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: plain object
     142PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: WebAssembly.Global
     143PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: WebAssembly.Global.prototype
     144PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     145PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: BigInt
     146PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     147PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: undefined
     148PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: null
     149PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: true
     150PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: ""
     151PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: symbol "Symbol()"
     152PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: plain object
     153PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: WebAssembly.Global
     154PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: WebAssembly.Global.prototype
     155PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     156PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: Number
     157PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     158PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: undefined
     159PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: null
     160PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: true
     161PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: ""
     162PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: symbol "Symbol()"
     163PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: plain object
     164PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: WebAssembly.Global
     165PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: WebAssembly.Global.prototype
     166PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     167PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: BigInt
     168PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     169PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: undefined
     170PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: null
     171PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: true
     172PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: ""
     173PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: symbol "Symbol()"
     174PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: plain object
     175PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: WebAssembly.Global
     176PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: WebAssembly.Global.prototype
     177PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     178PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: BigInt
     179PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     180PASS WebAssembly.instantiate(buffer): Importing an i32 mutable global with a primitive value
     181PASS WebAssembly.instantiate(buffer): Importing an i32 mutable global with an immutable Global object
     182PASS WebAssembly.instantiate(buffer): Importing an i64 mutable global with a primitive value
     183PASS WebAssembly.instantiate(buffer): Importing an i64 mutable global with an immutable Global object
     184PASS WebAssembly.instantiate(buffer): Importing an f32 mutable global with a primitive value
     185PASS WebAssembly.instantiate(buffer): Importing an f32 mutable global with an immutable Global object
     186PASS WebAssembly.instantiate(buffer): Importing an f64 mutable global with a primitive value
     187PASS WebAssembly.instantiate(buffer): Importing an f64 mutable global with an immutable Global object
     188PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: undefined
     189PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: null
     190PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: true
     191PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: ""
     192PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: symbol "Symbol()"
     193PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: 1
     194PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: 0.1
     195PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: NaN
     196PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: plain object
     197PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: WebAssembly.Memory
     198PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype
     199PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype)
     200PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large)
     201PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: undefined
     202PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: null
     203PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: true
     204PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: ""
     205PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: symbol "Symbol()"
     206PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: 1
     207PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: 0.1
     208PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: NaN
     209PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: plain object
     210PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: WebAssembly.Table
     211PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: WebAssembly.Table.prototype
     212PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype)
     213PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: WebAssembly.Table object (too large)
    80214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt

    r269866 r271168  
    1 
    2 Harness Error (FAIL), message = Error in remote http://localhost:8800/wasm/jsapi/bad-imports.js: TypeError: WebAssembly.Global does not accept i64 initial value
    31
    42PASS WebAssembly.instantiate(module): Non-object imports argument: null
     
    7775PASS WebAssembly.instantiate(module): Importing an i32 mutable global with an immutable Global object
    7876PASS WebAssembly.instantiate(module): Importing an i64 mutable global with a primitive value
     77PASS WebAssembly.instantiate(module): Importing an i64 mutable global with an immutable Global object
     78PASS WebAssembly.instantiate(module): Importing an f32 mutable global with a primitive value
     79PASS WebAssembly.instantiate(module): Importing an f32 mutable global with an immutable Global object
     80PASS WebAssembly.instantiate(module): Importing an f64 mutable global with a primitive value
     81PASS WebAssembly.instantiate(module): Importing an f64 mutable global with an immutable Global object
     82PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: undefined
     83PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: null
     84PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: true
     85PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: ""
     86PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: symbol "Symbol()"
     87PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: 1
     88PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: 0.1
     89PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: NaN
     90PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: plain object
     91PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory
     92PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype
     93PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype)
     94PASS WebAssembly.instantiate(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large)
     95PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: undefined
     96PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: null
     97PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: true
     98PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: ""
     99PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: symbol "Symbol()"
     100PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: 1
     101PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: 0.1
     102PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: NaN
     103PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: plain object
     104PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: WebAssembly.Table
     105PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: WebAssembly.Table.prototype
     106PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype)
     107PASS WebAssembly.instantiate(module): Importing table with an incorrectly-typed value: WebAssembly.Table object (too large)
     108PASS WebAssembly.instantiate(buffer): Non-object imports argument: null
     109PASS WebAssembly.instantiate(buffer): Non-object imports argument: true
     110PASS WebAssembly.instantiate(buffer): Non-object imports argument: ""
     111PASS WebAssembly.instantiate(buffer): Non-object imports argument: symbol "Symbol()"
     112PASS WebAssembly.instantiate(buffer): Non-object imports argument: 1
     113PASS WebAssembly.instantiate(buffer): Non-object imports argument: 0.1
     114PASS WebAssembly.instantiate(buffer): Non-object imports argument: NaN
     115PASS WebAssembly.instantiate(buffer): Non-object module: undefined
     116PASS WebAssembly.instantiate(buffer): Non-object module: null
     117PASS WebAssembly.instantiate(buffer): Non-object module: true
     118PASS WebAssembly.instantiate(buffer): Non-object module: ""
     119PASS WebAssembly.instantiate(buffer): Non-object module: symbol "Symbol()"
     120PASS WebAssembly.instantiate(buffer): Non-object module: 1
     121PASS WebAssembly.instantiate(buffer): Non-object module: 0.1
     122PASS WebAssembly.instantiate(buffer): Non-object module: NaN
     123PASS WebAssembly.instantiate(buffer): Missing imports argument
     124PASS WebAssembly.instantiate(buffer): Imports argument with missing property: undefined
     125PASS WebAssembly.instantiate(buffer): Imports argument with missing property: empty object
     126PASS WebAssembly.instantiate(buffer): Imports argument with missing property: wrong property
     127PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: undefined
     128PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: null
     129PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: true
     130PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: ""
     131PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: symbol "Symbol()"
     132PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: 1
     133PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: 0.1
     134PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: NaN
     135PASS WebAssembly.instantiate(buffer): Importing a function with an incorrectly-typed value: object "[object Object]"
     136PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: undefined
     137PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: null
     138PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: true
     139PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: ""
     140PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: symbol "Symbol()"
     141PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: plain object
     142PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: WebAssembly.Global
     143PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: WebAssembly.Global.prototype
     144PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     145PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: BigInt
     146PASS WebAssembly.instantiate(buffer): Importing an i32 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     147PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: undefined
     148PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: null
     149PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: true
     150PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: ""
     151PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: symbol "Symbol()"
     152PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: plain object
     153PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: WebAssembly.Global
     154PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: WebAssembly.Global.prototype
     155PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     156PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: Number
     157PASS WebAssembly.instantiate(buffer): Importing an i64 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     158PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: undefined
     159PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: null
     160PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: true
     161PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: ""
     162PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: symbol "Symbol()"
     163PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: plain object
     164PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: WebAssembly.Global
     165PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: WebAssembly.Global.prototype
     166PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     167PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: BigInt
     168PASS WebAssembly.instantiate(buffer): Importing an f32 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     169PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: undefined
     170PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: null
     171PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: true
     172PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: ""
     173PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: symbol "Symbol()"
     174PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: plain object
     175PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: WebAssembly.Global
     176PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: WebAssembly.Global.prototype
     177PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: Object.create(WebAssembly.Global.prototype)
     178PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: BigInt
     179PASS WebAssembly.instantiate(buffer): Importing an f64 global with an incorrectly-typed value: WebAssembly.Global object (wrong value type)
     180PASS WebAssembly.instantiate(buffer): Importing an i32 mutable global with a primitive value
     181PASS WebAssembly.instantiate(buffer): Importing an i32 mutable global with an immutable Global object
     182PASS WebAssembly.instantiate(buffer): Importing an i64 mutable global with a primitive value
     183PASS WebAssembly.instantiate(buffer): Importing an i64 mutable global with an immutable Global object
     184PASS WebAssembly.instantiate(buffer): Importing an f32 mutable global with a primitive value
     185PASS WebAssembly.instantiate(buffer): Importing an f32 mutable global with an immutable Global object
     186PASS WebAssembly.instantiate(buffer): Importing an f64 mutable global with a primitive value
     187PASS WebAssembly.instantiate(buffer): Importing an f64 mutable global with an immutable Global object
     188PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: undefined
     189PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: null
     190PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: true
     191PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: ""
     192PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: symbol "Symbol()"
     193PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: 1
     194PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: 0.1
     195PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: NaN
     196PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: plain object
     197PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: WebAssembly.Memory
     198PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype
     199PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype)
     200PASS WebAssembly.instantiate(buffer): Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large)
     201PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: undefined
     202PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: null
     203PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: true
     204PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: ""
     205PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: symbol "Symbol()"
     206PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: 1
     207PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: 0.1
     208PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: NaN
     209PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: plain object
     210PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: WebAssembly.Table
     211PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: WebAssembly.Table.prototype
     212PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype)
     213PASS WebAssembly.instantiate(buffer): Importing table with an incorrectly-typed value: WebAssembly.Table object (too large)
    79214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt

    r271112 r271168  
    1818PASS exports and imports: BufferSource argument
    1919PASS exports and imports: Module argument
    20 FAIL i64 exports and imports: BufferSource argument promise_test: Unhandled rejection with value: object "LinkError: imported global module:global cannot be an i64"
    21 FAIL i64 exports and imports: Module argument promise_test: Unhandled rejection with value: object "LinkError: imported global module:global cannot be an i64"
     20PASS i64 exports and imports: BufferSource argument
     21PASS i64 exports and imports: Module argument
    2222PASS import with i32-returning function: BufferSource argument
    2323PASS import with i32-returning function: Module argument
    2424PASS import with function that takes and returns i32: BufferSource argument
    2525PASS import with function that takes and returns i32: Module argument
    26 FAIL import with i64-returning function: BufferSource argument assert_true: Should have called into JS expected true got false
    27 FAIL import with i64-returning function: Module argument assert_true: Should have called into JS expected true got false
    28 FAIL import with function that takes and returns i64: BufferSource argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn2()')"
    29 FAIL import with function that takes and returns i64: Module argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn2()')"
     26PASS import with i64-returning function: BufferSource argument
     27PASS import with i64-returning function: Module argument
     28PASS import with function that takes and returns i64: BufferSource argument
     29PASS import with function that takes and returns i64: Module argument
    3030PASS import with i32-taking function: BufferSource argument
    3131PASS import with i32-taking function: Module argument
    32 FAIL import with i64-taking function: BufferSource argument assert_throws_js: function "() => instance.exports.fn(6)" threw object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'instance.exports.fn(6)')" ("RuntimeError") expected instance of function "function TypeError() {
    33     [native code]
    34 }" ("TypeError")
    35 FAIL import with i64-taking function: Module argument assert_throws_js: function "() => instance.exports.fn(6)" threw object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'instance.exports.fn(6)')" ("RuntimeError") expected instance of function "function TypeError() {
    36     [native code]
    37 }" ("TypeError")
    38 FAIL export i64-returning function: BufferSource argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn()')"
    39 FAIL export i64-returning function: Module argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn()')"
     32PASS import with i64-taking function: BufferSource argument
     33PASS import with i64-taking function: Module argument
     34PASS export i64-returning function: BufferSource argument
     35PASS export i64-returning function: Module argument
    4036PASS i32 mutable WebAssembly.Global import: BufferSource argument
    4137PASS i32 mutable WebAssembly.Global import: Module argument
    42 FAIL i64 mutable WebAssembly.Global import: BufferSource argument WebAssembly.Global does not accept i64 initial value
    43 FAIL i64 mutable WebAssembly.Global import: Module argument WebAssembly.Global does not accept i64 initial value
    44 FAIL Multiple i64 arguments: BufferSource argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'fn(1n, 0n)')"
    45 FAIL Multiple i64 arguments: Module argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'fn(1n, 0n)')"
     38PASS i64 mutable WebAssembly.Global import: BufferSource argument
     39PASS i64 mutable WebAssembly.Global import: Module argument
     40PASS Multiple i64 arguments: BufferSource argument
     41PASS Multiple i64 arguments: Module argument
    4642PASS stray argument: BufferSource argument
    4743PASS stray argument: Module argument
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt

    r271112 r271168  
    1818PASS exports and imports: BufferSource argument
    1919PASS exports and imports: Module argument
    20 FAIL i64 exports and imports: BufferSource argument promise_test: Unhandled rejection with value: object "LinkError: imported global module:global cannot be an i64"
    21 FAIL i64 exports and imports: Module argument promise_test: Unhandled rejection with value: object "LinkError: imported global module:global cannot be an i64"
     20PASS i64 exports and imports: BufferSource argument
     21PASS i64 exports and imports: Module argument
    2222PASS import with i32-returning function: BufferSource argument
    2323PASS import with i32-returning function: Module argument
    2424PASS import with function that takes and returns i32: BufferSource argument
    2525PASS import with function that takes and returns i32: Module argument
    26 FAIL import with i64-returning function: BufferSource argument assert_true: Should have called into JS expected true got false
    27 FAIL import with i64-returning function: Module argument assert_true: Should have called into JS expected true got false
    28 FAIL import with function that takes and returns i64: BufferSource argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn2()')"
    29 FAIL import with function that takes and returns i64: Module argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn2()')"
     26PASS import with i64-returning function: BufferSource argument
     27PASS import with i64-returning function: Module argument
     28PASS import with function that takes and returns i64: BufferSource argument
     29PASS import with function that takes and returns i64: Module argument
    3030PASS import with i32-taking function: BufferSource argument
    3131PASS import with i32-taking function: Module argument
    32 FAIL import with i64-taking function: BufferSource argument assert_throws_js: function "() => instance.exports.fn(6)" threw object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'instance.exports.fn(6)')" ("RuntimeError") expected instance of function "function TypeError() {
    33     [native code]
    34 }" ("TypeError")
    35 FAIL import with i64-taking function: Module argument assert_throws_js: function "() => instance.exports.fn(6)" threw object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'instance.exports.fn(6)')" ("RuntimeError") expected instance of function "function TypeError() {
    36     [native code]
    37 }" ("TypeError")
    38 FAIL export i64-returning function: BufferSource argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn()')"
    39 FAIL export i64-returning function: Module argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn()')"
     32PASS import with i64-taking function: BufferSource argument
     33PASS import with i64-taking function: Module argument
     34PASS export i64-returning function: BufferSource argument
     35PASS export i64-returning function: Module argument
    4036PASS i32 mutable WebAssembly.Global import: BufferSource argument
    4137PASS i32 mutable WebAssembly.Global import: Module argument
    42 FAIL i64 mutable WebAssembly.Global import: BufferSource argument WebAssembly.Global does not accept i64 initial value
    43 FAIL i64 mutable WebAssembly.Global import: Module argument WebAssembly.Global does not accept i64 initial value
    44 FAIL Multiple i64 arguments: BufferSource argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'fn(1n, 0n)')"
    45 FAIL Multiple i64 arguments: Module argument promise_test: Unhandled rejection with value: object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'fn(1n, 0n)')"
     38PASS i64 mutable WebAssembly.Global import: BufferSource argument
     39PASS i64 mutable WebAssembly.Global import: Module argument
     40PASS Multiple i64 arguments: BufferSource argument
     41PASS Multiple i64 arguments: Module argument
    4642PASS stray argument: BufferSource argument
    4743PASS stray argument: Module argument
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt

    r269866 r271168  
    77PASS Invalid descriptor argument
    88PASS Invalid type argument
    9 FAIL i64 with default WebAssembly.Global.prototype.value does not work with i64 type
     9PASS i64 with default
    1010PASS Default value for type i32
    1111PASS Explicit value undefined for type i32
     
    4444PASS Explicit value object with valueOf returning number for type f64
    4545PASS BigInt value for type f64
    46 FAIL Explicit value undefined for type i64 WebAssembly.Global.prototype.value does not work with i64 type
    47 FAIL Explicit value true for type i64 WebAssembly.Global does not accept i64 initial value
    48 FAIL Explicit value false for type i64 WebAssembly.Global does not accept i64 initial value
    49 FAIL Explicit value "3" for type i64 WebAssembly.Global does not accept i64 initial value
    50 FAIL Explicit value bigint "123" for type i64 WebAssembly.Global does not accept i64 initial value
    51 FAIL Explicit value object with toString returning string for type i64 WebAssembly.Global does not accept i64 initial value
    52 FAIL Explicit value object with valueOf returning string for type i64 WebAssembly.Global does not accept i64 initial value
    53 FAIL Explicit value object with toString returning bigint for type i64 WebAssembly.Global does not accept i64 initial value
    54 FAIL Explicit value object with valueOf returning bigint for type i64 WebAssembly.Global does not accept i64 initial value
     46PASS Explicit value undefined for type i64
     47PASS Explicit value true for type i64
     48PASS Explicit value false for type i64
     49PASS Explicit value "3" for type i64
     50PASS Explicit value bigint "123" for type i64
     51PASS Explicit value object with toString returning string for type i64
     52PASS Explicit value object with valueOf returning string for type i64
     53PASS Explicit value object with toString returning bigint for type i64
     54PASS Explicit value object with valueOf returning bigint for type i64
    5555PASS Pass non-bigint as i64 Global value: null
    5656PASS Pass non-bigint as i64 Global value: 666
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt

    r269866 r271168  
    77PASS Invalid descriptor argument
    88PASS Invalid type argument
    9 FAIL i64 with default WebAssembly.Global.prototype.value does not work with i64 type
     9PASS i64 with default
    1010PASS Default value for type i32
    1111PASS Explicit value undefined for type i32
     
    4444PASS Explicit value object with valueOf returning number for type f64
    4545PASS BigInt value for type f64
    46 FAIL Explicit value undefined for type i64 WebAssembly.Global.prototype.value does not work with i64 type
    47 FAIL Explicit value true for type i64 WebAssembly.Global does not accept i64 initial value
    48 FAIL Explicit value false for type i64 WebAssembly.Global does not accept i64 initial value
    49 FAIL Explicit value "3" for type i64 WebAssembly.Global does not accept i64 initial value
    50 FAIL Explicit value bigint "123" for type i64 WebAssembly.Global does not accept i64 initial value
    51 FAIL Explicit value object with toString returning string for type i64 WebAssembly.Global does not accept i64 initial value
    52 FAIL Explicit value object with valueOf returning string for type i64 WebAssembly.Global does not accept i64 initial value
    53 FAIL Explicit value object with toString returning bigint for type i64 WebAssembly.Global does not accept i64 initial value
    54 FAIL Explicit value object with valueOf returning bigint for type i64 WebAssembly.Global does not accept i64 initial value
     46PASS Explicit value undefined for type i64
     47PASS Explicit value true for type i64
     48PASS Explicit value false for type i64
     49PASS Explicit value "3" for type i64
     50PASS Explicit value bigint "123" for type i64
     51PASS Explicit value object with toString returning string for type i64
     52PASS Explicit value object with valueOf returning string for type i64
     53PASS Explicit value object with toString returning bigint for type i64
     54PASS Explicit value object with valueOf returning bigint for type i64
    5555PASS Pass non-bigint as i64 Global value: null
    5656PASS Pass non-bigint as i64 Global value: 666
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-get-set.any-expected.txt

    r269866 r271168  
    1717PASS Mutable i32 (string)
    1818PASS Mutable i32 (true on prototype)
    19 FAIL Immutable i64 (missing) WebAssembly.Global.prototype.value does not work with i64 type
    20 FAIL Immutable i64 with ToNumber side-effects (missing) WebAssembly.Global.prototype.value does not work with i64 type
    21 FAIL Immutable i64 (undefined) WebAssembly.Global.prototype.value does not work with i64 type
    22 FAIL Immutable i64 with ToNumber side-effects (undefined) WebAssembly.Global.prototype.value does not work with i64 type
    23 FAIL Immutable i64 (null) WebAssembly.Global.prototype.value does not work with i64 type
    24 FAIL Immutable i64 with ToNumber side-effects (null) WebAssembly.Global.prototype.value does not work with i64 type
    25 FAIL Immutable i64 (false) WebAssembly.Global.prototype.value does not work with i64 type
    26 FAIL Immutable i64 with ToNumber side-effects (false) WebAssembly.Global.prototype.value does not work with i64 type
    27 FAIL Immutable i64 (empty string) WebAssembly.Global.prototype.value does not work with i64 type
    28 FAIL Immutable i64 with ToNumber side-effects (empty string) WebAssembly.Global.prototype.value does not work with i64 type
    29 FAIL Immutable i64 (zero) WebAssembly.Global.prototype.value does not work with i64 type
    30 FAIL Immutable i64 with ToNumber side-effects (zero) WebAssembly.Global.prototype.value does not work with i64 type
    31 FAIL Mutable i64 (true) WebAssembly.Global.prototype.value does not work with i64 type
    32 FAIL Mutable i64 (one) WebAssembly.Global.prototype.value does not work with i64 type
    33 FAIL Mutable i64 (string) WebAssembly.Global.prototype.value does not work with i64 type
    34 FAIL Mutable i64 (true on prototype) WebAssembly.Global.prototype.value does not work with i64 type
     19PASS Immutable i64 (missing)
     20PASS Immutable i64 with ToNumber side-effects (missing)
     21PASS Immutable i64 (undefined)
     22PASS Immutable i64 with ToNumber side-effects (undefined)
     23PASS Immutable i64 (null)
     24PASS Immutable i64 with ToNumber side-effects (null)
     25PASS Immutable i64 (false)
     26PASS Immutable i64 with ToNumber side-effects (false)
     27PASS Immutable i64 (empty string)
     28PASS Immutable i64 with ToNumber side-effects (empty string)
     29PASS Immutable i64 (zero)
     30PASS Immutable i64 with ToNumber side-effects (zero)
     31PASS Mutable i64 (true)
     32PASS Mutable i64 (one)
     33PASS Mutable i64 (string)
     34PASS Mutable i64 (true on prototype)
    3535PASS Immutable f32 (missing)
    3636PASS Immutable f32 with ToNumber side-effects (missing)
     
    6565PASS Mutable f64 (string)
    6666PASS Mutable f64 (true on prototype)
    67 FAIL i64 mutability WebAssembly.Global.prototype.value does not work with i64 type
     67PASS i64 mutability
    6868PASS Calling setter without argument
    6969PASS Stray argument
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-get-set.any.worker-expected.txt

    r269866 r271168  
    1717PASS Mutable i32 (string)
    1818PASS Mutable i32 (true on prototype)
    19 FAIL Immutable i64 (missing) WebAssembly.Global.prototype.value does not work with i64 type
    20 FAIL Immutable i64 with ToNumber side-effects (missing) WebAssembly.Global.prototype.value does not work with i64 type
    21 FAIL Immutable i64 (undefined) WebAssembly.Global.prototype.value does not work with i64 type
    22 FAIL Immutable i64 with ToNumber side-effects (undefined) WebAssembly.Global.prototype.value does not work with i64 type
    23 FAIL Immutable i64 (null) WebAssembly.Global.prototype.value does not work with i64 type
    24 FAIL Immutable i64 with ToNumber side-effects (null) WebAssembly.Global.prototype.value does not work with i64 type
    25 FAIL Immutable i64 (false) WebAssembly.Global.prototype.value does not work with i64 type
    26 FAIL Immutable i64 with ToNumber side-effects (false) WebAssembly.Global.prototype.value does not work with i64 type
    27 FAIL Immutable i64 (empty string) WebAssembly.Global.prototype.value does not work with i64 type
    28 FAIL Immutable i64 with ToNumber side-effects (empty string) WebAssembly.Global.prototype.value does not work with i64 type
    29 FAIL Immutable i64 (zero) WebAssembly.Global.prototype.value does not work with i64 type
    30 FAIL Immutable i64 with ToNumber side-effects (zero) WebAssembly.Global.prototype.value does not work with i64 type
    31 FAIL Mutable i64 (true) WebAssembly.Global.prototype.value does not work with i64 type
    32 FAIL Mutable i64 (one) WebAssembly.Global.prototype.value does not work with i64 type
    33 FAIL Mutable i64 (string) WebAssembly.Global.prototype.value does not work with i64 type
    34 FAIL Mutable i64 (true on prototype) WebAssembly.Global.prototype.value does not work with i64 type
     19PASS Immutable i64 (missing)
     20PASS Immutable i64 with ToNumber side-effects (missing)
     21PASS Immutable i64 (undefined)
     22PASS Immutable i64 with ToNumber side-effects (undefined)
     23PASS Immutable i64 (null)
     24PASS Immutable i64 with ToNumber side-effects (null)
     25PASS Immutable i64 (false)
     26PASS Immutable i64 with ToNumber side-effects (false)
     27PASS Immutable i64 (empty string)
     28PASS Immutable i64 with ToNumber side-effects (empty string)
     29PASS Immutable i64 (zero)
     30PASS Immutable i64 with ToNumber side-effects (zero)
     31PASS Mutable i64 (true)
     32PASS Mutable i64 (one)
     33PASS Mutable i64 (string)
     34PASS Mutable i64 (true on prototype)
    3535PASS Immutable f32 (missing)
    3636PASS Immutable f32 with ToNumber side-effects (missing)
     
    6565PASS Mutable f64 (string)
    6666PASS Mutable f64 (true on prototype)
    67 FAIL i64 mutability WebAssembly.Global.prototype.value does not work with i64 type
     67PASS i64 mutability
    6868PASS Calling setter without argument
    6969PASS Stray argument
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt

    r269866 r271168  
    1 CONSOLE MESSAGE: TypeError: WebAssembly.Global does not accept i64 initial value
    2 
    3 Harness Error (FAIL), message = TypeError: WebAssembly.Global does not accept i64 initial value
    41
    52PASS new WebAssembly.Instance(module): Non-object imports argument: null
     
    7875PASS new WebAssembly.Instance(module): Importing an i32 mutable global with an immutable Global object
    7976PASS new WebAssembly.Instance(module): Importing an i64 mutable global with a primitive value
     77PASS new WebAssembly.Instance(module): Importing an i64 mutable global with an immutable Global object
     78PASS new WebAssembly.Instance(module): Importing an f32 mutable global with a primitive value
     79PASS new WebAssembly.Instance(module): Importing an f32 mutable global with an immutable Global object
     80PASS new WebAssembly.Instance(module): Importing an f64 mutable global with a primitive value
     81PASS new WebAssembly.Instance(module): Importing an f64 mutable global with an immutable Global object
     82PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: undefined
     83PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: null
     84PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: true
     85PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: ""
     86PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: symbol "Symbol()"
     87PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: 1
     88PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: 0.1
     89PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: NaN
     90PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: plain object
     91PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory
     92PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype
     93PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype)
     94PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large)
     95PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: undefined
     96PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: null
     97PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: true
     98PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: ""
     99PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: symbol "Symbol()"
     100PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: 1
     101PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: 0.1
     102PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: NaN
     103PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: plain object
     104PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: WebAssembly.Table
     105PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: WebAssembly.Table.prototype
     106PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype)
     107PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: WebAssembly.Table object (too large)
    80108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt

    r269866 r271168  
    1 CONSOLE MESSAGE: TypeError: WebAssembly.Global does not accept i64 initial value
    2 
    3 Harness Error (FAIL), message = TypeError: WebAssembly.Global does not accept i64 initial value
    41
    52PASS new WebAssembly.Instance(module): Non-object imports argument: null
     
    7875PASS new WebAssembly.Instance(module): Importing an i32 mutable global with an immutable Global object
    7976PASS new WebAssembly.Instance(module): Importing an i64 mutable global with a primitive value
     77PASS new WebAssembly.Instance(module): Importing an i64 mutable global with an immutable Global object
     78PASS new WebAssembly.Instance(module): Importing an f32 mutable global with a primitive value
     79PASS new WebAssembly.Instance(module): Importing an f32 mutable global with an immutable Global object
     80PASS new WebAssembly.Instance(module): Importing an f64 mutable global with a primitive value
     81PASS new WebAssembly.Instance(module): Importing an f64 mutable global with an immutable Global object
     82PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: undefined
     83PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: null
     84PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: true
     85PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: ""
     86PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: symbol "Symbol()"
     87PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: 1
     88PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: 0.1
     89PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: NaN
     90PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: plain object
     91PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory
     92PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype
     93PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype)
     94PASS new WebAssembly.Instance(module): Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large)
     95PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: undefined
     96PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: null
     97PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: true
     98PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: ""
     99PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: symbol "Symbol()"
     100PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: 1
     101PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: 0.1
     102PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: NaN
     103PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: plain object
     104PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: WebAssembly.Table
     105PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: WebAssembly.Table.prototype
     106PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype)
     107PASS new WebAssembly.Instance(module): Importing table with an incorrectly-typed value: WebAssembly.Table object (too large)
    80108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt

    r271112 r271168  
    1212PASS No imports
    1313PASS exports and imports
    14 FAIL i64 exports and imports imported global module:global cannot be an i64 (evaluating 'new WebAssembly.Instance(module, ...args)')
     14PASS i64 exports and imports
    1515PASS import with i32-returning function
    1616PASS import with function that takes and returns i32
    17 FAIL import with i64-returning function assert_true: Should have called into JS expected true got false
    18 FAIL import with function that takes and returns i64 WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn2()')
     17PASS import with i64-returning function
     18PASS import with function that takes and returns i64
    1919PASS import with i32-taking function
    20 FAIL import with i64-taking function assert_throws_js: function "() => instance.exports.fn(6)" threw object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'instance.exports.fn(6)')" ("RuntimeError") expected instance of function "function TypeError() {
    21     [native code]
    22 }" ("TypeError")
    23 FAIL export i64-returning function WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn()')
     20PASS import with i64-taking function
     21PASS export i64-returning function
    2422PASS i32 mutable WebAssembly.Global import
    25 FAIL i64 mutable WebAssembly.Global import WebAssembly.Global does not accept i64 initial value
    26 FAIL Multiple i64 arguments WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'fn(1n, 0n)')
     23PASS i64 mutable WebAssembly.Global import
     24PASS Multiple i64 arguments
    2725PASS stray argument
    2826
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt

    r271112 r271168  
    1212PASS No imports
    1313PASS exports and imports
    14 FAIL i64 exports and imports imported global module:global cannot be an i64 (evaluating 'new WebAssembly.Instance(module, ...args)')
     14PASS i64 exports and imports
    1515PASS import with i32-returning function
    1616PASS import with function that takes and returns i32
    17 FAIL import with i64-returning function assert_true: Should have called into JS expected true got false
    18 FAIL import with function that takes and returns i64 WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn2()')
     17PASS import with i64-returning function
     18PASS import with function that takes and returns i64
    1919PASS import with i32-taking function
    20 FAIL import with i64-taking function assert_throws_js: function "() => instance.exports.fn(6)" threw object "RuntimeError: WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'instance.exports.fn(6)')" ("RuntimeError") expected instance of function "function TypeError() {
    21     [native code]
    22 }" ("TypeError")
    23 FAIL export i64-returning function WebAssembly function that returns i64 can't be called from JavaScript (evaluating 'instance.exports.fn()')
     20PASS import with i64-taking function
     21PASS export i64-returning function
    2422PASS i32 mutable WebAssembly.Global import
    25 FAIL i64 mutable WebAssembly.Global import WebAssembly.Global does not accept i64 initial value
    26 FAIL Multiple i64 arguments WebAssembly function with an i64 argument can't be called from JavaScript (evaluating 'fn(1n, 0n)')
     23PASS i64 mutable WebAssembly.Global import
     24PASS Multiple i64 arguments
    2725PASS stray argument
    2826
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any-expected.txt

    r269866 r271168  
    1 CONSOLE MESSAGE: TypeError: WebAssembly.Global does not accept i64 initial value
    2 
    3 Harness Error (FAIL), message = TypeError: WebAssembly.Global does not accept i64 initial value
    41
    52FAIL Non-object imports argument: null WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     
    7875FAIL Importing an i32 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
    7976FAIL Importing an i64 mutable global with a primitive value WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     77FAIL Importing an i64 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     78FAIL Importing an f32 mutable global with a primitive value WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     79FAIL Importing an f32 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     80FAIL Importing an f64 mutable global with a primitive value WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     81FAIL Importing an f64 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     82FAIL Importing memory with an incorrectly-typed value: undefined WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     83FAIL Importing memory with an incorrectly-typed value: null WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     84FAIL Importing memory with an incorrectly-typed value: true WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     85FAIL Importing memory with an incorrectly-typed value: "" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     86FAIL Importing memory with an incorrectly-typed value: symbol "Symbol()" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     87FAIL Importing memory with an incorrectly-typed value: 1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     88FAIL Importing memory with an incorrectly-typed value: 0.1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     89FAIL Importing memory with an incorrectly-typed value: NaN WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     90FAIL Importing memory with an incorrectly-typed value: plain object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     91FAIL Importing memory with an incorrectly-typed value: WebAssembly.Memory WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     92FAIL Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     93FAIL Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     94FAIL Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     95FAIL Importing table with an incorrectly-typed value: undefined WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     96FAIL Importing table with an incorrectly-typed value: null WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     97FAIL Importing table with an incorrectly-typed value: true WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     98FAIL Importing table with an incorrectly-typed value: "" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     99FAIL Importing table with an incorrectly-typed value: symbol "Symbol()" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     100FAIL Importing table with an incorrectly-typed value: 1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     101FAIL Importing table with an incorrectly-typed value: 0.1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     102FAIL Importing table with an incorrectly-typed value: NaN WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     103FAIL Importing table with an incorrectly-typed value: plain object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     104FAIL Importing table with an incorrectly-typed value: WebAssembly.Table WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     105FAIL Importing table with an incorrectly-typed value: WebAssembly.Table.prototype WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     106FAIL Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     107FAIL Importing table with an incorrectly-typed value: WebAssembly.Table object (too large) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
    80108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.worker-expected.txt

    r269866 r271168  
    1 CONSOLE MESSAGE: TypeError: WebAssembly.Global does not accept i64 initial value
    2 
    3 Harness Error (FAIL), message = TypeError: WebAssembly.Global does not accept i64 initial value
    41
    52FAIL Non-object imports argument: null WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     
    7875FAIL Importing an i32 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
    7976FAIL Importing an i64 mutable global with a primitive value WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     77FAIL Importing an i64 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     78FAIL Importing an f32 mutable global with a primitive value WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     79FAIL Importing an f32 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     80FAIL Importing an f64 mutable global with a primitive value WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     81FAIL Importing an f64 mutable global with an immutable Global object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     82FAIL Importing memory with an incorrectly-typed value: undefined WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     83FAIL Importing memory with an incorrectly-typed value: null WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     84FAIL Importing memory with an incorrectly-typed value: true WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     85FAIL Importing memory with an incorrectly-typed value: "" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     86FAIL Importing memory with an incorrectly-typed value: symbol "Symbol()" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     87FAIL Importing memory with an incorrectly-typed value: 1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     88FAIL Importing memory with an incorrectly-typed value: 0.1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     89FAIL Importing memory with an incorrectly-typed value: NaN WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     90FAIL Importing memory with an incorrectly-typed value: plain object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     91FAIL Importing memory with an incorrectly-typed value: WebAssembly.Memory WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     92FAIL Importing memory with an incorrectly-typed value: WebAssembly.Memory.prototype WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     93FAIL Importing memory with an incorrectly-typed value: Object.create(WebAssembly.Memory.prototype) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     94FAIL Importing memory with an incorrectly-typed value: WebAssembly.Memory object (too large) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     95FAIL Importing table with an incorrectly-typed value: undefined WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     96FAIL Importing table with an incorrectly-typed value: null WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     97FAIL Importing table with an incorrectly-typed value: true WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     98FAIL Importing table with an incorrectly-typed value: "" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     99FAIL Importing table with an incorrectly-typed value: symbol "Symbol()" WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     100FAIL Importing table with an incorrectly-typed value: 1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     101FAIL Importing table with an incorrectly-typed value: 0.1 WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     102FAIL Importing table with an incorrectly-typed value: NaN WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     103FAIL Importing table with an incorrectly-typed value: plain object WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     104FAIL Importing table with an incorrectly-typed value: WebAssembly.Table WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     105FAIL Importing table with an incorrectly-typed value: WebAssembly.Table.prototype WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     106FAIL Importing table with an incorrectly-typed value: Object.create(WebAssembly.Table.prototype) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
     107FAIL Importing table with an incorrectly-typed value: WebAssembly.Table object (too large) WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)
    80108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt

    r269866 r271168  
    1616FAIL export i64-returning function promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    1717FAIL i32 mutable WebAssembly.Global import promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    18 FAIL i64 mutable WebAssembly.Global import promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.Global does not accept i64 initial value"
     18FAIL i64 mutable WebAssembly.Global import promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    1919FAIL Multiple i64 arguments promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    2020FAIL stray argument promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt

    r269866 r271168  
    1616FAIL export i64-returning function promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    1717FAIL i32 mutable WebAssembly.Global import promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    18 FAIL i64 mutable WebAssembly.Global import promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.Global does not accept i64 initial value"
     18FAIL i64 mutable WebAssembly.Global import promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    1919FAIL Multiple i64 arguments promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
    2020FAIL stray argument promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
  • trunk/Source/JavaScriptCore/ChangeLog

    r271164 r271168  
     12021-01-05  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WASM] [BigInt] Add I64 to BigInt conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=213528
     5
     6        Reviewed by Michael Saboff.
     7
     8        This patch implements i64 to BigInt / BigInt to i64 support in WebAssembly to expose i64 features to JS.
     9
     10            1. Arguments of exposed wasm functions can have i64.
     11            2. Returned values of exposed wasm functions can have i64.
     12            3. WebAssembly.Global can expose i64 value to JS.
     13
     14        Currently, we do not support fast JS->Wasm IC for wasm functions including i64 arguments. But this should be supported later
     15        in https://bugs.webkit.org/show_bug.cgi?id=220053.
     16
     17        * jsc.cpp:
     18        (JSC_DEFINE_HOST_FUNCTION):
     19        * runtime/BigIntConstructor.cpp:
     20        (JSC::JSC_DEFINE_HOST_FUNCTION):
     21        (JSC::toBigInt): Deleted.
     22        * runtime/BigIntConstructor.h:
     23        * runtime/JSBigInt.cpp:
     24        (JSC::JSBigInt::toBigUInt64Heap):
     25        * runtime/JSBigInt.h:
     26        * runtime/JSCJSValue.cpp:
     27        (JSC::JSValue::toBigInt const):
     28        (JSC::JSValue::toBigInt64 const):
     29        (JSC::JSValue::toBigUInt64 const):
     30        * runtime/JSCJSValue.h:
     31        * wasm/WasmExceptionType.h:
     32        * wasm/WasmGlobal.cpp:
     33        (JSC::Wasm::Global::get const):
     34        (JSC::Wasm::Global::set):
     35        * wasm/WasmGlobal.h:
     36        * wasm/WasmOperations.cpp:
     37        (JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
     38        * wasm/WasmOperations.h:
     39        * wasm/js/JSToWasm.cpp:
     40        (JSC::Wasm::marshallJSResult):
     41        (JSC::Wasm::createJSToWasmWrapper):
     42        (JSC::Wasm::boxWasmResult): Deleted.
     43        * wasm/js/WasmToJS.cpp:
     44        (JSC::Wasm::wasmToJS):
     45        (JSC::Wasm::handleBadI64Use): Deleted.
     46        * wasm/js/WebAssemblyFunction.cpp:
     47        (JSC::JSC_DEFINE_HOST_FUNCTION):
     48        (JSC::WebAssemblyFunction::jsCallEntrypointSlow):
     49        * wasm/js/WebAssemblyGlobalConstructor.cpp:
     50        (JSC::JSC_DEFINE_HOST_FUNCTION):
     51        * wasm/js/WebAssemblyGlobalPrototype.cpp:
     52        (JSC::JSC_DEFINE_HOST_FUNCTION):
     53        * wasm/js/WebAssemblyModuleRecord.cpp:
     54        (JSC::WebAssemblyModuleRecord::link):
     55
    1562021-01-05  Alexey Shvayka  <shvaikalesh@gmail.com>
    257
  • trunk/Source/JavaScriptCore/jsc.cpp

    r270764 r271168  
    24162416    auto scope = DECLARE_THROW_SCOPE(vm);
    24172417    JSValue argument = callFrame->argument(0);
    2418     JSValue bigInt = toBigInt(globalObject, argument);
     2418    JSValue bigInt = argument.toBigInt(globalObject);
    24192419    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    24202420#if USE(BIGINT32)
     
    24352435    auto scope = DECLARE_THROW_SCOPE(vm);
    24362436    JSValue argument = callFrame->argument(0);
    2437     JSValue bigIntValue = toBigInt(globalObject, argument);
     2437    JSValue bigIntValue = argument.toBigInt(globalObject);
    24382438    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    24392439    if (bigIntValue.isBigInt32())
  • trunk/Source/JavaScriptCore/runtime/BigIntConstructor.cpp

    r268322 r271168  
    7373// ------------------------------ Functions ---------------------------
    7474
    75 JSValue toBigInt(JSGlobalObject* globalObject, JSValue argument)
    76 {
    77     VM& vm = globalObject->vm();
    78     auto scope = DECLARE_THROW_SCOPE(vm);
    79 
    80     JSValue primitive = argument.toPrimitive(globalObject);
    81     RETURN_IF_EXCEPTION(scope, { });
    82    
    83     if (primitive.isBigInt())
    84         return primitive;
    85 
    86     if (primitive.isBoolean()) {
    87 #if USE(BIGINT32)
    88         return jsBigInt32(primitive.asBoolean());
    89 #else
    90         RELEASE_AND_RETURN(scope, JSBigInt::createFrom(globalObject, primitive.asBoolean()));
    91 #endif
    92     }
    93 
    94     if (primitive.isString()) {
    95         scope.release();
    96         return toStringView(globalObject, primitive, [&] (StringView view) {
    97             return JSBigInt::parseInt(globalObject, view);
    98         });
    99     }
    100 
    101     ASSERT(primitive.isUndefinedOrNull() || primitive.isNumber() || primitive.isSymbol());
    102     throwTypeError(globalObject, scope, "Invalid argument type in ToBigInt operation"_s);
    103     return jsUndefined();
    104 }
    105 
    10675JSC_DEFINE_HOST_FUNCTION(callBigIntConstructor, (JSGlobalObject* globalObject, CallFrame* callFrame))
    10776{
     
    12897    }
    12998
    130     RELEASE_AND_RETURN(scope, JSValue::encode(toBigInt(globalObject, primitive)));
     99    RELEASE_AND_RETURN(scope, JSValue::encode(primitive.toBigInt(globalObject)));
    131100}
    132101
     
    146115    RETURN_IF_EXCEPTION(scope, { });
    147116
    148     JSValue bigInt = toBigInt(globalObject, callFrame->argument(1));
     117    JSValue bigInt = callFrame->argument(1).toBigInt(globalObject);
    149118    RETURN_IF_EXCEPTION(scope, { });
    150119
     
    166135    RETURN_IF_EXCEPTION(scope, { });
    167136
    168     JSValue bigInt = toBigInt(globalObject, callFrame->argument(1));
     137    JSValue bigInt = callFrame->argument(1).toBigInt(globalObject);
    169138    RETURN_IF_EXCEPTION(scope, { });
    170139
  • trunk/Source/JavaScriptCore/runtime/BigIntConstructor.h

    r260490 r271168  
    5959STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(BigIntConstructor, InternalFunction);
    6060
    61 JS_EXPORT_PRIVATE JSValue toBigInt(JSGlobalObject*, JSValue);
    62 
    6361} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSBigInt.cpp

    r270766 r271168  
    30443044#endif
    30453045
     3046uint64_t JSBigInt::toBigUInt64Heap(JSBigInt* bigInt)
     3047{
     3048    auto length = bigInt->length();
     3049    if (!length)
     3050        return 0;
     3051    uint64_t value = 0;
     3052    if constexpr (sizeof(Digit) == 4) {
     3053        value = static_cast<uint64_t>(bigInt->digit(0));
     3054        if (length > 1)
     3055            value |= static_cast<uint64_t>(bigInt->digit(1)) << 32;
     3056    } else {
     3057        ASSERT(sizeof(Digit) == 8);
     3058        value = bigInt->digit(0);
     3059    }
     3060    if (!bigInt->sign())
     3061        return value;
     3062    return ~(value - 1); // To avoid undefined behavior, we compute two's compliment by hand in C while this is simply `-value`.
     3063}
     3064
    30463065Optional<uint64_t> JSBigInt::toUint64Heap(JSBigInt* bigInt)
    30473066{
  • trunk/Source/JavaScriptCore/runtime/JSBigInt.h

    r270298 r271168  
    421421#endif
    422422
     423    static uint64_t toBigUInt64(JSValue bigInt)
     424    {
     425        ASSERT(bigInt.isBigInt());
     426#if USE(BIGINT32)
     427        if (bigInt.isBigInt32())
     428            return static_cast<uint64_t>(static_cast<int64_t>(bigInt.bigInt32AsInt32()));
     429#endif
     430        return toBigUInt64Heap(bigInt.asHeapBigInt());
     431    }
     432
     433    static uint64_t toBigInt64(JSValue bigInt)
     434    {
     435        ASSERT(bigInt.isBigInt());
     436#if USE(BIGINT32)
     437        if (bigInt.isBigInt32())
     438            return static_cast<int64_t>(bigInt.bigInt32AsInt32());
     439#endif
     440        return static_cast<int64_t>(toBigUInt64Heap(bigInt.asHeapBigInt()));
     441    }
     442
    423443    static Optional<uint64_t> toUint64(JSValue bigInt)
    424444    {
     
    589609    static ImplResult truncateAndSubFromPowerOfTwo(JSGlobalObject*, int32_t, BigIntImpl, bool resultSign);
    590610
     611    JS_EXPORT_PRIVATE static uint64_t toBigUInt64Heap(JSBigInt*);
     612
    591613    JS_EXPORT_PRIVATE static Optional<uint64_t> toUint64Heap(JSBigInt*);
    592614
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r268710 r271168  
    9595        return 0;
    9696    return WTF::nullopt;
     97}
     98
     99// https://tc39.es/ecma262/#sec-tobigint
     100JSValue JSValue::toBigInt(JSGlobalObject* globalObject) const
     101{
     102    VM& vm = globalObject->vm();
     103    auto scope = DECLARE_THROW_SCOPE(vm);
     104
     105    JSValue primitive = toPrimitive(globalObject);
     106    RETURN_IF_EXCEPTION(scope, { });
     107
     108    if (primitive.isBigInt())
     109        return primitive;
     110
     111    if (primitive.isBoolean()) {
     112#if USE(BIGINT32)
     113        return jsBigInt32(primitive.asBoolean());
     114#else
     115        RELEASE_AND_RETURN(scope, JSBigInt::createFrom(globalObject, primitive.asBoolean()));
     116#endif
     117    }
     118
     119    if (primitive.isString()) {
     120        scope.release();
     121        return toStringView(globalObject, primitive, [&] (StringView view) {
     122            return JSBigInt::parseInt(globalObject, view);
     123        });
     124    }
     125
     126    ASSERT(primitive.isUndefinedOrNull() || primitive.isNumber() || primitive.isSymbol());
     127    throwTypeError(globalObject, scope, "Invalid argument type in ToBigInt operation"_s);
     128    return jsUndefined();
     129}
     130
     131// https://tc39.es/ecma262/#sec-tobigint64
     132int64_t JSValue::toBigInt64(JSGlobalObject* globalObject) const
     133{
     134    VM& vm = globalObject->vm();
     135    auto scope = DECLARE_THROW_SCOPE(vm);
     136
     137    JSValue value = toBigInt(globalObject);
     138    RETURN_IF_EXCEPTION(scope, { });
     139    return JSBigInt::toBigInt64(value);
     140}
     141
     142// https://tc39.es/ecma262/#sec-tobiguint64
     143uint64_t JSValue::toBigUInt64(JSGlobalObject* globalObject) const
     144{
     145    VM& vm = globalObject->vm();
     146    auto scope = DECLARE_THROW_SCOPE(vm);
     147
     148    JSValue value = toBigInt(globalObject);
     149    RETURN_IF_EXCEPTION(scope, { });
     150    return JSBigInt::toBigUInt64(value);
    97151}
    98152
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.h

    r270298 r271168  
    299299    double toLength(JSGlobalObject*) const;
    300300
     301    JS_EXPORT_PRIVATE JSValue toBigInt(JSGlobalObject*) const;
     302    int64_t toBigInt64(JSGlobalObject*) const;
     303    uint64_t toBigUInt64(JSGlobalObject*) const;
     304
    301305    Optional<uint32_t> toUInt32AfterToNumeric(JSGlobalObject*) const;
    302306
  • trunk/Source/JavaScriptCore/wasm/WasmExceptionType.h

    r246589 r271168  
    4343    macro(IntegerOverflow, "Integer overflow") \
    4444    macro(StackOverflow, "Stack overflow") \
    45     macro(I64ArgumentType, "WebAssembly function with an i64 argument can't be called from JavaScript") \
    46     macro(I64ReturnType, "WebAssembly function that returns i64 can't be called from JavaScript") \
    4745    macro(FuncrefNotWasm, "Funcref must be an exported wasm function")
    4846
  • trunk/Source/JavaScriptCore/wasm/WasmGlobal.cpp

    r269552 r271168  
    3636namespace JSC { namespace Wasm {
    3737
    38 JSValue Global::get() const
     38JSValue Global::get(JSGlobalObject* globalObject) const
    3939{
    4040    switch (m_type) {
    4141    case Wasm::Type::I32:
    4242        return jsNumber(bitwise_cast<int32_t>(static_cast<uint32_t>(m_value.m_primitive)));
     43    case Wasm::Type::I64:
     44        return JSBigInt::makeHeapBigIntOrBigInt32(globalObject, static_cast<int64_t>(m_value.m_primitive));
    4345    case Wasm::Type::F32:
    4446        return jsNumber(purifyNaN(static_cast<double>(bitwise_cast<float>(static_cast<uint32_t>(m_value.m_primitive)))));
     
    6365        RETURN_IF_EXCEPTION(throwScope, void());
    6466        m_value.m_primitive = static_cast<uint64_t>(static_cast<uint32_t>(value));
     67        break;
     68    }
     69    case Wasm::Type::I64: {
     70        int64_t value = argument.toBigInt64(globalObject);
     71        RETURN_IF_EXCEPTION(throwScope, void());
     72        m_value.m_primitive = static_cast<uint64_t>(value);
    6573        break;
    6674    }
  • trunk/Source/JavaScriptCore/wasm/WasmGlobal.h

    r269552 r271168  
    5555    Wasm::Type type() const { return m_type; }
    5656    Wasm::GlobalInformation::Mutability mutability() const { return m_mutability; }
    57     JSValue get() const;
     57    JSValue get(JSGlobalObject*) const;
    5858    uint64_t getPrimitive() const { return m_value.m_primitive; }
    5959    void set(JSGlobalObject*, JSValue);
  • trunk/Source/JavaScriptCore/wasm/WasmOperations.cpp

    r271114 r271168  
    5858
    5959namespace JSC { namespace Wasm {
    60 
    61 JSC_DEFINE_JIT_OPERATION(operationWasmThrowBadI64, void, (JSWebAssemblyInstance* instance))
    62 {
    63     VM& vm = instance->vm();
    64     CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
    65     JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    66 
    67     {
    68         auto throwScope = DECLARE_THROW_SCOPE(vm);
    69         JSGlobalObject* globalObject = instance->globalObject();
    70         auto* error = ErrorInstance::create(globalObject, vm, globalObject->errorStructure(ErrorType::TypeError), "i64 not allowed as return type or argument to an imported function"_s);
    71         throwException(globalObject, throwScope, error);
    72     }
    73 
    74     genericUnwind(vm, callFrame);
    75     ASSERT(!!vm.callFrameForCatch);
    76 }
    7760
    7861static bool shouldTriggerOMGCompile(TierUpCount& tierUp, OMGCallee* replacement, uint32_t functionIndex)
     
    482465}
    483466
     467JSC_DEFINE_JIT_OPERATION(operationConvertToI64, int64_t, (CallFrame* callFrame, JSValue v))
     468{
     469    // FIXME: Consider passing JSWebAssemblyInstance* instead.
     470    // https://bugs.webkit.org/show_bug.cgi?id=203206
     471    VM& vm = callFrame->deprecatedVM();
     472    NativeCallFrameTracer tracer(vm, callFrame);
     473    return v.toBigInt64(callFrame->lexicalGlobalObject(vm));
     474}
     475
    484476JSC_DEFINE_JIT_OPERATION(operationConvertToF64, double, (CallFrame* callFrame, JSValue v))
    485477{
     
    507499    NativeCallFrameTracer tracer(vm, callFrame);
    508500    return static_cast<float>(v.toNumber(callFrame->lexicalGlobalObject(vm)));
     501}
     502
     503JSC_DEFINE_JIT_OPERATION(operationConvertToBigInt, EncodedJSValue, (CallFrame* callFrame, Instance* instance, int64_t value))
     504{
     505    JSWebAssemblyInstance* jsInstance = instance->owner<JSWebAssemblyInstance>();
     506    JSGlobalObject* globalObject = jsInstance->globalObject();
     507    VM& vm = globalObject->vm();
     508    NativeCallFrameTracer tracer(vm, callFrame);
     509    return JSValue::encode(JSBigInt::makeHeapBigIntOrBigInt32(globalObject, value));
    509510}
    510511
     
    549550        case I32:
    550551            unboxedValue = value.toInt32(globalObject);
     552            break;
     553        case I64:
     554            unboxedValue = value.toBigInt64(globalObject);
    551555            break;
    552556        case F32:
  • trunk/Source/JavaScriptCore/wasm/WasmOperations.h

    r271100 r271168  
    4848JSC_DECLARE_JIT_OPERATION(operationWasmTriggerOSREntryNow, void, (Probe::Context&));
    4949JSC_DECLARE_JIT_OPERATION(operationWasmTriggerTierUpNow, void, (Instance*, uint32_t functionIndex));
    50 JSC_DECLARE_JIT_OPERATION(operationWasmThrowBadI64, void, (JSWebAssemblyInstance*));
    5150JSC_DECLARE_JIT_OPERATION(operationWasmUnwind, void, (CallFrame*));
    5251
     52JSC_DECLARE_JIT_OPERATION(operationConvertToI64, int64_t, (CallFrame*, JSValue));
    5353JSC_DECLARE_JIT_OPERATION(operationConvertToF64, double, (CallFrame*, JSValue));
    5454JSC_DECLARE_JIT_OPERATION(operationConvertToI32, int32_t, (CallFrame*, JSValue));
    5555JSC_DECLARE_JIT_OPERATION(operationConvertToF32, float, (CallFrame*, JSValue));
     56
     57JSC_DECLARE_JIT_OPERATION(operationConvertToBigInt, EncodedJSValue, (CallFrame*, Instance*, int64_t));
    5658
    5759JSC_DECLARE_JIT_OPERATION(operationIterateResults, void, (CallFrame*, Instance*, const Signature*, JSValue, uint64_t*, uint64_t*));
  • trunk/Source/JavaScriptCore/wasm/js/JSToWasm.cpp

    r269974 r271168  
    3939namespace JSC { namespace Wasm {
    4040
    41 inline void boxWasmResult(CCallHelpers& jit, Wasm::Type type, Reg src, JSValueRegs dst)
    42 {
    43     switch (type) {
    44     case Wasm::Void:
    45         jit.moveTrustedValue(jsUndefined(), dst);
    46         break;
    47     case Wasm::Externref:
    48     case Wasm::Funcref:
    49         jit.move(src.gpr(), dst.payloadGPR());
    50         break;
    51     case Wasm::I32:
    52         jit.zeroExtend32ToWord(src.gpr(), dst.payloadGPR());
    53         jit.boxInt32(dst.payloadGPR(), dst, DoNotHaveTagRegisters);
    54         break;
    55     case Wasm::F32:
    56         jit.convertFloatToDouble(src.fpr(), src.fpr());
    57         FALLTHROUGH;
    58     case Wasm::F64: {
    59         jit.moveTrustedValue(jsNumber(pureNaN()), dst);
    60         auto isNaN = jit.branchIfNaN(src.fpr());
    61         jit.boxDouble(src.fpr(), dst, DoNotHaveTagRegisters);
    62         isNaN.link(&jit);
    63         break;
    64     }
    65     default:
    66         jit.breakpoint();
    67         break;
    68     }
    69 }
    70 
    7141void marshallJSResult(CCallHelpers& jit, const Signature& signature, const CallInformation& wasmFrameConvention, const RegisterAtOffsetList& savedResultRegisters)
    7242{
     43    auto boxWasmResult = [](CCallHelpers& jit, Wasm::Type type, Reg src, JSValueRegs dst) {
     44        switch (type) {
     45        case Wasm::Void:
     46            jit.moveTrustedValue(jsUndefined(), dst);
     47            break;
     48        case Wasm::Externref:
     49        case Wasm::Funcref:
     50            jit.move(src.gpr(), dst.payloadGPR());
     51            break;
     52        case Wasm::I32:
     53            jit.zeroExtend32ToWord(src.gpr(), dst.payloadGPR());
     54            jit.boxInt32(dst.payloadGPR(), dst, DoNotHaveTagRegisters);
     55            break;
     56        case Wasm::F32:
     57            jit.convertFloatToDouble(src.fpr(), src.fpr());
     58            FALLTHROUGH;
     59        case Wasm::F64: {
     60            jit.moveTrustedValue(jsNumber(pureNaN()), dst);
     61            auto isNaN = jit.branchIfNaN(src.fpr());
     62            jit.boxDouble(src.fpr(), dst, DoNotHaveTagRegisters);
     63            isNaN.link(&jit);
     64            break;
     65        }
     66        default:
     67            jit.breakpoint();
     68            break;
     69        }
     70    };
     71
    7372    if (signature.returnsVoid())
    7473        jit.moveTrustedValue(jsUndefined(), JSValueRegs { GPRInfo::returnValueGPR });
    75     else if (signature.returnCount() == 1)
    76         boxWasmResult(jit, signature.returnType(0), wasmFrameConvention.results[0].reg(), JSValueRegs { GPRInfo::returnValueGPR });
    77     else {
     74    else if (signature.returnCount() == 1) {
     75        if (signature.returnType(0) == Wasm::I64) {
     76            GPRReg inputGPR = wasmFrameConvention.results[0].reg().gpr();
     77            GPRReg wasmContextInstanceGPR = PinnedRegisterInfo::get().wasmContextInstancePointer;
     78            if (Context::useFastTLS()) {
     79                wasmContextInstanceGPR = inputGPR == GPRInfo::argumentGPR1 ? GPRInfo::argumentGPR0 : GPRInfo::argumentGPR1;
     80                static_assert(std::is_same_v<Wasm::Instance*, typename FunctionTraits<decltype(operationAllocateResultsArray)>::ArgumentType<1>>);
     81                jit.loadWasmContextInstance(wasmContextInstanceGPR);
     82            }
     83            jit.setupArguments<decltype(operationConvertToBigInt)>(wasmContextInstanceGPR, inputGPR);
     84            jit.callOperation(FunctionPtr<OperationPtrTag>(operationConvertToBigInt));
     85        } else
     86            boxWasmResult(jit, signature.returnType(0), wasmFrameConvention.results[0].reg(), JSValueRegs { GPRInfo::returnValueGPR });
     87    } else {
    7888        IndexingType indexingType = ArrayWithUndecided;
    7989        JSValueRegs scratch = JSValueRegs { wasmCallingConvention().prologueScratchGPRs[1] };
    8090        // We can use the first floating point register as a scratch since it will always be moved onto the stack before other values.
    8191        FPRReg fprScratch = wasmCallingConvention().fprArgs[0].fpr();
     92        bool hasI64 = false;
    8293        for (unsigned i = 0; i < signature.returnCount(); ++i) {
    8394            B3::ValueRep rep = wasmFrameConvention.results[i];
    8495            Type type = signature.returnType(i);
    8596
     97            hasI64 |= type == Wasm::I64;
    8698            if (rep.isReg()) {
    87                 boxWasmResult(jit, signature.returnType(i), rep.reg(), scratch);
    88                 jit.storeValue(scratch, CCallHelpers::Address(CCallHelpers::stackPointerRegister, savedResultRegisters.find(rep.reg())->offset() + wasmFrameConvention.headerAndArgumentStackSizeInBytes));
     99                if (type != Wasm::I64) {
     100                    boxWasmResult(jit, signature.returnType(i), rep.reg(), scratch);
     101                    jit.storeValue(scratch, CCallHelpers::Address(CCallHelpers::stackPointerRegister, savedResultRegisters.find(rep.reg())->offset() + wasmFrameConvention.headerAndArgumentStackSizeInBytes));
     102                } else
     103                    jit.storeValue(JSValueRegs { rep.reg().gpr() }, CCallHelpers::Address(CCallHelpers::stackPointerRegister, savedResultRegisters.find(rep.reg())->offset() + wasmFrameConvention.headerAndArgumentStackSizeInBytes));
    89104            } else {
    90                 auto location = CCallHelpers::Address(CCallHelpers::stackPointerRegister, rep.offsetFromSP());
    91                 Reg tmp = type == F32 || type == F64 ? Reg(fprScratch) : Reg(scratch.gpr());
    92                 jit.load64ToReg(location, tmp);
    93                 boxWasmResult(jit, signature.returnType(i), tmp, scratch);
    94                 jit.storeValue(scratch, location);
     105                if (type != Wasm::I64) {
     106                    auto location = CCallHelpers::Address(CCallHelpers::stackPointerRegister, rep.offsetFromSP());
     107                    Reg tmp = type == F32 || type == F64 ? Reg(fprScratch) : Reg(scratch.gpr());
     108                    jit.load64ToReg(location, tmp);
     109                    boxWasmResult(jit, signature.returnType(i), tmp, scratch);
     110                    jit.storeValue(scratch, location);
     111                }
    95112            }
    96113
     
    109126        }
    110127
     128        // Now, all return values are stored in memory. So we can call functions can clobber caller-save registers.
     129        // This is required to convert values to BigInt.
     130        if (hasI64) {
     131            for (unsigned i = 0; i < signature.returnCount(); ++i) {
     132                B3::ValueRep rep = wasmFrameConvention.results[i];
     133                Type type = signature.returnType(i);
     134                if (type != Wasm::I64)
     135                    continue;
     136
     137                GPRReg wasmContextInstanceGPR = PinnedRegisterInfo::get().wasmContextInstancePointer;
     138                if (Context::useFastTLS()) {
     139                    wasmContextInstanceGPR = GPRInfo::argumentGPR1;
     140                    static_assert(std::is_same_v<Wasm::Instance*, typename FunctionTraits<decltype(operationAllocateResultsArray)>::ArgumentType<1>>);
     141                    jit.loadWasmContextInstance(wasmContextInstanceGPR);
     142                }
     143
     144                if (rep.isReg())
     145                    jit.load64(CCallHelpers::Address(CCallHelpers::stackPointerRegister, savedResultRegisters.find(rep.reg())->offset() + wasmFrameConvention.headerAndArgumentStackSizeInBytes), GPRInfo::argumentGPR0);
     146                else {
     147                    auto location = CCallHelpers::Address(CCallHelpers::stackPointerRegister, rep.offsetFromSP());
     148                    jit.load64ToReg(location, GPRInfo::argumentGPR0);
     149                }
     150                jit.setupArguments<decltype(operationConvertToBigInt)>(wasmContextInstanceGPR, GPRInfo::argumentGPR0);
     151                jit.callOperation(FunctionPtr<OperationPtrTag>(operationConvertToBigInt));
     152                if (rep.isReg())
     153                    jit.storeValue(JSValueRegs { GPRInfo::returnValueGPR }, CCallHelpers::Address(CCallHelpers::stackPointerRegister, savedResultRegisters.find(rep.reg())->offset() + wasmFrameConvention.headerAndArgumentStackSizeInBytes));
     154                else {
     155                    auto location = CCallHelpers::Address(CCallHelpers::stackPointerRegister, rep.offsetFromSP());
     156                    jit.storeValue(JSValueRegs { GPRInfo::returnValueGPR }, location);
     157                }
     158            }
     159        }
     160
    111161        GPRReg wasmContextInstanceGPR = PinnedRegisterInfo::get().wasmContextInstancePointer;
    112162        if (Context::useFastTLS()) {
     
    165215        ptrdiff_t offset = regAtOffset.offset();
    166216        jit.storePtr(reg, CCallHelpers::Address(GPRInfo::callFrameRegister, offset));
    167     }
    168 
    169     if (wasmFrameConvention.argumentsIncludeI64 || wasmFrameConvention.resultsIncludeI64) {
    170         if (Context::useFastTLS())
    171             jit.loadWasmContextInstance(GPRInfo::argumentGPR2);
    172         else {
    173             // vmEntryToWasm passes the JSWebAssemblyInstance corresponding to Wasm::Context*'s
    174             // instance as the first JS argument when we're not using fast TLS to hold the
    175             // Wasm::Context*'s instance.
    176             jit.loadPtr(CCallHelpers::Address(GPRInfo::callFrameRegister, CallFrameSlot::thisArgument * sizeof(EncodedJSValue)), GPRInfo::argumentGPR2);
    177             jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR2, JSWebAssemblyInstance::offsetOfInstance()), GPRInfo::argumentGPR2);
    178         }
    179 
    180         emitThrowWasmToJSException(jit, GPRInfo::argumentGPR2, wasmFrameConvention.argumentsIncludeI64 ? ExceptionType::I64ArgumentType : ExceptionType::I64ReturnType);
    181         return result;
    182217    }
    183218
  • trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp

    r269552 r271168  
    5252}
    5353
    54 static Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> handleBadI64Use(VM& vm, JIT& jit, unsigned importIndex)
    55 {
    56     jit.copyCalleeSavesToEntryFrameCalleeSavesBuffer(vm.topEntryFrame);
    57     jit.loadWasmContextInstance(GPRInfo::argumentGPR0);
    58 
    59     // Store Callee.
    60     jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, Instance::offsetOfOwner()), GPRInfo::argumentGPR0);
    61     jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, JSWebAssemblyInstance::offsetOfModule()), GPRInfo::argumentGPR1);
    62     jit.prepareCallOperation(vm);
    63     jit.storePtr(GPRInfo::argumentGPR1, JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register))));
    64 
    65     auto call = jit.call(OperationPtrTag);
    66     jit.jumpToExceptionHandler(vm);
    67 
    68     LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, JITCompilationCanFail);
    69     if (UNLIKELY(linkBuffer.didFailToAllocate()))
    70         return makeUnexpected(BindingFailure::OutOfMemory);
    71 
    72     linkBuffer.link(call, FunctionPtr<OperationPtrTag>(operationWasmThrowBadI64));
    73     return FINALIZE_WASM_CODE(linkBuffer, WasmEntryPtrTag, "WebAssembly->JavaScript invalid i64 use in import[%i]", importIndex);
    74 }
    75 
    7654Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM& vm, Bag<CallLinkInfo>& callLinkInfos, SignatureIndex signatureIndex, unsigned importIndex)
    7755{
     
    9674    jit.emitFunctionPrologue();
    9775    jit.store64(JIT::TrustedImm32(0), JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::codeBlock * static_cast<int>(sizeof(Register)))); // FIXME Stop using 0 as codeBlocks. https://bugs.webkit.org/show_bug.cgi?id=165321
    98 
    99     if (wasmCallInfo.argumentsIncludeI64 || wasmCallInfo.resultsIncludeI64)
    100         return handleBadI64Use(vm, jit, importIndex);
    10176
    10277    // Here we assume that the JS calling convention saves at least all the wasm callee saved. We therefore don't need to save and restore more registers since the wasm callee already took care of this.
     
    130105            case Void:
    131106            case Func:
    132             case I64:
    133107                RELEASE_ASSERT_NOT_REACHED(); // Handled above.
    134108            case Externref:
    135109            case Funcref:
    136             case I32: {
     110            case I32:
     111            case I64: {
    137112                GPRReg gprReg;
    138113                if (marshalledGPRs < wasmCC.gprArgs.size())
     
    202177            case Void:
    203178            case Func:
    204             case I64:
    205179                RELEASE_ASSERT_NOT_REACHED(); // Handled above.
    206180            case Externref:
    207181            case Funcref:
    208182            case I32:
     183            case I64: {
    209184                // Skipped: handled above.
    210185                if (marshalledGPRs >= wasmCC.gprArgs.size())
     
    213188                calleeFrameOffset += sizeof(Register);
    214189                break;
     190            }
    215191            case F32: {
    216192                FPRReg fprReg;
     
    241217            }
    242218            }
     219        }
     220    }
     221
     222    CCallHelpers::JumpList exceptionChecks;
     223
     224    if (wasmCallInfo.argumentsIncludeI64) {
     225        // Since all argument GPRs and FPRs are stored into stack frames, clobbering caller-save registers is OK here.
     226        // We call functions to convert I64 to BigInt.
     227        unsigned calleeFrameOffset = CallFrameSlot::firstArgument * static_cast<int>(sizeof(Register));
     228        for (unsigned argNum = 0; argNum < argCount; ++argNum) {
     229            if (signature.argument(argNum) == I64) {
     230                jit.loadWasmContextInstance(GPRInfo::argumentGPR0);
     231                jit.load64(calleeFrame.withOffset(calleeFrameOffset), GPRInfo::argumentGPR1);
     232                jit.setupArguments<decltype(operationConvertToBigInt)>(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1);
     233                auto call = jit.call(OperationPtrTag);
     234                exceptionChecks.append(jit.emitJumpIfException(vm));
     235                jit.store64(GPRInfo::returnValueGPR, calleeFrame.withOffset(calleeFrameOffset));
     236                jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
     237                    linkBuffer.link(call, FunctionPtr<OperationPtrTag>(operationConvertToBigInt));
     238                });
     239            }
     240            calleeFrameOffset += sizeof(Register);
    243241        }
    244242    }
     
    276274    done.link(&jit);
    277275
    278     CCallHelpers::JumpList exceptionChecks;
    279 
    280276    if (signature.returnCount() == 1) {
    281277        switch (signature.returnType(0)) {
     
    286282            break;
    287283        case I64: {
    288             RELEASE_ASSERT_NOT_REACHED(); // Handled above.
     284            // FIXME: Optimize I64 extraction from BigInt.
     285            // https://bugs.webkit.org/show_bug.cgi?id=220053
     286            GPRReg dest = wasmCallInfo.results[0].gpr();
     287            jit.setupArguments<decltype(operationConvertToI64)>(GPRInfo::returnValueGPR);
     288            auto call = jit.call(OperationPtrTag);
     289            exceptionChecks.append(jit.emitJumpIfException(vm));
     290            jit.move(GPRInfo::returnValueGPR, dest);
     291
     292            jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
     293                linkBuffer.link(call, FunctionPtr<OperationPtrTag>(operationConvertToI64));
     294            });
     295            break;
    289296        }
    290297        case I32: {
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp

    r270686 r271168  
    9292            break;
    9393        case Wasm::I64:
    94             arg = JSValue();
     94            arg = JSValue::decode(bitwise_cast<uint64_t>(arg.toBigInt64(globalObject)));
    9595            break;
    9696        case Wasm::F32:
     
    215215    totalFrameSize += savedResultRegisters.size() * sizeof(CPURegister);
    216216
    217     if (wasmCallInfo.argumentsIncludeI64 || wasmCallInfo.resultsIncludeI64)
     217    // FIXME: Optimize Wasm function call even if arguments include I64.
     218    // This requires I64 extraction from BigInt.
     219    // https://bugs.webkit.org/show_bug.cgi?id=220053
     220    if (wasmCallInfo.argumentsIncludeI64)
    218221        return nullptr;
    219222
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyGlobalConstructor.cpp

    r271115 r271168  
    109109        }
    110110        case Wasm::Type::I64: {
    111             return JSValue::encode(throwException(globalObject, throwScope, createTypeError(globalObject, "WebAssembly.Global does not accept i64 initial value"_s)));
     111            int64_t value = argument.toBigInt64(globalObject);
     112            RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     113            initialValue = static_cast<uint64_t>(value);
     114            break;
    112115        }
    113116        case Wasm::Type::F32: {
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyGlobalPrototype.cpp

    r267594 r271168  
    7474    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    7575
    76     switch (global->global()->type()) {
    77     case Wasm::Type::I64:
    78         return JSValue::encode(throwException(globalObject, throwScope, createTypeError(globalObject, "WebAssembly.Global.prototype.valueOf does not work with i64 type"_s)));
    79     default:
    80         return JSValue::encode(global->global()->get());
    81     }
     76    RELEASE_AND_RETURN(throwScope, JSValue::encode(global->global()->get(globalObject)));
    8277}
    8378
     
    9085    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    9186
    92     switch (global->global()->type()) {
    93     case Wasm::Type::I64:
    94         return JSValue::encode(throwException(globalObject, throwScope, createTypeError(globalObject, "WebAssembly.Global.prototype.value does not work with i64 type"_s)));
    95     default:
    96         return JSValue::encode(global->global()->get());
    97     }
     87    RELEASE_AND_RETURN(throwScope, JSValue::encode(global->global()->get(globalObject)));
    9888}
    9989
     
    112102        return JSValue::encode(throwException(globalObject, throwScope, createTypeError(globalObject, "WebAssembly.Global.prototype.value attempts to modify immutable global value"_s)));
    113103
    114     switch (global->global()->type()) {
    115     case Wasm::Type::I64:
    116         return JSValue::encode(throwException(globalObject, throwScope, createTypeError(globalObject, "WebAssembly.Global.prototype.value does not work with i64 type"_s)));
    117     default:
    118         global->global()->set(globalObject, callFrame->argument(0));
    119         RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    120         return JSValue::encode(jsUndefined());
    121     }
     104    global->global()->set(globalObject, callFrame->argument(0));
     105    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     106    return JSValue::encode(jsUndefined());
    122107}
    123108
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp

    r271112 r271168  
    239239                    switch (moduleInformation.globals[import.kindIndex].type) {
    240240                    case Wasm::Funcref:
    241                         value = globalValue->global()->get();
     241                        value = globalValue->global()->get(globalObject);
     242                        RETURN_IF_EXCEPTION(scope, void());
    242243                        if (!isWebAssemblyHostFunction(vm, value) && !value.isNull())
    243244                            return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "imported global", "must be a wasm exported function or null")));
     
    245246                        break;
    246247                    case Wasm::Externref:
    247                         value = globalValue->global()->get();
     248                        value = globalValue->global()->get(globalObject);
     249                        RETURN_IF_EXCEPTION(scope, void());
    248250                        m_instance->instance().setGlobal(import.kindIndex, value);
    249251                        break;
     
    259261                } else {
    260262                    const auto globalType = moduleInformation.globals[import.kindIndex].type;
    261                     // ii. If the global_type of i is i64 or Type(v) is not Number, throw a WebAssembly.LinkError.
    262                     if (globalType == Wasm::I64)
    263                         return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "imported global", "cannot be an i64")));
    264                     if (!isRefType(globalType) && !value.isNumber())
    265                         return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "imported global", "must be a number")));
     263                    if (!isRefType(globalType)) {
     264                        // ii. If the global_type of i is i64 or Type(v) is Number, throw a WebAssembly.LinkError.
     265                        if (globalType == Wasm::I64) {
     266                            if (!value.isBigInt())
     267                                return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "imported global", "must be a BigInt")));
     268                        } else {
     269                            if (!value.isNumber())
     270                                return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "imported global", "must be a number")));
     271                        }
     272                    }
    266273
    267274                    // iii. Append ToWebAssemblyValue(v) to imports.
    268                     switch (moduleInformation.globals[import.kindIndex].type) {
     275                    switch (globalType) {
    269276                    case Wasm::Funcref:
    270277                        if (!isWebAssemblyHostFunction(vm, value) && !value.isNull())
     
    278285                        m_instance->instance().setGlobal(import.kindIndex, value.toInt32(globalObject));
    279286                        break;
     287                    case Wasm::I64: {
     288                        int64_t bits = value.toBigInt64(globalObject);
     289                        RETURN_IF_EXCEPTION(scope, void());
     290                        m_instance->instance().setGlobal(import.kindIndex, bits);
     291                        break;
     292                    }
    280293                    case Wasm::F32:
    281294                        m_instance->instance().setGlobal(import.kindIndex, bitwise_cast<uint32_t>(value.toFloat(globalObject)));
Note: See TracChangeset for help on using the changeset viewer.