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

Unified Diff: src/compiler/pipeline.cc

Issue 637313002: [turbofan] Output file for C1 visualizer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tweak Created 6 years, 2 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
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 7da2fb543c9d32c77bad75e558ac262d942b20ce..71af5b85471ea45ce33cec0ddf8a53c57a918111 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -90,13 +90,21 @@ static inline bool VerifyGraphs() {
}
+void Pipeline::PrintCompilationStart() {
+ FILE* turbo_cfg_file = base::OS::FOpen("turbo.cfg", "a+");
Benedikt Meurer 2014/10/13 04:02:12 Please use std::ofstream here.
Jarin 2014/10/13 07:35:53 Done.
+ OFStream turbo_cfg_of(turbo_cfg_file);
+ turbo_cfg_of << AsC1VCompilation(info());
+ fclose(turbo_cfg_file);
+}
+
+
void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) {
if (FLAG_trace_turbo) {
char buffer[256];
Vector<char> filename(buffer, sizeof(buffer));
+ SmartArrayPointer<char> functionname;
if (!info_->shared_info().is_null()) {
- SmartArrayPointer<char> functionname =
- info_->shared_info()->DebugName()->ToCString();
+ functionname = info_->shared_info()->DebugName()->ToCString();
if (strlen(functionname.get()) > 0) {
SNPrintF(filename, "turbo-%s-%s", functionname.get(), phase);
} else {
@@ -132,6 +140,25 @@ void Pipeline::VerifyAndPrintGraph(Graph* graph, const char* phase) {
}
+void Pipeline::PrintScheduleAndInstructions(
+ const char* phase, const Schedule* schedule,
+ const InstructionSequence* instructions) {
+ FILE* turbo_cfg_file = base::OS::FOpen("turbo.cfg", "a+");
Benedikt Meurer 2014/10/13 04:02:12 Please use std::ofstream here.
Jarin 2014/10/13 07:35:52 Done.
+ OFStream turbo_cfg_of(turbo_cfg_file);
+ turbo_cfg_of << AsC1V(phase, schedule, instructions);
+ fclose(turbo_cfg_file);
+}
+
+
+void Pipeline::PrintAllocator(const char* phase,
+ const RegisterAllocator* allocator) {
+ FILE* turbo_cfg_file = base::OS::FOpen("turbo.cfg", "a+");
Benedikt Meurer 2014/10/13 04:02:12 Please use std::ofstream here.
Jarin 2014/10/13 07:35:53 Done.
+ OFStream turbo_cfg_of(turbo_cfg_file);
+ turbo_cfg_of << AsC1VAllocator(phase, allocator);
+ fclose(turbo_cfg_file);
+}
+
+
class AstGraphBuilderWithPositions : public AstGraphBuilder {
public:
explicit AstGraphBuilderWithPositions(CompilationInfo* info, JSGraph* jsgraph,
@@ -188,6 +215,7 @@ Handle<Code> Pipeline::GenerateCode() {
<< "Begin compiling method "
<< info()->function()->debug_name()->ToCString().get()
<< " using Turbofan" << std::endl;
+ PrintCompilationStart();
}
// Build the graph.
@@ -405,6 +433,7 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
OFStream os(stdout);
os << "----- Instruction sequence before register allocation -----\n"
<< sequence;
+ PrintScheduleAndInstructions("CodeGen", schedule, &sequence);
}
// Allocate registers.
@@ -419,6 +448,9 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
linkage->info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc);
return Handle<Code>::null();
}
+ if (FLAG_trace_turbo) {
+ PrintAllocator("CodeGen", &allocator);
+ }
}
if (FLAG_trace_turbo) {
« no previous file with comments | « src/compiler/pipeline.h ('k') | src/compiler/schedule.h » ('j') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698