Commit 2598687c authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Add missing ClearThreadInWasmScope scopes

The atomics.wait implementations need to reset the "thread in wasm" flag
during their execution, as they might handle interrupts, at which point
we assume (and occasionally check) that the "thread in wasm" flag is not
set.
Also for security it's better to reset the flag as soon as we leave wasm
code.

R=ahaas@chromium.org

Bug: chromium:1054507
Change-Id: Iad03a54819d271968568505445890fde732e6844
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2066967Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66385}
parent fc1d2339
......@@ -380,6 +380,7 @@ Handle<JSArrayBuffer> getSharedArrayBuffer(Handle<WasmInstanceObject> instance,
}
RUNTIME_FUNCTION(Runtime_WasmAtomicNotify) {
ClearThreadInWasmScope clear_wasm_flag;
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
......@@ -398,6 +399,7 @@ double WaitTimeoutInMs(double timeout_ns) {
}
RUNTIME_FUNCTION(Runtime_WasmI32AtomicWait) {
ClearThreadInWasmScope clear_wasm_flag;
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
......@@ -412,6 +414,7 @@ RUNTIME_FUNCTION(Runtime_WasmI32AtomicWait) {
}
RUNTIME_FUNCTION(Runtime_WasmI64AtomicWait) {
ClearThreadInWasmScope clear_wasm_flag;
HandleScope scope(isolate);
DCHECK_EQ(5, args.length());
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment