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

Side by Side Diff: src/compiler/graph-visualizer.cc

Issue 2083863004: Include file names in trace_turbo output (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove : from filenames Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 18 matching lines...) Expand all
29 CompilationInfo* info, const char* phase, const char* suffix) { 29 CompilationInfo* info, const char* phase, const char* suffix) {
30 EmbeddedVector<char, 256> filename(0); 30 EmbeddedVector<char, 256> filename(0);
31 base::SmartArrayPointer<char> debug_name = info->GetDebugName(); 31 base::SmartArrayPointer<char> debug_name = info->GetDebugName();
32 if (strlen(debug_name.get()) > 0) { 32 if (strlen(debug_name.get()) > 0) {
33 SNPrintF(filename, "turbo-%s", debug_name.get()); 33 SNPrintF(filename, "turbo-%s", debug_name.get());
34 } else if (info->has_shared_info()) { 34 } else if (info->has_shared_info()) {
35 SNPrintF(filename, "turbo-%p", static_cast<void*>(info)); 35 SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
36 } else { 36 } else {
37 SNPrintF(filename, "turbo-none-%s", phase); 37 SNPrintF(filename, "turbo-none-%s", phase);
38 } 38 }
39 char* source_file = nullptr;
40 if (FLAG_trace_file_names && info->parse_info()) {
41 Object* source_name = info->script()->name();
42 if (source_name->IsString()) {
43 String* str = String::cast(source_name);
44 if (str->length() > 0) {
45 source_file = str->ToCString().get();
46 }
47 }
48 }
39 std::replace(filename.start(), filename.start() + filename.length(), ' ', 49 std::replace(filename.start(), filename.start() + filename.length(), ' ',
40 '_'); 50 '_');
41 51
42 EmbeddedVector<char, 256> full_filename; 52 EmbeddedVector<char, 256> full_filename;
43 if (phase == nullptr) { 53 if (phase == nullptr && source_file == nullptr) {
44 SNPrintF(full_filename, "%s.%s", filename.start(), suffix); 54 SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
55 } else if (phase != nullptr && source_file == nullptr) {
56 SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
57 } else if (phase == nullptr && source_file != nullptr) {
58 SNPrintF(full_filename, "%s_%s.%s", filename.start(), source_file, suffix);
45 } else { 59 } else {
46 SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix); 60 SNPrintF(full_filename, "%s_%s-%s.%s", filename.start(), source_file, phase,
61 suffix);
47 } 62 }
63 std::replace(full_filename.start(),
64 full_filename.start() + full_filename.length(), '/', '_');
48 65
49 char* buffer = new char[full_filename.length() + 1]; 66 char* buffer = new char[full_filename.length() + 1];
50 memcpy(buffer, full_filename.start(), full_filename.length()); 67 memcpy(buffer, full_filename.start(), full_filename.length());
51 buffer[full_filename.length()] = '\0'; 68 buffer[full_filename.length()] = '\0';
52 return base::SmartArrayPointer<const char>(buffer); 69 return base::SmartArrayPointer<const char>(buffer);
53 } 70 }
54 71
55 72
56 static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); } 73 static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); }
57 static const char* SafeMnemonic(Node* node) { 74 static const char* SafeMnemonic(Node* node) {
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 os << "]"; 683 os << "]";
667 } 684 }
668 os << std::endl; 685 os << std::endl;
669 } 686 }
670 } 687 }
671 return os; 688 return os;
672 } 689 }
673 } // namespace compiler 690 } // namespace compiler
674 } // namespace internal 691 } // namespace internal
675 } // namespace v8 692 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698