Skip to content

Commit

Permalink
WebAssembly: update wabt.js
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=218876

Patch by Sergey Rubanov <chi187@gmail.com> on 2020-11-13
Reviewed by Yusuke Suzuki.

* wasm/libwabt.js:
(WabtModule): Deleted.
* wasm/regress/llint-callee-saves-with-fast-memory.js:
(async test):
* wasm/regress/llint-callee-saves-without-fast-memory.js:
(async test):
* wasm/regress/regression-with-loop.js:
(async test):
* wasm/regress/stack-consistency.js:
(async test):
* wasm/stress/js-wasm-call-many-return-types-on-stack-no-args.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/stress/js-wasm-js-varying-arities.js:
(async paramForwarder):
(async test):
(paramForwarder): Deleted.
* wasm/stress/local-ref.js:
(async test):
* wasm/stress/loop-more-args-than-results.js:
(async test):
* wasm/stress/set-local-enclosed-stack.js:
(async test):
(assert.eq.instance.exports.foo): Deleted.
(assert.eq): Deleted.
* wasm/stress/top-most-enclosing-stack.js:
(async test):
* wasm/stress/trunc-int-min-minus-one.js:
(async test):
* wasm/stress/wasm-js-call-many-return-types-on-stack-no-args.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/stress/wasm-js-multi-value-exception-in-iterator.js:
(async buildWat):
(async test):
(buildWat.throwError): Deleted.
(buildWat.throwErrorInIterator): Deleted.
(buildWat.tooManyValues): Deleted.
(buildWat.tooFewValues): Deleted.
(buildWat): Deleted.
* wasm/stress/wasm-wasm-call-indirect-many-return-types-on-stack.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/stress/wasm-wasm-call-many-return-types-on-stack-no-args.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/wabt-wrapper.js:
(export.async compile):
(export.compile): Deleted.

Canonical link: https://commits.webkit.org/231540@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
chicoxyzzy authored and webkit-commit-queue committed Nov 13, 2020
1 parent de705cf commit 2633a27
Show file tree
Hide file tree
Showing 18 changed files with 504 additions and 338 deletions.
61 changes: 61 additions & 0 deletions JSTests/ChangeLog
@@ -1,3 +1,64 @@
2020-11-13 Sergey Rubanov <chi187@gmail.com>

WebAssembly: update wabt.js
https://bugs.webkit.org/show_bug.cgi?id=218876

Reviewed by Yusuke Suzuki.

* wasm/libwabt.js:
(WabtModule): Deleted.
* wasm/regress/llint-callee-saves-with-fast-memory.js:
(async test):
* wasm/regress/llint-callee-saves-without-fast-memory.js:
(async test):
* wasm/regress/regression-with-loop.js:
(async test):
* wasm/regress/stack-consistency.js:
(async test):
* wasm/stress/js-wasm-call-many-return-types-on-stack-no-args.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/stress/js-wasm-js-varying-arities.js:
(async paramForwarder):
(async test):
(paramForwarder): Deleted.
* wasm/stress/local-ref.js:
(async test):
* wasm/stress/loop-more-args-than-results.js:
(async test):
* wasm/stress/set-local-enclosed-stack.js:
(async test):
(assert.eq.instance.exports.foo): Deleted.
(assert.eq): Deleted.
* wasm/stress/top-most-enclosing-stack.js:
(async test):
* wasm/stress/trunc-int-min-minus-one.js:
(async test):
* wasm/stress/wasm-js-call-many-return-types-on-stack-no-args.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/stress/wasm-js-multi-value-exception-in-iterator.js:
(async buildWat):
(async test):
(buildWat.throwError): Deleted.
(buildWat.throwErrorInIterator): Deleted.
(buildWat.tooManyValues): Deleted.
(buildWat.tooFewValues): Deleted.
(buildWat): Deleted.
* wasm/stress/wasm-wasm-call-indirect-many-return-types-on-stack.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/stress/wasm-wasm-call-many-return-types-on-stack-no-args.js:
(async buildWat):
(async test):
(buildWat): Deleted.
* wasm/wabt-wrapper.js:
(export.async compile):
(export.compile): Deleted.

2020-11-12 Caio Lima <ticaiolima@gmail.com>

[Intl][ARMv7][MIPS] Skip stress/intl-datetimeformat-formatrange.js
Expand Down
54 changes: 37 additions & 17 deletions JSTests/wasm/libwabt.js

Large diffs are not rendered by default.

66 changes: 35 additions & 31 deletions JSTests/wasm/regress/llint-callee-saves-with-fast-memory.js
@@ -1,38 +1,42 @@
//@ requireOptions("--useWebAssemblyFastMemory=true")

import * as assert from '../assert.js';
import { instantiate } from '../wabt-wrapper.js';

const instance = instantiate(`
(module
(memory 0)
(func $grow
(memory.grow (i32.const 1))
(drop)
)
(func $f (param $bail i32)
(br_if 0 (local.get $bail))
(call $grow)
(i32.store (i32.const 42) (i32.const 0))
)
(func (export "main")
(local $i i32)
(local.set $i (i32.const 100000))
(loop
(i32.sub (local.get $i) (i32.const 1))
(local.tee $i)
(call $f (i32.const 1))
(br_if 0)
async function test() {
const instance = await instantiate(`
(module
(memory 0)
(func $grow
(memory.grow (i32.const 1))
(drop)
)
(call $f (i32.const 0))
)
)
`);
(func $f (param $bail i32)
(br_if 0 (local.get $bail))
(call $grow)
(i32.store (i32.const 42) (i32.const 0))
)
(func (export "main")
(local $i i32)
(local.set $i (i32.const 100000))
(loop
(i32.sub (local.get $i) (i32.const 1))
(local.tee $i)
(call $f (i32.const 1))
(br_if 0)
)
(call $f (i32.const 0))
)
)
`);

// This should not throw an OutOfBounds exception
instance.exports.main();
}

// This should not throw an OutOfBounds exception
instance.exports.main();
assert.asyncTest(test());
66 changes: 35 additions & 31 deletions JSTests/wasm/regress/llint-callee-saves-without-fast-memory.js
@@ -1,38 +1,42 @@
//@ requireOptions("--useWebAssemblyFastMemory=false")

import * as assert from '../assert.js';
import { instantiate } from '../wabt-wrapper.js';

const instance = instantiate(`
(module
(memory 0)
(func $grow
(memory.grow (i32.const 1))
(drop)
)
(func $f (param $bail i32)
(br_if 0 (local.get $bail))
(call $grow)
(i32.store (i32.const 42) (i32.const 0))
)
(func (export "main")
(local $i i32)
(local.set $i (i32.const 100000))
(loop
(i32.sub (local.get $i) (i32.const 1))
(local.tee $i)
(call $f (i32.const 1))
(br_if 0)
async function test() {
const instance = await instantiate(`
(module
(memory 0)
(func $grow
(memory.grow (i32.const 1))
(drop)
)
(call $f (i32.const 0))
)
)
`);
(func $f (param $bail i32)
(br_if 0 (local.get $bail))
(call $grow)
(i32.store (i32.const 42) (i32.const 0))
)
(func (export "main")
(local $i i32)
(local.set $i (i32.const 100000))
(loop
(i32.sub (local.get $i) (i32.const 1))
(local.tee $i)
(call $f (i32.const 1))
(br_if 0)
)
(call $f (i32.const 0))
)
)
`);

// This should not throw an OutOfBounds exception
instance.exports.main();
}

// This should not throw an OutOfBounds exception
instance.exports.main();
assert.asyncTest(test());
56 changes: 30 additions & 26 deletions JSTests/wasm/regress/regression-with-loop.js
@@ -1,31 +1,35 @@
import * as assert from '../assert.js';
import { instantiate } from '../wabt-wrapper.js';

const instance = instantiate(`
(module
(func $test (param f64) (result f64)
f64.const 1.0
f64.const 2.0
async function test() {
const instance = await instantiate(`
(module
(func $test (param f64) (result f64)
f64.const 1.0
f64.const 2.0
local.get 0
i64.reinterpret_f64
i32.wrap_i64
i32.const 4096
i32.lt_u
select
)
(export "test" (func $test)))
`);

local.get 0
i64.reinterpret_f64
i32.wrap_i64
i32.const 4096
i32.lt_u
select
)
(export "test" (func $test)))
`);

for (var i = 0; i < 1e4; ++i) {
assert.eq(instance.exports.test(0.1111111111111111111111111111111111), 2.0);
assert.eq(instance.exports.test(0), 1.0);
assert.eq(instance.exports.test(1), 1.0);
assert.eq(instance.exports.test(2), 1.0);
assert.eq(instance.exports.test(3), 1.0);
assert.eq(instance.exports.test(0.5), 1.0);
assert.eq(instance.exports.test(-0.5), 1.0);
assert.eq(instance.exports.test(200000), 1.0);
assert.eq(instance.exports.test(-200000), 1.0);
for (let i = 0; i < 1e4; ++i) {
assert.eq(instance.exports.test(0.1111111111111111111111111111111111), 2.0);
assert.eq(instance.exports.test(0), 1.0);
assert.eq(instance.exports.test(1), 1.0);
assert.eq(instance.exports.test(2), 1.0);
assert.eq(instance.exports.test(3), 1.0);
assert.eq(instance.exports.test(0.5), 1.0);
assert.eq(instance.exports.test(-0.5), 1.0);
assert.eq(instance.exports.test(200000), 1.0);
assert.eq(instance.exports.test(-200000), 1.0);
}
}

assert.asyncTest(test());
25 changes: 15 additions & 10 deletions JSTests/wasm/regress/stack-consistency.js
@@ -1,12 +1,17 @@
import * as assert from '../assert.js';
import { instantiate } from "../wabt-wrapper.js";

instantiate(`
(module
(func $foo (result i32 i32) unreachable)
(func (param i32) (result i32 i32 i32)
(local.get 0)
(loop (param i32) (result i32 i32 i32)
call $foo)
)
)
`);
async function test() {
await instantiate(`
(module
(func $foo (result i32 i32) unreachable)
(func (param i32) (result i32 i32 i32)
(local.get 0)
(loop (param i32) (result i32 i32 i32)
call $foo)
)
)
`);
}

assert.asyncTest(test());

0 comments on commit 2633a27

Please sign in to comment.