Commit 51a289b1 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Fix --trace-trubo to generate complete JSON files.

R=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/1946523002
Cr-Commit-Position: refs/heads/master@{#35975}
parent 98c23129
......@@ -471,12 +471,14 @@ class PipelineRunScope {
PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info,
ZonePool* zone_pool) {
if (!FLAG_turbo_stats) return nullptr;
PipelineStatistics* pipeline_statistics = nullptr;
PipelineStatistics* pipeline_statistics =
new PipelineStatistics(info, zone_pool);
if (FLAG_turbo_stats) {
pipeline_statistics = new PipelineStatistics(info, zone_pool);
pipeline_statistics->BeginPhaseKind("initializing");
}
if (FLAG_trace_turbo) {
FILE* json_file = OpenVisualizerLogFile(info, nullptr, "json", "w+");
if (json_file != nullptr) {
OFStream json_of(json_file);
......@@ -489,7 +491,8 @@ PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info,
DisallowHeapAllocation no_allocation;
int start = info->shared_info()->start_position();
int len = info->shared_info()->end_position() - start;
String::SubStringRange source(String::cast(script->source()), start, len);
String::SubStringRange source(String::cast(script->source()), start,
len);
for (const auto& c : source) {
json_of << AsEscapedUC16ForJSON(c);
}
......@@ -497,6 +500,7 @@ PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info,
json_of << "\",\n\"phases\":[";
fclose(json_file);
}
}
return pipeline_statistics;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment