Commit b972f7c6 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] [cleanup] Use trap_handler::UseTrapHandler()

Instead of repeating the condition for using trap handlers everywhere
in the compiler, just use the existing function
{trap_handler::UseTrapHandler()}.
Note that the trap-handler.h was already included transitively, I just
add it to comply to IWYU.

R=eholk@chromium.org

Change-Id: Id61910c7ac5b134b07cb266664e87a2f39a896d4
Reviewed-on: https://chromium-review.googlesource.com/782562Reviewed-by: 's avatarEric Holk <eholk@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49558}
parent 65cd9669
......@@ -31,6 +31,7 @@
#include "src/factory.h"
#include "src/isolate-inl.h"
#include "src/log-inl.h"
#include "src/trap-handler/trap-handler.h"
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-module.h"
......@@ -3511,7 +3512,7 @@ Node* WasmGraphBuilder::LoadMem(wasm::ValueType type, MachineType memtype,
graph()->NewNode(jsgraph()->machine()->ChangeUint32ToUint64(), index);
}
// Wasm semantics throw on OOB. Introduce explicit bounds check.
if (!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED) {
if (!trap_handler::UseTrapHandler()) {
BoundsCheckMem(memtype, index, offset, position);
}
......@@ -3527,7 +3528,7 @@ Node* WasmGraphBuilder::LoadMem(wasm::ValueType type, MachineType memtype,
}
} else {
// TODO(eholk): Support unaligned loads with trap handlers.
DCHECK(!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED);
DCHECK(!trap_handler::UseTrapHandler());
load = graph()->NewNode(jsgraph()->machine()->UnalignedLoad(memtype),
MemBuffer(offset), index, *effect_, *control_);
}
......@@ -3570,7 +3571,7 @@ Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
graph()->NewNode(jsgraph()->machine()->ChangeUint32ToUint64(), index);
}
// Wasm semantics throw on OOB. Introduce explicit bounds check.
if (!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED) {
if (!trap_handler::UseTrapHandler()) {
BoundsCheckMem(memtype, index, offset, position);
}
......@@ -3580,7 +3581,7 @@ Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
if (memtype.representation() == MachineRepresentation::kWord8 ||
jsgraph()->machine()->UnalignedStoreSupported(memtype.representation())) {
if (FLAG_wasm_trap_handler && V8_TRAP_HANDLER_SUPPORTED) {
if (trap_handler::UseTrapHandler()) {
store = graph()->NewNode(
jsgraph()->machine()->ProtectedStore(memtype.representation()),
MemBuffer(offset), index, val, *effect_, *control_);
......@@ -3593,7 +3594,7 @@ Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
}
} else {
// TODO(eholk): Support unaligned stores with trap handlers.
DCHECK(!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED);
DCHECK(!trap_handler::UseTrapHandler());
UnalignedStoreRepresentation rep(memtype.representation());
store =
graph()->NewNode(jsgraph()->machine()->UnalignedStore(rep),
......
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