@@ -3478,16 +3478,37 @@ Local<Context> NewContext(Isolate* isolate,
3478
3478
auto context = Context::New (isolate, nullptr , object_template);
3479
3479
if (context.IsEmpty ()) return context;
3480
3480
HandleScope handle_scope (isolate);
3481
- auto intl_key = FIXED_ONE_BYTE_STRING (isolate, " Intl" );
3482
- auto break_iter_key = FIXED_ONE_BYTE_STRING (isolate, " v8BreakIterator" );
3483
3481
context->SetEmbedderData (
3484
3482
ContextEmbedderIndex::kAllowWasmCodeGeneration , True (isolate));
3483
+
3484
+ auto intl_key = FIXED_ONE_BYTE_STRING (isolate, " Intl" );
3485
+ auto break_iter_key = FIXED_ONE_BYTE_STRING (isolate, " v8BreakIterator" );
3485
3486
Local<Value> intl_v;
3486
3487
if (context->Global ()->Get (context, intl_key).ToLocal (&intl_v) &&
3487
3488
intl_v->IsObject ()) {
3488
3489
Local<Object> intl = intl_v.As <Object>();
3489
3490
intl->Delete (context, break_iter_key).FromJust ();
3490
3491
}
3492
+
3493
+ // https://github.com/nodejs/node/issues/21219
3494
+ // TODO(devsnek): remove when v8 supports Atomics.notify
3495
+ auto atomics_key = FIXED_ONE_BYTE_STRING (isolate, " Atomics" );
3496
+ Local<Value> atomics_v;
3497
+ if (context->Global ()->Get (context, atomics_key).ToLocal (&atomics_v) &&
3498
+ atomics_v->IsObject ()) {
3499
+ Local<Object> atomics = atomics_v.As <Object>();
3500
+ auto wake_key = FIXED_ONE_BYTE_STRING (isolate, " wake" );
3501
+
3502
+ Local<Value> wake = atomics->Get (context, wake_key).ToLocalChecked ();
3503
+ auto notify_key = FIXED_ONE_BYTE_STRING (isolate, " notify" );
3504
+
3505
+ v8::PropertyDescriptor desc (wake, true );
3506
+ desc.set_enumerable (false );
3507
+ desc.set_configurable (true );
3508
+
3509
+ atomics->DefineProperty (context, notify_key, desc).ToChecked ();
3510
+ }
3511
+
3491
3512
return context;
3492
3513
}
3493
3514
0 commit comments