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

Unified Diff: src/compiler/graph-visualizer.cc

Issue 886313006: [turbofan]: Small visualizer cleanup and fix for string handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/graph-visualizer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-visualizer.cc
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc
index 20ebabe2c081a1ef6f82c35841e33f52bc02115d..abdd1c9210af029455a1c9936794f5470f9524c5 100644
--- a/src/compiler/graph-visualizer.cc
+++ b/src/compiler/graph-visualizer.cc
@@ -24,6 +24,34 @@ namespace v8 {
namespace internal {
namespace compiler {
+
+FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
+ const char* suffix, const char* mode) {
+ EmbeddedVector<char, 256> filename;
+ SmartArrayPointer<char> function_name;
+ if (!info->shared_info().is_null()) {
+ function_name = info->shared_info()->DebugName()->ToCString();
+ if (strlen(function_name.get()) > 0) {
+ SNPrintF(filename, "turbo-%s", function_name.get());
+ } else {
+ SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
+ }
+ } else {
+ SNPrintF(filename, "turbo-none-%s", phase);
+ }
+ std::replace(filename.start(), filename.start() + filename.length(), ' ',
+ '_');
+
+ EmbeddedVector<char, 256> full_filename;
+ if (phase == NULL) {
+ SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
+ } else {
+ SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
+ }
+ return base::OS::FOpen(full_filename.start(), mode);
+}
+
+
static int SafeId(Node* node) { return node == NULL ? -1 : node->id(); }
static const char* SafeMnemonic(Node* node) {
return node == NULL ? "null" : node->op()->mnemonic();
« no previous file with comments | « src/compiler/graph-visualizer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698