Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
de705cf
commit 2633a27
Showing
18 changed files
with
504 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
66 changes: 35 additions & 31 deletions
66
JSTests/wasm/regress/llint-callee-saves-with-fast-memory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
66
JSTests/wasm/regress/llint-callee-saves-without-fast-memory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |
Oops, something went wrong.