Skip to content

Commit

Permalink
[cpu-profiler] Separate the flags for generating extra line information
Browse files Browse the repository at this point in the history
NeedsSourcePositionsForProfiling is used to control the generation of
the line end table during parsing (see ParseInfo::CreateScript). This
is costly both for memory and performance. Turning on detailed_line_info
by default caused regressions because we always generate the line end
table.

This CL splits the two conditions apart as they aren't related.

Bug: chromium:875677
Change-Id: I71006db586e504b4cf9232081ba249f5647f5b76
Reviewed-on: https://chromium-review.googlesource.com/1181041
Reviewed-by: Tobias Tebbi <[email protected]>
Commit-Queue: Peter Marshall <[email protected]>
Cr-Commit-Position: refs/heads/master@{#55222}
  • Loading branch information
psmarshall authored and Commit Bot committed Aug 20, 2018
1 parent 60408d9 commit 30ff671
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3248,11 +3248,14 @@ bool Isolate::use_optimizer() {
!is_precise_count_code_coverage() && !is_block_count_code_coverage();
}

bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const {
return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info;
}

bool Isolate::NeedsSourcePositionsForProfiling() const {
return FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph ||
FLAG_turbo_profiling || FLAG_perf_prof || is_profiling() ||
debug_->is_active() || logger_->is_logging() || FLAG_trace_maps ||
FLAG_detailed_line_info;
debug_->is_active() || logger_->is_logging() || FLAG_trace_maps;
}

void Isolate::SetFeedbackVectorsForProfilingTools(Object* value) {
Expand Down
2 changes: 2 additions & 0 deletions src/isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,8 @@ class Isolate : private HiddenFactory {

bool NeedsSourcePositionsForProfiling() const;

bool NeedsDetailedOptimizedCodeLineInfo() const;

bool is_best_effort_code_coverage() const {
return code_coverage_mode() == debug::Coverage::kBestEffort;
}
Expand Down
2 changes: 1 addition & 1 deletion src/optimized-compilation-info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OptimizedCompilationInfo::OptimizedCompilationInfo(
// Collect source positions for optimized code when profiling or if debugger
// is active, to be able to get more precise source positions at the price of
// more memory consumption.
if (isolate->NeedsSourcePositionsForProfiling()) {
if (isolate->NeedsDetailedOptimizedCodeLineInfo()) {
MarkAsSourcePositionsEnabled();
}

Expand Down

0 comments on commit 30ff671

Please sign in to comment.