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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 | 1105 |
1106 if (FLAG_trace_turbo) { | 1106 if (FLAG_trace_turbo) { |
1107 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); | 1107 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); |
1108 if (json_file != nullptr) { | 1108 if (json_file != nullptr) { |
1109 OFStream json_of(json_file); | 1109 OFStream json_of(json_file); |
1110 Handle<Script> script = info()->script(); | 1110 Handle<Script> script = info()->script(); |
1111 base::SmartArrayPointer<char> function_name = info()->GetDebugName(); | 1111 base::SmartArrayPointer<char> function_name = info()->GetDebugName(); |
1112 int pos = info()->shared_info()->start_position(); | 1112 int pos = info()->shared_info()->start_position(); |
1113 json_of << "{\"function\":\"" << function_name.get() | 1113 json_of << "{\"function\":\"" << function_name.get() |
1114 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; | 1114 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; |
1115 if (info()->has_literal() && !script->IsUndefined() && | 1115 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
1116 !script->source()->IsUndefined()) { | |
1117 DisallowHeapAllocation no_allocation; | 1116 DisallowHeapAllocation no_allocation; |
1118 FunctionLiteral* function = info()->literal(); | 1117 int start = info()->shared_info()->start_position(); |
1119 int start = function->start_position(); | 1118 int len = info()->shared_info()->end_position() - start; |
1120 int len = function->end_position() - start; | |
1121 String::SubStringRange source(String::cast(script->source()), start, | 1119 String::SubStringRange source(String::cast(script->source()), start, |
1122 len); | 1120 len); |
1123 for (const auto& c : source) { | 1121 for (const auto& c : source) { |
1124 json_of << AsEscapedUC16ForJSON(c); | 1122 json_of << AsEscapedUC16ForJSON(c); |
1125 } | 1123 } |
1126 } | 1124 } |
1127 json_of << "\",\n\"phases\":["; | 1125 json_of << "\",\n\"phases\":["; |
1128 fclose(json_file); | 1126 fclose(json_file); |
1129 } | 1127 } |
1130 } | 1128 } |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 } | 1521 } |
1524 | 1522 |
1525 data->DeleteRegisterAllocationZone(); | 1523 data->DeleteRegisterAllocationZone(); |
1526 } | 1524 } |
1527 | 1525 |
1528 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1526 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
1529 | 1527 |
1530 } // namespace compiler | 1528 } // namespace compiler |
1531 } // namespace internal | 1529 } // namespace internal |
1532 } // namespace v8 | 1530 } // namespace v8 |
OLD | NEW |