deps: backport 525b396195 from upstream V8

Original commit message:

  [cpu-profiler] Fix a leak caused by re-logging existing functions.

  Don't re-log all existing functions during StartProcessorIfNotStarted().
  They will already be in the CodeMap attached to the ProfileGenerator and
  re-logging them causes leaks. See the linked bug for more details.

  Bug: v8:8253
  Change-Id: Ibb1a1ab2431c588e8c3a3a9ff714767cdf61a88e
  Reviewed-on: https://chromium-review.googlesource.com/1256763
  Commit-Queue: Peter Marshall <petermarshall@chromium.org>
  Reviewed-by: Yang Guo <yangguo@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#56336}

PR-URL: https://github.com/nodejs/node/pull/23827
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
Peter Marshall authored and Myles Borins committed 2018-11-29 11:39:01 -05:00
1 parent ff57f0fb7e
commit c8304f6567
2 files changed
+11 -6

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.37',
'v8_embedder_string': '-node.38',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
+10 -5
View File
@@ -368,8 +368,11 @@ void CpuProfiler::StartProcessorIfNotStarted() {
// Disable logging when using the new implementation.
saved_is_logging_ = logger->is_logging_;
logger->is_logging_ = false;
bool codemap_needs_initialization = false;
if (!generator_) {
generator_.reset(new ProfileGenerator(profiles_.get()));
codemap_needs_initialization = true;
CreateEntriesForRuntimeCallStats();
}
processor_.reset(new ProfilerEventsProcessor(isolate_, generator_.get(),
@@ -382,12 +385,14 @@ void CpuProfiler::StartProcessorIfNotStarted() {
isolate_->set_is_profiling(true);
// Enumerate stuff we already have in the heap.
DCHECK(isolate_->heap()->HasBeenSetUp());
if (!FLAG_prof_browser_mode) {
logger->LogCodeObjects();
if (codemap_needs_initialization) {
if (!FLAG_prof_browser_mode) {
logger->LogCodeObjects();
}
logger->LogCompiledFunctions();
logger->LogAccessorCallbacks();
LogBuiltins();
}
logger->LogCompiledFunctions();
logger->LogAccessorCallbacks();
LogBuiltins();
// Enable stack sampling.
processor_->AddCurrentStack(isolate_);
processor_->StartSynchronously();