summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHannes Payer <hpayer@chromium.org>2017-11-22 14:43:42 +0100
committerAnna Henningsen <anna@addaleax.net>2017-11-28 02:48:52 +0100
commit91d131210c2d7887d8625d34c1008a3d423cf86b (patch)
treeece01439c3d8edbbd3c32c839c174660f45a43a0 /src
parent16e87eddd69c3d319e027b46952e5e3cc9b54541 (diff)
downloadandroid-node-v8-91d131210c2d7887d8625d34c1008a3d423cf86b.tar.gz
android-node-v8-91d131210c2d7887d8625d34c1008a3d423cf86b.tar.bz2
android-node-v8-91d131210c2d7887d8625d34c1008a3d423cf86b.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/node.cc b/src/node.cc
index 57c1a4cc8a..603e1ddc25 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -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);
}