Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: src/compiler/pipeline.cc

Issue 1946523002: [turbofan] Fix --trace-trubo to generate complete JSON files. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index d7642e82451cc109f6b0b9fe6c41ed7a5b8cfe52..107deac38e1971cfb2d6c4fd5c37fa58ab68a4c0 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -471,31 +471,35 @@ class PipelineRunScope {
PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info,
ZonePool* zone_pool) {
- if (!FLAG_turbo_stats) return nullptr;
-
- PipelineStatistics* pipeline_statistics =
- new PipelineStatistics(info, zone_pool);
- pipeline_statistics->BeginPhaseKind("initializing");
-
- FILE* json_file = OpenVisualizerLogFile(info, nullptr, "json", "w+");
- if (json_file != nullptr) {
- OFStream json_of(json_file);
- Handle<Script> script = info->script();
- base::SmartArrayPointer<char> function_name = info->GetDebugName();
- int pos = info->shared_info()->start_position();
- json_of << "{\"function\":\"" << function_name.get()
- << "\", \"sourcePosition\":" << pos << ", \"source\":\"";
- if (!script->IsUndefined() && !script->source()->IsUndefined()) {
- 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);
- for (const auto& c : source) {
- json_of << AsEscapedUC16ForJSON(c);
+ PipelineStatistics* pipeline_statistics = nullptr;
+
+ 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);
+ Handle<Script> script = info->script();
+ base::SmartArrayPointer<char> function_name = info->GetDebugName();
+ int pos = info->shared_info()->start_position();
+ json_of << "{\"function\":\"" << function_name.get()
+ << "\", \"sourcePosition\":" << pos << ", \"source\":\"";
+ if (!script->IsUndefined() && !script->source()->IsUndefined()) {
+ 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);
+ for (const auto& c : source) {
+ json_of << AsEscapedUC16ForJSON(c);
+ }
}
+ json_of << "\",\n\"phases\":[";
+ fclose(json_file);
}
- json_of << "\",\n\"phases\":[";
- fclose(json_file);
}
return pipeline_statistics;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698