Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index b461e2fab7c90eca9823f5180241620a856b53fb..2cf75e15de15000d7f3b644ce546fbd0bba647b4 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -2807,6 +2807,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::ShouldEnableTrapHandler()) { |
+ BuildCallToRuntime(Runtime::kSetThreadInWasm, jsgraph(), |
ahaas
2017/02/20 09:27:23
I wonder if we could set this flag without a runti
titzer
2017/02/20 09:50:08
+1. I think you can embed a store directly to a lo
Eric Holk
2017/02/23 02:16:55
TODO is added.
|
+ jsgraph()->isolate()->native_context(), nullptr, 0, |
+ effect_, *control_); |
+ } |
+ |
args[pos++] = *effect_; |
args[pos++] = *control_; |
@@ -2816,6 +2823,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::ShouldEnableTrapHandler()) { |
+ BuildCallToRuntime(Runtime::kClearThreadInWasm, jsgraph(), |
ahaas
2017/02/20 09:27:24
Is this runtime function called when WebAssembly t
Eric Holk
2017/02/23 02:16:55
The changes in isolate.cc will clear the flag when
|
+ jsgraph()->isolate()->native_context(), nullptr, 0, |
+ effect_, *control_); |
+ } |
+ |
Node* retval = call; |
Node* jsval = ToJS( |
retval, sig->return_count() == 0 ? wasm::kWasmStmt : sig->GetReturn()); |
@@ -2860,6 +2875,12 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target, |
Node* call; |
bool direct_call = false; |
+ if (trap_handler::ShouldEnableTrapHandler()) { |
+ 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) { |
@@ -2924,6 +2945,12 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target, |
*effect_ = call; |
SetSourcePosition(call, 0); |
+ if (trap_handler::ShouldEnableTrapHandler()) { |
+ 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 |