Commit de71f3a
Implement saturating truncation, remaining memory and table operations, and update call to pass stack parameters
https://bugs.webkit.org/show_bug.cgi?id=259665
rdar://113166666
Reviewed by Yusuke Suzuki.
Added implementations for all saturating truncation instructions, as well as the remaining memory and table operations. Fixed bugs with regards to handling call parameter ordering, and allowed calls to pass arguments on stack.
* JSTests/wasm/ipint-tests/ipint-test-branch-table.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.result.i32.block.block.block.block.local.0.br_table.0.1.2.3.i32.const.2.return.i32.const.3.return.i32.const.5.return.i32.const.7.return.async test):
* JSTests/wasm/ipint-tests/ipint-test-call-add12.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.add.export.string_appeared_here.param.i32.i32.i32.i32.i32.i32.i32.i32.i32.i32.i32.i32.result.i32.local.0.local.1.i32.add.local.2.i32.add.local.3.i32.add.local.4.i32.add.local.5.i32.add.local.6.i32.add.local.7.i32.add.local.8.i32.add.local.9.i32.add.local.10.i32.add.local.11.i32.add.return.func.export.string_appeared_here.param.i32.result.i32.local.0.local.0.local.0.local.0.local.0.local.0.local.0.local.0.local.0.local.0.local.0.local.0.call.add.return.async test):
* JSTests/wasm/ipint-tests/ipint-test-call-arg-order.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.r2.param.i32.i32.result.i32.local.0.return.func.export.string_appeared_here.result.i32.i32.const.1.i32.const.2.call.r2.return.async test):
* JSTests/wasm/ipint-tests/ipint-test-call-stack-arg.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.r9.param.i32.i32.i32.i32.i32.i32.i32.i32.i32.i32.result.i32.local.8.return.func.export.string_appeared_here.result.i32.i32.const.1.i32.const.2.i32.const.3.i32.const.4.i32.const.5.i32.const.6.i32.const.7.i32.const.8.i32.const.9.i32.const.10.call.r9.return.async test):
* JSTests/wasm/ipint-tests/ipint-test-data-drop.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.memory.export.string_appeared_here.1.10.data.string_appeared_here.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.memory.init.0.func.export.string_appeared_here.data.drop.0.decodeString):
(async test):
* JSTests/wasm/ipint-tests/ipint-test-elem-drop.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.type.i2i.func.param.i32.result.i32.table.table.export.string_appeared_here.3.funcref.elem.3.3.3.elem.elems.4.4.4.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.table.init.0.elems.func.export.string_appeared_here.result.i32.i32.const.0.table.table.ref.is_null.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.const.0.call_indirect.table.type.i2i.func.null.param.i32.result.i32.local.0.func.inc.export.string_appeared_here.param.i32.result.i32.local.0.i32.const.1.i32.add.func.drop.export.string_appeared_here.elem.drop.elems.async test):
* JSTests/wasm/ipint-tests/ipint-test-i32-ops.js:
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.clz.return.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.ctz.return.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.popcnt.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.add.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.sub.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.mul.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.div_s.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.div_u.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.rem_s.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.rem_u.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.and.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.or.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.xor.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.shl.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.shr_s.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.shr_u.return.async test):
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.clz.return.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.ctz.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.add.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.sub.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.mul.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.div_s.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.div_u.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.and.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.or.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.xor.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.shl.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.shr_s.return.func.export.string_appeared_here.param.i32.i32.result.i32.local.0.local.1.i32.shr_u.return.async test): Deleted.
* JSTests/wasm/ipint-tests/ipint-test-i64-ops.js:
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i64.result.i64.local.0.i64.clz.return.func.export.string_appeared_here.param.i64.result.i64.local.0.i64.ctz.return.func.export.string_appeared_here.param.i64.result.i64.local.0.i64.popcnt.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.add.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.sub.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.mul.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.div_s.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.div_u.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.rem_s.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.rem_u.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.and.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.or.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.xor.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.shl.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.shr_s.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.shr_u.return.async test):
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i64.result.i64.local.0.i64.clz.return.func.export.string_appeared_here.param.i64.result.i64.local.0.i64.ctz.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.add.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.sub.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.mul.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.div_s.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.div_u.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.and.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.or.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.xor.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.shl.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.shr_s.return.func.export.string_appeared_here.param.i64.i64.result.i64.local.0.local.1.i64.shr_u.return.async test): Deleted.
* JSTests/wasm/ipint-tests/ipint-test-if.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.i32.i32.result.i32.local.0.then.local.1.return.local.2.return.async test):
* JSTests/wasm/ipint-tests/ipint-test-loop.js:
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.result.i32.local.0.loop.param.i32.result.i32.i32.const.1.i32.add.local.tee.0.local.0.i32.const.5.i32.sub.br_if.1.return.async test): Deleted.
* JSTests/wasm/ipint-tests/ipint-test-memory-copy.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.memory.export.string_appeared_here.1.10.data.i32.const.0x0.string_appeared_here.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.memory.copy.decodeString):
(async test):
* JSTests/wasm/ipint-tests/ipint-test-memory-fill.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.memory.export.string_appeared_here.1.10.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.memory.fill.decodeString):
(async test):
* JSTests/wasm/ipint-tests/ipint-test-memory-init.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.memory.export.string_appeared_here.1.10.data.string_appeared_here.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.memory.init.0.decodeString):
(async test):
* JSTests/wasm/ipint-tests/ipint-test-memory-size.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.memory.export.string_appeared_here.1.10.func.export.string_appeared_here.result.i32.memory.size.func.export.string_appeared_here.param.i32.result.i32.local.0.memory.grow.async test):
* JSTests/wasm/ipint-tests/ipint-test-select.js: Copied from JSTests/wasm/ipint-tests/ipint-test-loop.js.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.result.i32.i32.const.2.i32.const.1.local.0.select.async test):
* JSTests/wasm/ipint-tests/ipint-test-table-copy.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.type.i2i.func.param.i32.result.i32.table.table.3.funcref.table.table2.3.funcref.elem.3.3.3.elem.elems.4.4.4.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.table.init.table.elems.func.export.string_appeared_here.result.i32.i32.const.0.table.table.ref.is_null.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.const.0.call_indirect.table2.type.i2i.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.table.copy.table2.table.func.inc.export.string_appeared_here.param.i32.result.i32.local.0.i32.const.1.i32.add.async test):
* JSTests/wasm/ipint-tests/ipint-test-table-fill.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.type.i2i.func.param.i32.result.i32.table.table.5.funcref.elem.i32.const.0.0.0.0.0.0.func.export.string_appeared_here.result.i32.table.size.table.func.export.string_appeared_here.param.i32.i32.local.0.ref.null.func.local.1.table.fill.table.func.export.string_appeared_here.param.i32.result.i32.local.0.table.table.ref.is_null.async test):
* JSTests/wasm/ipint-tests/ipint-test-table-grow.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.type.i2i.func.param.i32.result.i32.table.table.3.funcref.elem.i32.const.0.0.0.0.func.export.string_appeared_here.result.i32.table.size.table.func.export.string_appeared_here.param.i32.result.i32.ref.null.func.local.0.table.grow.table.async test):
* JSTests/wasm/ipint-tests/ipint-test-table-init.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.type.i2i.func.param.i32.result.i32.table.table.export.string_appeared_here.3.funcref.elem.3.3.3.elem.elems.4.4.4.func.export.string_appeared_here.param.i32.i32.i32.local.0.local.1.local.2.table.init.0.elems.func.export.string_appeared_here.result.i32.i32.const.0.table.table.ref.is_null.func.export.string_appeared_here.param.i32.result.i32.local.0.i32.const.0.call_indirect.table.type.i2i.func.null.param.i32.result.i32.local.0.func.inc.export.string_appeared_here.param.i32.result.i32.local.0.i32.const.1.i32.add.async test):
* JSTests/wasm/ipint-tests/ipint-test-trunc-sat.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.f32.result.i32.local.0.i32.trunc_sat_f32_s.func.export.string_appeared_here.param.f32.result.i32.local.0.i32.trunc_sat_f32_u.func.export.string_appeared_here.param.f64.result.i32.local.0.i32.trunc_sat_f64_s.func.export.string_appeared_here.param.f64.result.i32.local.0.i32.trunc_sat_f64_u.func.export.string_appeared_here.param.f32.result.i64.local.0.i64.trunc_sat_f32_s.func.export.string_appeared_here.param.f32.result.i64.local.0.i64.trunc_sat_f32_u.func.export.string_appeared_here.param.f64.result.i64.local.0.i64.trunc_sat_f64_s.func.export.string_appeared_here.param.f64.result.i64.local.0.i64.trunc_sat_f64_u.async test):
* JSTests/wasm/ipint-tests/ipint-test-typed-select.js: Copied from JSTests/wasm/ipint-tests/ipint-test-loop.js.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.param.i32.result.i32.i32.const.2.i32.const.1.local.0.select.result.i32.async test):
* Source/JavaScriptCore/llint/InPlaceInterpreter.asm:
* Source/JavaScriptCore/llint/InPlaceInterpreter.cpp:
(JSC::IPInt::initialize):
* Source/JavaScriptCore/llint/InPlaceInterpreter.h:
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::IPIntCallee::IPIntCallee):
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.cpp:
(JSC::Wasm::FunctionIPIntMetadataGenerator::addReturnData):
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h:
* Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp:
(JSC::Wasm::IPIntGenerator::addTableInit):
(JSC::Wasm::IPIntGenerator::addElemDrop):
(JSC::Wasm::IPIntGenerator::addTableSize):
(JSC::Wasm::IPIntGenerator::addTableGrow):
(JSC::Wasm::IPIntGenerator::addTableFill):
(JSC::Wasm::IPIntGenerator::addTableCopy):
(JSC::Wasm::IPIntGenerator::addMemoryInit):
(JSC::Wasm::IPIntGenerator::addDataDrop):
(JSC::Wasm::IPIntGenerator::addSelect):
(JSC::Wasm::IPIntGenerator::addElse):
(JSC::Wasm::IPIntGenerator::addElseToUnreachable):
(JSC::Wasm::IPIntGenerator::addSwitch):
(JSC::Wasm::IPIntGenerator::addEndToUnreachable):
(JSC::Wasm::IPIntGenerator::addCallCommonData):
* Source/JavaScriptCore/wasm/WasmModule.cpp:
(JSC::Wasm::makeValidationCallback):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::WASM_IPINT_EXTERN_CPP_DECL):
(JSC::LLInt::WASM_IPINT_EXTERN_CPP_DECL_1P):
* Source/JavaScriptCore/wasm/WasmSlowPaths.h:
Canonical link: https://commits.webkit.org/266545@main1 parent 6ee1cc8 commit de71f3a
43 files changed
Lines changed: 2080 additions & 134 deletions
File tree
- JSTests/wasm/ipint-tests
- Source/JavaScriptCore
- llint
- runtime
- wasm
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments