[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/782562 Reviewed-by: Eric Holk <eholk@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#49558}
This commit is contained in:
parent
65cd9669ed
commit
b972f7c695
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user