Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: src/compiler/wasm-compiler.cc

Issue 2705293011: MIPS[64]: Fix unaligned arguments storage in Wasm-to-interpreter entry (Closed)
Patch Set: Make buildbots happy Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index da04b3d410d54c659e4a77ae63b22026ac3ac1d8..76fced92693793768f384a185462998c73090751 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2951,7 +2951,8 @@ void WasmGraphBuilder::BuildWasmInterpreterEntry(
// Compute size for the argument buffer.
int args_size_bytes = 0;
for (int i = 0; i < wasm_count; i++) {
- args_size_bytes += 1 << ElementSizeLog2Of(sig->GetParam(i));
+ args_size_bytes +=
+ RoundUpToMultipleOfPowOf2(1 << ElementSizeLog2Of(sig->GetParam(i)), 8);
}
// The return value is also passed via this buffer:
@@ -2980,7 +2981,13 @@ void WasmGraphBuilder::BuildWasmInterpreterEntry(
*effect_ =
graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer,
Int32Constant(offset), param, *effect_, *control_);
- offset += 1 << ElementSizeLog2Of(param_rep);
+
+ if (is_i64_as_two_params) {
+ offset += 1 << ElementSizeLog2Of(wasm::kWasmI32);
+ } else {
+ offset += RoundUpToMultipleOfPowOf2(1 << ElementSizeLog2Of(param_rep), 8);
+ }
+
// TODO(clemensh): Respect endianess here. Might need to swap upper and
// lower word.
if (is_i64_as_two_params) {
@@ -2993,6 +3000,8 @@ void WasmGraphBuilder::BuildWasmInterpreterEntry(
Int32Constant(offset), param, *effect_, *control_);
offset += 1 << ElementSizeLog2Of(wasm::kWasmI32);
}
+
+ DCHECK(IsAligned(offset, 8));
}
DCHECK_EQ(param_count, param_index);
DCHECK_EQ(args_size_bytes, offset);
@@ -3894,7 +3903,10 @@ Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index,
Zone zone(isolate->allocator(), ZONE_NAME);
Graph graph(&zone);
CommonOperatorBuilder common(&zone);
- MachineOperatorBuilder machine(&zone);
+ MachineOperatorBuilder machine(
+ &zone, MachineType::PointerRepresentation(),
+ InstructionSelector::SupportedMachineOperatorFlags(),
+ InstructionSelector::AlignmentRequirements());
JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
Node* control = nullptr;
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698