Index: src/runtime/runtime-futex.cc |
diff --git a/src/runtime/runtime-futex.cc b/src/runtime/runtime-futex.cc |
index 4af0831acf556e6c57f725c915e455c2ffc106e2..35282598ffa4100f963271c86f83435d4031c00e 100644 |
--- a/src/runtime/runtime-futex.cc |
+++ b/src/runtime/runtime-futex.cc |
@@ -29,6 +29,11 @@ RUNTIME_FUNCTION(Runtime_AtomicsWait) { |
CHECK_EQ(sta->type(), kExternalInt32Array); |
CHECK(timeout == V8_INFINITY || !std::isnan(timeout)); |
+ if (!isolate->allow_atomics_wait()) { |
+ THROW_NEW_ERROR_RETURN_FAILURE( |
+ isolate, NewTypeError(MessageTemplate::kAtomicsWaitNotAllowed)); |
+ } |
+ |
Handle<JSArrayBuffer> array_buffer = sta->GetBuffer(); |
size_t addr = (index << 2) + NumberToSize(sta->byte_offset()); |
@@ -65,5 +70,14 @@ RUNTIME_FUNCTION(Runtime_AtomicsNumWaitersForTesting) { |
return FutexEmulation::NumWaitersForTesting(isolate, array_buffer, addr); |
} |
+ |
+RUNTIME_FUNCTION(Runtime_SetAllowAtomicsWait) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_BOOLEAN_ARG_CHECKED(set, 0); |
+ |
+ isolate->set_allow_atomics_wait(set); |
+ return isolate->heap()->undefined_value(); |
+} |
} // namespace internal |
} // namespace v8 |