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

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

Issue 2723133003: Revert of [wasm] Initial signal handler (Closed)
Patch Set: Created 3 years, 10 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/api.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 4866597ba6d94b3a71ea30dfe50078f409355267..b8f94239206638acf94248d842d4da9cf4d6104f 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -111,6 +111,13 @@
} // namespace
+// TODO(eholk): Support trap handlers on other platforms.
+#if V8_TARGET_ARCH_X64 && V8_OS_LINUX
+const bool kTrapHandlerSupported = true;
+#else
+const bool kTrapHandlerSupported = false;
+#endif
+
// A helper that handles building graph fragments for trapping.
// To avoid generating a ton of redundant code that just calls the runtime
// to trap, we generate a per-trap-reason block of code that all trap sites
@@ -2800,15 +2807,6 @@
args[pos++] = wasm_param;
}
- // Set the ThreadInWasm flag before we do the actual call.
- if (trap_handler::UseTrapHandler()) {
- // TODO(eholk): Set the flag directly without a runtime call. We should be
- // able to store directly to a location in the isolate (later TLS) that sets
- // the g_thread_in_wasm_code flag.
- BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(), nullptr, 0,
- effect_, *control_);
- }
-
args[pos++] = *effect_;
args[pos++] = *control_;
@@ -2818,16 +2816,6 @@
Node* call = graph()->NewNode(jsgraph()->common()->Call(desc), count, args);
*effect_ = call;
-
- // Clear the ThreadInWasmFlag
- if (trap_handler::UseTrapHandler()) {
- // TODO(eholk): Set the flag directly without a runtime call. We should be
- // able to store directly to a location in the isolate (later TLS) that sets
- // the g_thread_in_wasm_code flag.
- BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(), nullptr, 0,
- effect_, *control_);
- }
-
Node* retval = call;
Node* jsval = ToJS(
retval, sig->return_count() == 0 ? wasm::kWasmStmt : sig->GetReturn());
@@ -2873,11 +2861,6 @@
Node* call;
bool direct_call = false;
-
- if (trap_handler::UseTrapHandler()) {
- BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(), nullptr, 0,
- effect_, *control_);
- }
if (target->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(target);
@@ -2942,11 +2925,6 @@
*effect_ = call;
SetSourcePosition(call, 0);
-
- if (trap_handler::UseTrapHandler()) {
- BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(), nullptr, 0,
- effect_, *control_);
- }
// Convert the return value back.
Node* i32_zero = jsgraph()->Int32Constant(0);
@@ -3221,7 +3199,7 @@
Node* load;
// WASM semantics throw on OOB. Introduce explicit bounds check.
- if (!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED) {
+ if (!FLAG_wasm_trap_handler || !kTrapHandlerSupported) {
BoundsCheckMem(memtype, index, offset, position);
}
bool aligned = static_cast<int>(alignment) >=
@@ -3229,7 +3207,7 @@
if (aligned ||
jsgraph()->machine()->UnalignedLoadSupported(memtype, alignment)) {
- if (FLAG_wasm_trap_handler && V8_TRAP_HANDLER_SUPPORTED) {
+ if (FLAG_wasm_trap_handler && kTrapHandlerSupported) {
DCHECK(FLAG_wasm_guard_pages);
Node* position_node = jsgraph()->Int32Constant(position);
load = graph()->NewNode(jsgraph()->machine()->ProtectedLoad(memtype),
@@ -3241,7 +3219,7 @@
}
} else {
// TODO(eholk): Support unaligned loads with trap handlers.
- DCHECK(!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED);
+ DCHECK(!FLAG_wasm_trap_handler || !kTrapHandlerSupported);
load = graph()->NewNode(jsgraph()->machine()->UnalignedLoad(memtype),
MemBuffer(offset), index, *effect_, *control_);
}
@@ -3275,7 +3253,7 @@
Node* store;
// WASM semantics throw on OOB. Introduce explicit bounds check.
- if (!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED) {
+ if (!FLAG_wasm_trap_handler || !kTrapHandlerSupported) {
BoundsCheckMem(memtype, index, offset, position);
}
StoreRepresentation rep(memtype.representation(), kNoWriteBarrier);
@@ -3289,7 +3267,7 @@
if (aligned ||
jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) {
- if (FLAG_wasm_trap_handler && V8_TRAP_HANDLER_SUPPORTED) {
+ if (FLAG_wasm_trap_handler && kTrapHandlerSupported) {
Node* position_node = jsgraph()->Int32Constant(position);
store = graph()->NewNode(
jsgraph()->machine()->ProtectedStore(memtype.representation()),
@@ -3302,7 +3280,7 @@
}
} else {
// TODO(eholk): Support unaligned stores with trap handlers.
- DCHECK(!FLAG_wasm_trap_handler || !V8_TRAP_HANDLER_SUPPORTED);
+ DCHECK(!FLAG_wasm_trap_handler || !kTrapHandlerSupported);
UnalignedStoreRepresentation rep(memtype.representation());
store =
graph()->NewNode(jsgraph()->machine()->UnalignedStore(rep),
« no previous file with comments | « src/api.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698