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

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

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Addressing some of Jochen's feedback Created 3 years, 12 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 bd039d3f9504b9b22ad7ea5437540f5c36c8c921..f346fc78fb893fd8311e93c7147df93ffe12c451 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2777,6 +2777,12 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
}
}
+ // Set the ThreadInWasm flag before we do the actual call.
+ Node* parameters[] = {};
+ BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), parameters, 0,
+ effect_, *control_);
+
args[pos++] = *effect_;
args[pos++] = *control_;
@@ -2788,6 +2794,12 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
}
Node* call = graph()->NewNode(jsgraph()->common()->Call(desc), count, args);
*effect_ = call;
+
+ // Clear the ThreadInWasmFlag
+ BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), parameters, 0,
+ effect_, *control_);
+
Node* retval = call;
if (jsgraph()->machine()->Is32() && sig->return_count() > 0 &&
sig->GetReturn(0) == wasm::kWasmI64) {
@@ -2839,6 +2851,11 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
Node* call;
bool direct_call = false;
+ Node* parameters[] = {};
+ BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), parameters, 0,
+ effect_, *control_);
+
if (target->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(target);
if (function->shared()->internal_formal_parameter_count() == wasm_count) {
@@ -2903,6 +2920,10 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
*effect_ = call;
SetSourcePosition(call, 0);
+ BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(),
+ jsgraph()->isolate()->native_context(), parameters, 0,
+ effect_, *control_);
+
// Convert the return value back.
Node* i32_zero = jsgraph()->Int32Constant(0);
Node* val = sig->return_count() == 0

Powered by Google App Engine
This is Rietveld 408576698