OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/graph-visualizer.h" | 5 #include "src/compiler/graph-visualizer.h" |
6 | 6 |
7 #include <memory> | |
7 #include <sstream> | 8 #include <sstream> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
11 #include "src/compiler/all-nodes.h" | 12 #include "src/compiler/all-nodes.h" |
12 #include "src/compiler/graph.h" | 13 #include "src/compiler/graph.h" |
13 #include "src/compiler/node.h" | 14 #include "src/compiler/node.h" |
14 #include "src/compiler/node-properties.h" | 15 #include "src/compiler/node-properties.h" |
15 #include "src/compiler/opcodes.h" | 16 #include "src/compiler/opcodes.h" |
16 #include "src/compiler/operator.h" | 17 #include "src/compiler/operator.h" |
17 #include "src/compiler/operator-properties.h" | 18 #include "src/compiler/operator-properties.h" |
18 #include "src/compiler/register-allocator.h" | 19 #include "src/compiler/register-allocator.h" |
19 #include "src/compiler/schedule.h" | 20 #include "src/compiler/schedule.h" |
20 #include "src/compiler/scheduler.h" | 21 #include "src/compiler/scheduler.h" |
21 #include "src/interpreter/bytecodes.h" | 22 #include "src/interpreter/bytecodes.h" |
22 #include "src/ostreams.h" | 23 #include "src/ostreams.h" |
23 | 24 |
24 namespace v8 { | 25 namespace v8 { |
25 namespace internal { | 26 namespace internal { |
26 namespace compiler { | 27 namespace compiler { |
27 | 28 |
28 base::SmartArrayPointer<const char> GetVisualizerLogFileName( | 29 std::unique_ptr<const char[]> GetVisualizerLogFileName(CompilationInfo* info, |
29 CompilationInfo* info, const char* phase, const char* suffix) { | 30 const char* phase, |
31 const char* suffix) { | |
30 EmbeddedVector<char, 256> filename(0); | 32 EmbeddedVector<char, 256> filename(0); |
31 base::SmartArrayPointer<char> debug_name = info->GetDebugName(); | 33 std::unique_ptr<char[]> debug_name = info->GetDebugName(); |
32 if (strlen(debug_name.get()) > 0) { | 34 if (strlen(debug_name.get()) > 0) { |
33 SNPrintF(filename, "turbo-%s", debug_name.get()); | 35 SNPrintF(filename, "turbo-%s", debug_name.get()); |
34 } else if (info->has_shared_info()) { | 36 } else if (info->has_shared_info()) { |
35 SNPrintF(filename, "turbo-%p", static_cast<void*>(info)); | 37 SNPrintF(filename, "turbo-%p", static_cast<void*>(info)); |
36 } else { | 38 } else { |
37 SNPrintF(filename, "turbo-none-%s", phase); | 39 SNPrintF(filename, "turbo-none-%s", phase); |
38 } | 40 } |
39 EmbeddedVector<char, 256> source_file(0); | 41 EmbeddedVector<char, 256> source_file(0); |
40 bool source_available = false; | 42 bool source_available = false; |
41 if (FLAG_trace_file_names && info->parse_info()) { | 43 if (FLAG_trace_file_names && info->parse_info()) { |
(...skipping 20 matching lines...) Expand all Loading... | |
62 SNPrintF(full_filename, "%s_%s.%s", filename.start(), source_file.start(), | 64 SNPrintF(full_filename, "%s_%s.%s", filename.start(), source_file.start(), |
63 suffix); | 65 suffix); |
64 } else { | 66 } else { |
65 SNPrintF(full_filename, "%s_%s-%s.%s", filename.start(), | 67 SNPrintF(full_filename, "%s_%s-%s.%s", filename.start(), |
66 source_file.start(), phase, suffix); | 68 source_file.start(), phase, suffix); |
67 } | 69 } |
68 | 70 |
69 char* buffer = new char[full_filename.length() + 1]; | 71 char* buffer = new char[full_filename.length() + 1]; |
70 memcpy(buffer, full_filename.start(), full_filename.length()); | 72 memcpy(buffer, full_filename.start(), full_filename.length()); |
71 buffer[full_filename.length()] = '\0'; | 73 buffer[full_filename.length()] = '\0'; |
72 return base::SmartArrayPointer<const char>(buffer); | 74 return std::unique_ptr<const char[]>(const_cast<const char*>(buffer)); |
Igor Sheludko
2016/07/25 08:56:44
I think const_cast<> is intended to be used to rem
jochen (gone - plz use gerrit)
2016/07/25 09:14:48
done
| |
73 } | 75 } |
74 | 76 |
75 | 77 |
76 static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); } | 78 static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); } |
77 static const char* SafeMnemonic(Node* node) { | 79 static const char* SafeMnemonic(Node* node) { |
78 return node == nullptr ? "null" : node->op()->mnemonic(); | 80 return node == nullptr ? "null" : node->op()->mnemonic(); |
79 } | 81 } |
80 | 82 |
81 #define DEAD_COLOR "#999999" | 83 #define DEAD_COLOR "#999999" |
82 | 84 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 | 323 |
322 | 324 |
323 void GraphC1Visualizer::PrintIntProperty(const char* name, int value) { | 325 void GraphC1Visualizer::PrintIntProperty(const char* name, int value) { |
324 PrintIndent(); | 326 PrintIndent(); |
325 os_ << name << " " << value << "\n"; | 327 os_ << name << " " << value << "\n"; |
326 } | 328 } |
327 | 329 |
328 | 330 |
329 void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) { | 331 void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) { |
330 Tag tag(this, "compilation"); | 332 Tag tag(this, "compilation"); |
331 base::SmartArrayPointer<char> name = info->GetDebugName(); | 333 std::unique_ptr<char[]> name = info->GetDebugName(); |
332 if (info->IsOptimizing()) { | 334 if (info->IsOptimizing()) { |
333 PrintStringProperty("name", name.get()); | 335 PrintStringProperty("name", name.get()); |
334 PrintIndent(); | 336 PrintIndent(); |
335 os_ << "method \"" << name.get() << ":" << info->optimization_id() | 337 os_ << "method \"" << name.get() << ":" << info->optimization_id() |
336 << "\"\n"; | 338 << "\"\n"; |
337 } else { | 339 } else { |
338 PrintStringProperty("name", name.get()); | 340 PrintStringProperty("name", name.get()); |
339 PrintStringProperty("method", "stub"); | 341 PrintStringProperty("method", "stub"); |
340 } | 342 } |
341 PrintLongProperty("date", | 343 PrintLongProperty("date", |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 os << "]"; | 693 os << "]"; |
692 } | 694 } |
693 os << std::endl; | 695 os << std::endl; |
694 } | 696 } |
695 } | 697 } |
696 return os; | 698 return os; |
697 } | 699 } |
698 } // namespace compiler | 700 } // namespace compiler |
699 } // namespace internal | 701 } // namespace internal |
700 } // namespace v8 | 702 } // namespace v8 |
OLD | NEW |