Skip to content

Commit

Permalink
deps: cherry-pick 525b396 from V8 upstream
Browse files Browse the repository at this point in the history
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}

Refs: v8/v8@525b396

PR-URL: #25041
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
psmarshall authored and rvagg committed Feb 28, 2019
1 parent 045868d commit a1aff28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 6
#define V8_MINOR_VERSION 2
#define V8_BUILD_NUMBER 414
#define V8_PATCH_LEVEL 75
#define V8_PATCH_LEVEL 76

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
15 changes: 10 additions & 5 deletions deps/v8/src/profiler/cpu-profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,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(),
Expand All @@ -341,12 +344,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();
Expand Down

0 comments on commit a1aff28

Please sign in to comment.