src: start heap object tracking after platform is initialized

Garbage collection is triggered by the heap object tracker. The garbage
collector may spawn garbage collection tasks on the foreground thread.
This is only allowed after registering the isolate in the platform
which happens in IsolateData. This CL moves the starting of the heap
object tracker after calling IsolateData to ensure that.

PR-URL: https://github.com/nodejs/node/pull/17249
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
This commit is contained in:
Hannes Payer 2017-11-22 14:43:42 +01:00 коммит произвёл Anna Henningsen
Родитель 16e87eddd6
Коммит 91d131210c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9C63F3A6CD2AD8F9
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -4524,10 +4524,6 @@ inline int Start(uv_loop_t* event_loop,
isolate->SetAutorunMicrotasks(false);
isolate->SetFatalErrorHandler(OnFatalError);
if (track_heap_objects) {
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
}
{
Mutex::ScopedLock scoped_lock(node_isolate_mutex);
CHECK_EQ(node_isolate, nullptr);
@ -4544,6 +4540,9 @@ inline int Start(uv_loop_t* event_loop,
event_loop,
v8_platform.Platform(),
allocator.zero_fill_field());
if (track_heap_objects) {
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
}
exit_code = Start(isolate, &isolate_data, argc, argv, exec_argc, exec_argv);
}