Commit fba90473 authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Check for replacements of IndexNodes in the Int64Lowering.

The index input of load and store nodes has to be of type int32. However
it is still possible that this index input was lowered by the
Int64Lowering, for example if the index was a kTruncateInt64ToInt32
node. With this CL we check if there exists a replacement of the index
and if so, use the replacement instead of the original index as the
input for the lowered load and store nodes.

BUG=v8:5874
R=titzer@chromium.org, eholk@chromium.org

Review-Url: https://codereview.chromium.org/2644603004
Cr-Commit-Position: refs/heads/master@{#42559}
parent 77d08c13
......@@ -105,6 +105,9 @@ static int GetReturnCountAfterLowering(
void Int64Lowering::GetIndexNodes(Node* index, Node*& index_low,
Node*& index_high) {
if (HasReplacementLow(index)) {
index = GetReplacementLow(index);
}
#if defined(V8_TARGET_LITTLE_ENDIAN)
index_low = index;
index_high = graph()->NewNode(machine()->Int32Add(), index,
......
......@@ -1632,3 +1632,19 @@ WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); }
WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); }
WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); }
WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); }
WASM_EXEC_TEST(Regress5874) {
REQUIRE(I32ConvertI64);
REQUIRE(I64LoadStore);
REQUIRE(I64Const);
WasmRunner<int32_t> r(execution_mode);
r.module().AddMemoryElems<int64_t>(8);
BUILD(r, kExprI64Const, 0x00, // --
kExprI32ConvertI64, // --
kExprI64Const, 0x00, // --
kExprI64StoreMem, 0x03, 0x00, // --
kExprI32Const, 0x00); // --
r.Call();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment