-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 2e29306. rdar://problem/110634913
Prevent duplication of WASM throw and rethrow patchpoints in B3 https://bugs.webkit.org/show_bug.cgi?id=258408 rdar://110634913 Reviewed by Yusuke Suzuki. Adds a cloningForbidden property to B3Kind, used to prevent a B3 value from being cloned during optimizations, and applies it to the patchpoints generated for the WASM throw and rethrow opcodes in WasmB3IRGenerator. This prevents a problem where these patchpoints could be duplicated, still share a stackmap/callsite index, but have conflicting live value locations. * JSTests/wasm/stress/phi-live-across-rethrow.js: Added. (async test): * JSTests/wasm/stress/phi-live-across-throw.js: Added. (async test): * Source/JavaScriptCore/b3/B3DuplicateTails.cpp: * Source/JavaScriptCore/b3/B3Kind.cpp: (JSC::B3::Kind::dump const): * Source/JavaScriptCore/b3/B3Kind.h: (JSC::B3::Kind::hasCloningForbidden): (JSC::B3::Kind::hasCloningForbidden const): (JSC::B3::Kind::isCloningForbidden const): (JSC::B3::Kind::setIsCloningForbidden): (JSC::B3::Kind::operator== const): (JSC::B3::Kind::hash const): (JSC::B3::cloningForbidden): * Source/JavaScriptCore/b3/B3PatchpointValue.cpp: (JSC::B3::PatchpointValue::PatchpointValue): * Source/JavaScriptCore/b3/B3PatchpointValue.h: * Source/JavaScriptCore/b3/B3ValueInlines.h: (JSC::B3::Value::cloneImpl const): * Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::addThrow): (JSC::Wasm::B3IRGenerator::addRethrow): Canonical link: https://commits.webkit.org/259548.844@safari-7615-branch Identifier: 259548.843@safari-7615.3.9.11-branch
- Loading branch information
Showing
9 changed files
with
124 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,37 @@ | ||
import { instantiate } from "../wabt-wrapper.js"; | ||
import * as assert from "../assert.js"; | ||
|
||
let wat = ` | ||
(module | ||
(global i32 i32.const 43) | ||
(global i32 i32.const 1) | ||
(func (export "test") (result i32) (local i32) | ||
try | ||
try | ||
throw $exc | ||
catch $exc | ||
i32.const 42 | ||
local.set 0 | ||
block | ||
global.get 1 | ||
br_if 0 | ||
global.get 0 | ||
local.set 0 | ||
end | ||
rethrow 0 | ||
end | ||
catch $exc | ||
end | ||
local.get 0 | ||
) | ||
(tag $exc) | ||
) | ||
`; | ||
|
||
async function test() { | ||
const instance = await instantiate(wat, {}, { exceptions: true }); | ||
for (let i = 0; i < 20000; i ++) | ||
assert.eq(instance.exports.test(), 42); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { instantiate } from "../wabt-wrapper.js"; | ||
import * as assert from "../assert.js"; | ||
|
||
let wat = ` | ||
(module | ||
(global i32 i32.const 43) | ||
(global i32 i32.const 1) | ||
(func (export "test") (result i32) (local i32) | ||
i32.const 42 | ||
local.set 0 | ||
block | ||
global.get 1 | ||
br_if 0 | ||
global.get 0 | ||
local.set 0 | ||
end | ||
try | ||
throw $exc | ||
catch $exc | ||
end | ||
local.get 0 | ||
) | ||
(tag $exc) | ||
) | ||
`; | ||
|
||
async function test() { | ||
const instance = await instantiate(wat, {}, { exceptions: true }); | ||
for (let i = 0; i < 20000; i ++) | ||
assert.eq(instance.exports.test(), 42); | ||
} | ||
|
||
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
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
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
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
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
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
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