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 <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
11 #include "src/compiler/all-nodes.h" | 11 #include "src/compiler/all-nodes.h" |
12 #include "src/compiler/graph.h" | 12 #include "src/compiler/graph.h" |
13 #include "src/compiler/node.h" | 13 #include "src/compiler/node.h" |
14 #include "src/compiler/node-properties.h" | 14 #include "src/compiler/node-properties.h" |
15 #include "src/compiler/opcodes.h" | 15 #include "src/compiler/opcodes.h" |
16 #include "src/compiler/operator.h" | 16 #include "src/compiler/operator.h" |
17 #include "src/compiler/operator-properties.h" | 17 #include "src/compiler/operator-properties.h" |
18 #include "src/compiler/register-allocator.h" | 18 #include "src/compiler/register-allocator.h" |
19 #include "src/compiler/schedule.h" | 19 #include "src/compiler/schedule.h" |
20 #include "src/compiler/scheduler.h" | 20 #include "src/compiler/scheduler.h" |
| 21 #include "src/interpreter/bytecodes.h" |
21 #include "src/ostreams.h" | 22 #include "src/ostreams.h" |
22 | 23 |
23 namespace v8 { | 24 namespace v8 { |
24 namespace internal { | 25 namespace internal { |
25 namespace compiler { | 26 namespace compiler { |
26 | 27 |
27 | 28 |
28 FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase, | 29 FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase, |
29 const char* suffix, const char* mode) { | 30 const char* suffix, const char* mode) { |
30 EmbeddedVector<char, 256> filename(0); | 31 EmbeddedVector<char, 256> filename(0); |
31 base::SmartArrayPointer<char> function_name; | 32 base::SmartArrayPointer<char> debug_name = info->GetDebugName(); |
32 if (info->has_shared_info()) { | 33 if (strlen(debug_name.get()) > 0) { |
33 function_name = info->shared_info()->DebugName()->ToCString(); | 34 SNPrintF(filename, "turbo-%s", debug_name.get()); |
34 if (strlen(function_name.get()) > 0) { | 35 } else if (info->has_shared_info()) { |
35 SNPrintF(filename, "turbo-%s", function_name.get()); | 36 SNPrintF(filename, "turbo-%p", static_cast<void*>(info)); |
36 } else { | |
37 SNPrintF(filename, "turbo-%p", static_cast<void*>(info)); | |
38 } | |
39 } else { | 37 } else { |
40 SNPrintF(filename, "turbo-none-%s", phase); | 38 SNPrintF(filename, "turbo-none-%s", phase); |
41 } | 39 } |
42 std::replace(filename.start(), filename.start() + filename.length(), ' ', | 40 std::replace(filename.start(), filename.start() + filename.length(), ' ', |
43 '_'); | 41 '_'); |
44 | 42 |
45 EmbeddedVector<char, 256> full_filename; | 43 EmbeddedVector<char, 256> full_filename; |
46 if (phase == NULL) { | 44 if (phase == NULL) { |
47 SNPrintF(full_filename, "%s.%s", filename.start(), suffix); | 45 SNPrintF(full_filename, "%s.%s", filename.start(), suffix); |
48 } else { | 46 } else { |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 482 |
485 | 483 |
486 void GraphC1Visualizer::PrintIntProperty(const char* name, int value) { | 484 void GraphC1Visualizer::PrintIntProperty(const char* name, int value) { |
487 PrintIndent(); | 485 PrintIndent(); |
488 os_ << name << " " << value << "\n"; | 486 os_ << name << " " << value << "\n"; |
489 } | 487 } |
490 | 488 |
491 | 489 |
492 void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) { | 490 void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) { |
493 Tag tag(this, "compilation"); | 491 Tag tag(this, "compilation"); |
| 492 base::SmartArrayPointer<char> name = info->GetDebugName(); |
494 if (info->IsOptimizing()) { | 493 if (info->IsOptimizing()) { |
495 Handle<String> name = info->literal()->debug_name(); | 494 PrintStringProperty("name", name.get()); |
496 PrintStringProperty("name", name->ToCString().get()); | |
497 PrintIndent(); | 495 PrintIndent(); |
498 os_ << "method \"" << name->ToCString().get() << ":" | 496 os_ << "method \"" << name.get() << ":" << info->optimization_id() |
499 << info->optimization_id() << "\"\n"; | 497 << "\"\n"; |
500 } else { | 498 } else { |
501 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 499 PrintStringProperty("name", name.get()); |
502 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); | |
503 PrintStringProperty("method", "stub"); | 500 PrintStringProperty("method", "stub"); |
504 } | 501 } |
505 PrintLongProperty("date", | 502 PrintLongProperty("date", |
506 static_cast<int64_t>(base::OS::TimeCurrentMillis())); | 503 static_cast<int64_t>(base::OS::TimeCurrentMillis())); |
507 } | 504 } |
508 | 505 |
509 | 506 |
510 void GraphC1Visualizer::PrintNodeId(Node* n) { os_ << "n" << SafeId(n); } | 507 void GraphC1Visualizer::PrintNodeId(Node* n) { os_ << "n" << SafeId(n); } |
511 | 508 |
512 | 509 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 819 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
823 } | 820 } |
824 os << ")" << std::endl; | 821 os << ")" << std::endl; |
825 } | 822 } |
826 } | 823 } |
827 return os; | 824 return os; |
828 } | 825 } |
829 } // namespace compiler | 826 } // namespace compiler |
830 } // namespace internal | 827 } // namespace internal |
831 } // namespace v8 | 828 } // namespace v8 |
OLD | NEW |