| Index: src/compiler/wasm-compiler.cc
|
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
|
| index 811d1bf3b65ced92a0095d256ac1725f624c6b35..6423f56ecfae26f9be457b8788fe4cf49cd3aabf 100644
|
| --- a/src/compiler/wasm-compiler.cc
|
| +++ b/src/compiler/wasm-compiler.cc
|
| @@ -2772,15 +2772,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) {
|
| + 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 {
|
| + load = graph()->NewNode(jsgraph()->machine()->Load(memtype),
|
| + MemBuffer(offset), index, *effect_, *control_);
|
| + }
|
| } else {
|
| + DCHECK(!FLAG_wasm_trap_handler);
|
| load = graph()->NewNode(jsgraph()->machine()->UnalignedLoad(memtype),
|
| MemBuffer(offset), index, *effect_, *control_);
|
| }
|
|
|