-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 267815.223@safari-7617-branch (3c47684). https://bugs.web…
…kit.org/show_bug.cgi?id=262222 BBQJIT if conditions are very wrong https://bugs.webkit.org/show_bug.cgi?id=262222 rdar://problem/116145012 Reviewed by Keith Miller. BBQJIT if conditions are very wrong. By random chance, the condition value happens to be allocated in nonPreservedNonArgumentGPR1, but if you use more than 8 registers, we end up just reading a completely random value. Let's not do that. We also add some extra debugging assertions for parallel move. These shouldn't ever actually be hit, but they help us avoid a potential problem in the future if we make BBQ register allocation smarter. Finally, we allow allocating eax on x86, and fix some bugs surrounding if/else as a result. * JSTests/wasm/stress/bbq-parallel-move.js: Added. (from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.log_value.import.string_appeared_here.string_appeared_here.param.i32.func.export.string_appeared_here.param.p0.i32.param.p1.i32.param.p2.i32.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.result.i32.local.p0.then.local.p2.local.p0.i32.const.0.else.i32.const.0.local.p2.call.f.func.f.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.pl.i32.call.log_value.local.pl.async test.): (from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.log_value.import.string_appeared_here.string_appeared_here.param.i32.func.export.string_appeared_here.param.p0.i32.param.p1.i32.param.p2.i32.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.local.p1.result.i32.local.p0.then.local.p2.local.p0.i32.const.0.else.i32.const.0.local.p2.call.f.func.f.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.i32.param.pl.i32.call.log_value.local.pl.async test): * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp: (JSC::Wasm::BBQJIT::ControlData::ControlData): (JSC::Wasm::BBQJIT::addIf): (JSC::Wasm::BBQJIT::emitIndirectCall): (JSC::Wasm::BBQJIT::emitShuffle): Canonical link: https://commits.webkit.org/267815.223@safari-7617-branch Canonical link: https://commits.webkit.org/266719.188@webkitglib/2.42
- Loading branch information
1 parent
b3c358d
commit b80ac5c
Showing
2 changed files
with
106 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//@ skip if !$isSIMDPlatform | ||
import { instantiate } from "../wabt-wrapper.js" | ||
import * as assert from "../assert.js" | ||
|
||
let wat = ` | ||
(module | ||
(func $log_value (import "a" "log_value") (param i32)) | ||
(func (export "test") (param $p0 i32) (param $p1 i32) (param $p2 i32) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(local.get $p1) | ||
(if (result i32) | ||
(local.get $p0) | ||
(then | ||
(local.set $p2 | ||
(local.get $p0)) | ||
(i32.const 0)) | ||
(else | ||
(i32.const 0))) | ||
(local.get $p2) | ||
(call $f) | ||
) | ||
(func $f (param i32) (param i32) (param i32) (param i32) (param i32) (param i32) (param i32) (param i32) (param i32) (param i32) (param $pl i32) | ||
(call $log_value | ||
(local.get $pl)) | ||
) | ||
) | ||
` | ||
|
||
async function test() { | ||
let log = [] | ||
const instance = await instantiate(wat, { a: { | ||
log_value: function(i) { log.push("value: " + i); }, | ||
} }, { simd: true }) | ||
const { test, test2 } = instance.exports | ||
|
||
let lastLog = [] | ||
for (let i = 0; i < 10000; ++i) { | ||
assert.eq(test(0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21), undefined) | ||
|
||
if (i > 0 && JSON.stringify(lastLog) != JSON.stringify(log)) { | ||
print(lastLog) | ||
print(log) | ||
throw "" | ||
} | ||
|
||
lastLog = log | ||
log = [] | ||
} | ||
|
||
print(lastLog) | ||
if (lastLog != "value: 3") | ||
throw "" | ||
|
||
;; print("Success") | ||
} | ||
|
||
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