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

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

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Feedback from mseaborn 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 16edd232a5904f029a9d739969ae5c2d5b8dc7f1..1ca21cff670d9a181fdbcbb520e70d3c946b62d3 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2803,6 +2803,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_;
@@ -2812,6 +2819,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());
@@ -2856,6 +2871,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) {
@@ -2920,6 +2941,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

Powered by Google App Engine
This is Rietveld 408576698