@@ -3478,16 +3478,37 @@ Local<Context> NewContext(Isolate* isolate,
34783478 auto context = Context::New (isolate, nullptr , object_template);
34793479 if (context.IsEmpty ()) return context;
34803480 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" );
34833481 context->SetEmbedderData (
34843482 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" );
34853486 Local<Value> intl_v;
34863487 if (context->Global ()->Get (context, intl_key).ToLocal (&intl_v) &&
34873488 intl_v->IsObject ()) {
34883489 Local<Object> intl = intl_v.As <Object>();
34893490 intl->Delete (context, break_iter_key).FromJust ();
34903491 }
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+
34913512 return context;
34923513}
34933514
0 commit comments