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

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

Issue 2301833004: [wasm] Trap handling: ProtectedLoad instruction (Closed)
Patch Set: Add VisitProtectedLoad stubs for other architectures Created 4 years, 3 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 | « src/compiler/verifier.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('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 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_);
}
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698