| 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(),
|
| + 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(),
|
| + 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
|
|
|