Commit 4c2fd721 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][interpreter] Check for shared memory in atomic.wait

For atomic.wait we have to check in generated code if the memory is
shared. If not, the code has to trap. In compiled code, this is done in
the runtime function. In the interpreter, however, this check was
missing. This CL adds the check to the interpreter.

R=thibaudm@chromium.org

Bug: chromium:1144603
Change-Id: If897e3f10b404ff677341ee14ad9eda7f5e64d16
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2512922Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70948}
parent 8574179a
......@@ -2034,6 +2034,10 @@ class WasmInterpreterInternals {
*len += 1;
break;
case kExprI32AtomicWait: {
if (!module()->has_shared_memory) {
DoTrap(kTrapUnreachable, pc);
return false;
}
int32_t val;
int64_t timeout;
uint32_t buffer_offset;
......@@ -2050,6 +2054,10 @@ class WasmInterpreterInternals {
break;
}
case kExprI64AtomicWait: {
if (!module()->has_shared_memory) {
DoTrap(kTrapUnreachable, pc);
return false;
}
int64_t val;
int64_t timeout;
uint32_t buffer_offset;
......@@ -2072,6 +2080,10 @@ class WasmInterpreterInternals {
&buffer_offset, &val)) {
return false;
}
if (!module()->has_shared_memory) {
Push(WasmValue(0));
break;
}
HandleScope handle_scope(isolate_);
Handle<JSArrayBuffer> array_buffer(
instance_object_->memory_object().array_buffer(), isolate_);
......
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