OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/adapters.h" | 10 #include "src/base/adapters.h" |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 if (FLAG_turbo_stats) { | 1071 if (FLAG_turbo_stats) { |
1072 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); | 1072 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); |
1073 pipeline_statistics->BeginPhaseKind("initializing"); | 1073 pipeline_statistics->BeginPhaseKind("initializing"); |
1074 } | 1074 } |
1075 | 1075 |
1076 if (FLAG_trace_turbo) { | 1076 if (FLAG_trace_turbo) { |
1077 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); | 1077 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); |
1078 if (json_file != nullptr) { | 1078 if (json_file != nullptr) { |
1079 OFStream json_of(json_file); | 1079 OFStream json_of(json_file); |
1080 Handle<Script> script = info()->script(); | 1080 Handle<Script> script = info()->script(); |
1081 FunctionLiteral* function = info()->literal(); | |
1082 base::SmartArrayPointer<char> function_name = info()->GetDebugName(); | 1081 base::SmartArrayPointer<char> function_name = info()->GetDebugName(); |
1083 int pos = info()->shared_info()->start_position(); | 1082 int pos = info()->shared_info()->start_position(); |
1084 json_of << "{\"function\":\"" << function_name.get() | 1083 json_of << "{\"function\":\"" << function_name.get() |
1085 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; | 1084 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; |
1086 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 1085 if (info()->has_literal() && !script->IsUndefined() && |
| 1086 !script->source()->IsUndefined()) { |
1087 DisallowHeapAllocation no_allocation; | 1087 DisallowHeapAllocation no_allocation; |
| 1088 FunctionLiteral* function = info()->literal(); |
1088 int start = function->start_position(); | 1089 int start = function->start_position(); |
1089 int len = function->end_position() - start; | 1090 int len = function->end_position() - start; |
1090 String::SubStringRange source(String::cast(script->source()), start, | 1091 String::SubStringRange source(String::cast(script->source()), start, |
1091 len); | 1092 len); |
1092 for (const auto& c : source) { | 1093 for (const auto& c : source) { |
1093 json_of << AsEscapedUC16ForJSON(c); | 1094 json_of << AsEscapedUC16ForJSON(c); |
1094 } | 1095 } |
1095 } | 1096 } |
1096 json_of << "\",\n\"phases\":["; | 1097 json_of << "\",\n\"phases\":["; |
1097 fclose(json_file); | 1098 fclose(json_file); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 tcf << AsC1VRegisterAllocationData("CodeGen", | 1493 tcf << AsC1VRegisterAllocationData("CodeGen", |
1493 data->register_allocation_data()); | 1494 data->register_allocation_data()); |
1494 } | 1495 } |
1495 | 1496 |
1496 data->DeleteRegisterAllocationZone(); | 1497 data->DeleteRegisterAllocationZone(); |
1497 } | 1498 } |
1498 | 1499 |
1499 } // namespace compiler | 1500 } // namespace compiler |
1500 } // namespace internal | 1501 } // namespace internal |
1501 } // namespace v8 | 1502 } // namespace v8 |
OLD | NEW |