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

Side by Side Diff: src/compiler/pipeline.cc

Issue 727693002: [turbofan] small cleanups to aid register allocator debugging (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/compiler/register-allocator.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/pipeline.h" 5 #include "src/compiler/pipeline.h"
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 JSOperatorBuilder* javascript() const { return javascript_; } 103 JSOperatorBuilder* javascript() const { return javascript_; }
104 JSGraph* jsgraph() const { return jsgraph_; } 104 JSGraph* jsgraph() const { return jsgraph_; }
105 Typer* typer() const { return typer_.get(); } 105 Typer* typer() const { return typer_.get(); }
106 Schedule* schedule() const { return schedule_; } 106 Schedule* schedule() const { return schedule_; }
107 void set_schedule(Schedule* schedule) { 107 void set_schedule(Schedule* schedule) {
108 DCHECK_EQ(NULL, schedule_); 108 DCHECK_EQ(NULL, schedule_);
109 schedule_ = schedule; 109 schedule_ = schedule;
110 } 110 }
111 111
112 Zone* instruction_zone() const { return instruction_zone_; } 112 Zone* instruction_zone() const { return instruction_zone_; }
113 // RawMachineAssembler generally produces graphs which cannot be verified.
114 bool MayHaveUnverifiableGraph() { return outer_zone_ == nullptr; }
Benedikt Meurer 2014/11/14 08:56:02 Nit: const
113 115
114 void DeleteGraphZone() { 116 void DeleteGraphZone() {
115 // Destroy objects with destructors first. 117 // Destroy objects with destructors first.
116 source_positions_.Reset(NULL); 118 source_positions_.Reset(NULL);
117 typer_.Reset(NULL); 119 typer_.Reset(NULL);
118 if (graph_zone_ == NULL) return; 120 if (graph_zone_ == NULL) return;
119 // Destroy zone and clear pointers. 121 // Destroy zone and clear pointers.
120 graph_zone_scope_.Destroy(); 122 graph_zone_scope_.Destroy();
121 graph_zone_ = NULL; 123 graph_zone_ = NULL;
122 graph_ = NULL; 124 graph_ = NULL;
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 // Select and schedule instructions covering the scheduled graph. 554 // Select and schedule instructions covering the scheduled graph.
553 { 555 {
554 PhaseScope phase_scope(data->pipeline_statistics(), "select instructions"); 556 PhaseScope phase_scope(data->pipeline_statistics(), "select instructions");
555 ZonePool::Scope zone_scope(data->zone_pool()); 557 ZonePool::Scope zone_scope(data->zone_pool());
556 InstructionSelector selector(zone_scope.zone(), data->graph(), linkage, 558 InstructionSelector selector(zone_scope.zone(), data->graph(), linkage,
557 &sequence, data->schedule(), 559 &sequence, data->schedule(),
558 data->source_positions()); 560 data->source_positions());
559 selector.SelectInstructions(); 561 selector.SelectInstructions();
560 } 562 }
561 563
562 if (FLAG_trace_turbo) { 564 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) {
563 OFStream os(stdout);
564 PrintableInstructionSequence printable = {
565 RegisterConfiguration::ArchDefault(), &sequence};
566 os << "----- Instruction sequence before register allocation -----\n"
567 << printable;
568 TurboCfgFile tcf(isolate()); 565 TurboCfgFile tcf(isolate());
569 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(), 566 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(),
570 &sequence); 567 &sequence);
571 } 568 }
572 569
573 data->DeleteGraphZone(); 570 data->DeleteGraphZone();
574 571
575 if (data->pipeline_statistics() != NULL) { 572 if (data->pipeline_statistics() != NULL) {
576 data->pipeline_statistics()->BeginPhaseKind("register allocation"); 573 data->pipeline_statistics()->BeginPhaseKind("register allocation");
577 } 574 }
(...skipping 20 matching lines...) Expand all
598 debug_name = GetDebugName(info()); 595 debug_name = GetDebugName(info());
599 #endif 596 #endif
600 597
601 RegisterAllocator allocator(RegisterConfiguration::ArchDefault(), 598 RegisterAllocator allocator(RegisterConfiguration::ArchDefault(),
602 zone_scope.zone(), &frame, &sequence, 599 zone_scope.zone(), &frame, &sequence,
603 debug_name.get()); 600 debug_name.get());
604 if (!allocator.Allocate(data->pipeline_statistics())) { 601 if (!allocator.Allocate(data->pipeline_statistics())) {
605 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); 602 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc);
606 return Handle<Code>::null(); 603 return Handle<Code>::null();
607 } 604 }
608 if (FLAG_trace_turbo) { 605 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) {
609 TurboCfgFile tcf(isolate()); 606 TurboCfgFile tcf(isolate());
610 tcf << AsC1VAllocator("CodeGen", &allocator); 607 tcf << AsC1VAllocator("CodeGen", &allocator);
611 } 608 }
612 } 609 }
613 610
614 if (FLAG_trace_turbo) { 611 if (FLAG_trace_turbo) {
615 OFStream os(stdout); 612 OFStream os(stdout);
616 PrintableInstructionSequence printable = { 613 PrintableInstructionSequence printable = {
617 RegisterConfiguration::ArchDefault(), &sequence}; 614 RegisterConfiguration::ArchDefault(), &sequence};
618 os << "----- Instruction sequence after register allocation -----\n" 615 os << "----- Instruction sequence after register allocation -----\n"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 } 648 }
652 649
653 650
654 void Pipeline::TearDown() { 651 void Pipeline::TearDown() {
655 InstructionOperand::TearDownCaches(); 652 InstructionOperand::TearDownCaches();
656 } 653 }
657 654
658 } // namespace compiler 655 } // namespace compiler
659 } // namespace internal 656 } // namespace internal
660 } // namespace v8 657 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/register-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698