Chromium Code Reviews| Index: src/compiler/wasm-compiler.cc |
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
| index 35e78b6aa2a617ad7241d5e2b33e10419e8dc920..1d9c68c229da8a14573e1754f295deec00e762db 100644 |
| --- a/src/compiler/wasm-compiler.cc |
| +++ b/src/compiler/wasm-compiler.cc |
| @@ -45,6 +45,7 @@ |
| namespace v8 { |
| namespace internal { |
| + |
| namespace compiler { |
| namespace { |
| @@ -2759,15 +2760,26 @@ Node* WasmGraphBuilder::LoadMem(wasm::LocalType type, MachineType memtype, |
| Node* load; |
| // WASM semantics throw on OOB. Introduce explicit bounds check. |
| - BoundsCheckMem(memtype, index, offset, position); |
| + if (!FLAG_wasm_trap_handler) { |
| + BoundsCheckMem(memtype, index, offset, position); |
| + } |
| bool aligned = static_cast<int>(alignment) >= |
| ElementSizeLog2Of(memtype.representation()); |
| if (aligned || |
| jsgraph()->machine()->UnalignedLoadSupported(memtype, alignment)) { |
| - load = graph()->NewNode(jsgraph()->machine()->Load(memtype), |
| - MemBuffer(offset), index, *effect_, *control_); |
| + if (!FLAG_wasm_trap_handler) { |
|
titzer
2016/09/08 17:06:35
Flip sense of if?
Eric Holk
2016/09/08 21:11:56
Done.
|
| + load = graph()->NewNode(jsgraph()->machine()->Load(memtype), |
| + MemBuffer(offset), index, *effect_, *control_); |
| + } else { |
| + Node* context = HeapConstant(module_->instance->context); |
| + Node* position_node = jsgraph()->Int32Constant(position); |
| + load = graph()->NewNode(jsgraph()->machine()->ProtectedLoad(memtype), |
| + MemBuffer(offset), index, context, position_node, |
| + *effect_, *control_); |
| + } |
| } else { |
| + DCHECK(!FLAG_wasm_trap_handler); |
| load = graph()->NewNode(jsgraph()->machine()->UnalignedLoad(memtype), |
| MemBuffer(offset), index, *effect_, *control_); |
| } |