Commit 3cc88456 authored by binji's avatar binji Committed by Commit bot

Add setter to Isolate for allowing Atomics.wait

This makes it easier to set the value for embedders where it is
difficult to plumb through to the Isolate constructor.

BUG=chromium:711809
R=jochen@chromium.org

Review-Url: https://codereview.chromium.org/2829223002
Cr-Commit-Position: refs/heads/master@{#44813}
parent a71c338d
......@@ -6619,7 +6619,7 @@ class V8_EXPORT Isolate {
/**
* Whether calling Atomics.wait (a function that may block) is allowed in
* this isolate.
* this isolate. This can also be configured via SetAllowAtomicsWait.
*/
bool allow_atomics_wait;
......@@ -7479,6 +7479,13 @@ class V8_EXPORT Isolate {
*/
bool IsInUse();
/**
* Set whether calling Atomics.wait (a function that may block) is allowed in
* this isolate. This can also be configured via
* CreateParams::allow_atomics_wait.
*/
void SetAllowAtomicsWait(bool allow);
Isolate() = delete;
~Isolate() = delete;
Isolate(const Isolate&) = delete;
......
......@@ -8942,6 +8942,10 @@ void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) {
isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds(visitor);
}
void Isolate::SetAllowAtomicsWait(bool allow) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->set_allow_atomics_wait(allow);
}
MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type)
: isolate_(reinterpret_cast<i::Isolate*>(isolate)),
......
......@@ -26557,3 +26557,18 @@ TEST(DeterministicRandomNumberGeneration) {
v8::internal::FLAG_random_seed = previous_seed;
}
UNINITIALIZED_TEST(AllowAtomicsWait) {
using namespace i;
v8::Isolate::CreateParams create_params;
create_params.allow_atomics_wait = false;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
{
CHECK_EQ(false, i_isolate->allow_atomics_wait());
isolate->SetAllowAtomicsWait(true);
CHECK_EQ(true, i_isolate->allow_atomics_wait());
}
isolate->Dispose();
}
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