@@ -3105,17 +3105,22 @@ bool AllowWasmCodeGenerationCallback(
3105
3105
return wasm_code_gen->IsUndefined () || wasm_code_gen->IsTrue ();
3106
3106
}
3107
3107
3108
- Isolate* NewIsolate (ArrayBufferAllocator* allocator) {
3108
+ Isolate* NewIsolate (ArrayBufferAllocator* allocator, uv_loop_t * event_loop ) {
3109
3109
Isolate::CreateParams params;
3110
3110
params.array_buffer_allocator = allocator;
3111
3111
#ifdef NODE_ENABLE_VTUNE_PROFILING
3112
3112
params.code_event_handler = vTune::GetVtuneCodeEventHandler ();
3113
3113
#endif
3114
3114
3115
- Isolate* isolate = Isolate::New (params );
3115
+ Isolate* isolate = Isolate::Allocate ( );
3116
3116
if (isolate == nullptr )
3117
3117
return nullptr ;
3118
3118
3119
+ // Register the isolate on the platform before the isolate gets initialized,
3120
+ // so that the isolate can access the platform during initialization.
3121
+ v8_platform.Platform ()->RegisterIsolate (isolate, event_loop);
3122
+ Isolate::Initialize (isolate, params);
3123
+
3119
3124
isolate->AddMessageListener (OnMessage);
3120
3125
isolate->SetAbortOnUncaughtExceptionCallback (ShouldAbortOnUncaughtException);
3121
3126
isolate->SetMicrotasksPolicy (MicrotasksPolicy::kExplicit );
@@ -3130,7 +3135,7 @@ inline int Start(uv_loop_t* event_loop,
3130
3135
const std::vector<std::string>& exec_args) {
3131
3136
std::unique_ptr<ArrayBufferAllocator, decltype (&FreeArrayBufferAllocator)>
3132
3137
allocator (CreateArrayBufferAllocator (), &FreeArrayBufferAllocator);
3133
- Isolate* const isolate = NewIsolate (allocator.get ());
3138
+ Isolate* const isolate = NewIsolate (allocator.get (), event_loop );
3134
3139
if (isolate == nullptr )
3135
3140
return 12 ; // Signal internal error.
3136
3141
@@ -3168,6 +3173,7 @@ inline int Start(uv_loop_t* event_loop,
3168
3173
}
3169
3174
3170
3175
isolate->Dispose ();
3176
+ v8_platform.Platform ()->UnregisterIsolate (isolate);
3171
3177
3172
3178
return exit_code;
3173
3179
}
0 commit comments