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

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

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Handler signal handler registration failure Created 3 years, 11 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
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 08ab36dc1ab6a64a59e45a2312e13e038f0b80f3..d1429e08422d01f85d722129c74f2b0805fc1711 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2805,6 +2805,13 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
args[pos++] = wasm_param;
}
+ // Set the ThreadInWasm flag before we do the actual call.
+ if (trap_handler::EnableTrapHandler()) {
+ BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), nullptr, 0,
+ effect_, *control_);
+ }
+
args[pos++] = *effect_;
args[pos++] = *control_;
@@ -2814,6 +2821,14 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
Node* call = graph()->NewNode(jsgraph()->common()->Call(desc), count, args);
*effect_ = call;
+
+ // Clear the ThreadInWasmFlag
+ if (trap_handler::EnableTrapHandler()) {
+ BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), nullptr, 0,
+ effect_, *control_);
+ }
+
Node* retval = call;
Node* jsval = ToJS(
retval, sig->return_count() == 0 ? wasm::kWasmStmt : sig->GetReturn());
@@ -2858,6 +2873,12 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
Node* call;
bool direct_call = false;
+ if (trap_handler::EnableTrapHandler()) {
+ BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), nullptr, 0,
+ effect_, *control_);
+ }
+
if (target->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(target);
if (function->shared()->internal_formal_parameter_count() == wasm_count) {
@@ -2922,6 +2943,12 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
*effect_ = call;
SetSourcePosition(call, 0);
+ if (trap_handler::EnableTrapHandler()) {
+ BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), nullptr, 0,
+ effect_, *control_);
+ }
+
// Convert the return value back.
Node* i32_zero = jsgraph()->Int32Constant(0);
Node* val = sig->return_count() == 0
« no previous file with comments | « src/api.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | src/trap-handler/OWNERS » ('J')

Powered by Google App Engine
This is Rietveld 408576698