@@ -4031,16 +4031,37 @@ Local<Context> NewContext(Isolate* isolate,
4031
4031
auto context = Context::New (isolate, nullptr , object_template);
4032
4032
if (context.IsEmpty ()) return context;
4033
4033
HandleScope handle_scope (isolate);
4034
- auto intl_key = FIXED_ONE_BYTE_STRING (isolate, " Intl" );
4035
- auto break_iter_key = FIXED_ONE_BYTE_STRING (isolate, " v8BreakIterator" );
4036
4034
context->SetEmbedderData (
4037
4035
ContextEmbedderIndex::kAllowWasmCodeGeneration , True (isolate));
4036
+
4037
+ auto intl_key = FIXED_ONE_BYTE_STRING (isolate, " Intl" );
4038
+ auto break_iter_key = FIXED_ONE_BYTE_STRING (isolate, " v8BreakIterator" );
4038
4039
Local<Value> intl_v;
4039
4040
if (context->Global ()->Get (context, intl_key).ToLocal (&intl_v) &&
4040
4041
intl_v->IsObject ()) {
4041
4042
Local<Object> intl = intl_v.As <Object>();
4042
4043
intl->Delete (context, break_iter_key).FromJust ();
4043
4044
}
4045
+
4046
+ // https://github.com/nodejs/node/issues/21219
4047
+ // TODO(devsnek): remove when v8 supports Atomics.notify
4048
+ auto atomics_key = FIXED_ONE_BYTE_STRING (isolate, " Atomics" );
4049
+ Local<Value> atomics_v;
4050
+ if (context->Global ()->Get (context, atomics_key).ToLocal (&atomics_v) &&
4051
+ atomics_v->IsObject ()) {
4052
+ Local<Object> atomics = atomics_v.As <Object>();
4053
+ auto wake_key = FIXED_ONE_BYTE_STRING (isolate, " wake" );
4054
+
4055
+ Local<Value> wake = atomics->Get (context, wake_key).ToLocalChecked ();
4056
+ auto notify_key = FIXED_ONE_BYTE_STRING (isolate, " notify" );
4057
+
4058
+ v8::PropertyDescriptor desc (wake, true );
4059
+ desc.set_enumerable (false );
4060
+ desc.set_configurable (true );
4061
+
4062
+ atomics->DefineProperty (context, notify_key, desc).ToChecked ();
4063
+ }
4064
+
4044
4065
return context;
4045
4066
}
4046
4067
0 commit comments