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

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

Issue 798873008: [turbofan] add flag for register allocation verification (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 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 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ZonePool::Scope instruction_zone_scope_; 240 ZonePool::Scope instruction_zone_scope_;
241 Zone* instruction_zone_; 241 Zone* instruction_zone_;
242 InstructionSequence* sequence_; 242 InstructionSequence* sequence_;
243 Frame* frame_; 243 Frame* frame_;
244 RegisterAllocator* register_allocator_; 244 RegisterAllocator* register_allocator_;
245 245
246 DISALLOW_COPY_AND_ASSIGN(PipelineData); 246 DISALLOW_COPY_AND_ASSIGN(PipelineData);
247 }; 247 };
248 248
249 249
250 static inline bool VerifyGraphs() {
251 #ifdef DEBUG
252 return true;
253 #else
254 return FLAG_turbo_verify;
255 #endif
256 }
257
258
259 struct TurboCfgFile : public std::ofstream { 250 struct TurboCfgFile : public std::ofstream {
260 explicit TurboCfgFile(Isolate* isolate) 251 explicit TurboCfgFile(Isolate* isolate)
261 : std::ofstream(isolate->GetTurboCfgFileName().c_str(), 252 : std::ofstream(isolate->GetTurboCfgFileName().c_str(),
262 std::ios_base::app) {} 253 std::ios_base::app) {}
263 }; 254 };
264 255
265 256
266 static void TraceSchedule(Schedule* schedule) { 257 static void TraceSchedule(Schedule* schedule) {
267 if (!FLAG_trace_turbo_graph && !FLAG_trace_turbo_scheduler) return; 258 if (!FLAG_trace_turbo_graph && !FLAG_trace_turbo_scheduler) return;
268 OFStream os(stdout); 259 OFStream os(stdout);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 518 }
528 }; 519 };
529 520
530 521
531 struct ComputeSchedulePhase { 522 struct ComputeSchedulePhase {
532 static const char* phase_name() { return "scheduling"; } 523 static const char* phase_name() { return "scheduling"; }
533 524
534 void Run(PipelineData* data, Zone* temp_zone) { 525 void Run(PipelineData* data, Zone* temp_zone) {
535 Schedule* schedule = Scheduler::ComputeSchedule(temp_zone, data->graph()); 526 Schedule* schedule = Scheduler::ComputeSchedule(temp_zone, data->graph());
536 TraceSchedule(schedule); 527 TraceSchedule(schedule);
537 if (VerifyGraphs()) ScheduleVerifier::Run(schedule); 528 if (FLAG_turbo_verify) ScheduleVerifier::Run(schedule);
538 data->set_schedule(schedule); 529 data->set_schedule(schedule);
539 } 530 }
540 }; 531 };
541 532
542 533
543 struct InstructionSelectionPhase { 534 struct InstructionSelectionPhase {
544 static const char* phase_name() { return "select instructions"; } 535 static const char* phase_name() { return "select instructions"; }
545 536
546 void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) { 537 void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) {
547 InstructionSelector selector(temp_zone, data->graph()->NodeCount(), linkage, 538 InstructionSelector selector(temp_zone, data->graph()->NodeCount(), linkage,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 if (data_->pipeline_statistics() != NULL) { 737 if (data_->pipeline_statistics() != NULL) {
747 data_->pipeline_statistics()->BeginPhaseKind(phase_kind_name); 738 data_->pipeline_statistics()->BeginPhaseKind(phase_kind_name);
748 } 739 }
749 } 740 }
750 741
751 742
752 void Pipeline::RunPrintAndVerify(const char* phase, bool untyped) { 743 void Pipeline::RunPrintAndVerify(const char* phase, bool untyped) {
753 if (FLAG_trace_turbo) { 744 if (FLAG_trace_turbo) {
754 Run<PrintGraphPhase>(phase); 745 Run<PrintGraphPhase>(phase);
755 } 746 }
756 if (VerifyGraphs()) { 747 if (FLAG_turbo_verify) {
757 Run<VerifyGraphPhase>(untyped); 748 Run<VerifyGraphPhase>(untyped);
758 } 749 }
759 } 750 }
760 751
761 752
762 Handle<Code> Pipeline::GenerateCode() { 753 Handle<Code> Pipeline::GenerateCode() {
763 // This list must be kept in sync with DisableTurbofan in ast-numbering.cc. 754 // This list must be kept in sync with DisableTurbofan in ast-numbering.cc.
764 if (info()->function()->dont_optimize_reason() == kTryCatchStatement || 755 if (info()->function()->dont_optimize_reason() == kTryCatchStatement ||
765 info()->function()->dont_optimize_reason() == kTryFinallyStatement || 756 info()->function()->dont_optimize_reason() == kTryFinallyStatement ||
766 // TODO(turbofan): Make super work and remove this bailout. 757 // TODO(turbofan): Make super work and remove this bailout.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { 974 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) {
984 TurboCfgFile tcf(isolate()); 975 TurboCfgFile tcf(isolate());
985 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(), 976 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(),
986 data->sequence()); 977 data->sequence());
987 } 978 }
988 979
989 data->DeleteGraphZone(); 980 data->DeleteGraphZone();
990 981
991 BeginPhaseKind("register allocation"); 982 BeginPhaseKind("register allocation");
992 983
993 bool run_verifier = false; 984 bool run_verifier = FLAG_turbo_verify_allocation;
994 #ifdef DEBUG
995 run_verifier = true;
996 #endif
997 // Allocate registers. 985 // Allocate registers.
998 AllocateRegisters(RegisterConfiguration::ArchDefault(), run_verifier); 986 AllocateRegisters(RegisterConfiguration::ArchDefault(), run_verifier);
999 if (data->compilation_failed()) { 987 if (data->compilation_failed()) {
1000 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); 988 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc);
1001 return; 989 return;
1002 } 990 }
1003 991
1004 BeginPhaseKind("code generation"); 992 BeginPhaseKind("code generation");
1005 993
1006 // Optimimize jumps. 994 // Optimimize jumps.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1083 }
1096 1084
1097 1085
1098 void Pipeline::TearDown() { 1086 void Pipeline::TearDown() {
1099 InstructionOperand::TearDownCaches(); 1087 InstructionOperand::TearDownCaches();
1100 } 1088 }
1101 1089
1102 } // namespace compiler 1090 } // namespace compiler
1103 } // namespace internal 1091 } // namespace internal
1104 } // namespace v8 1092 } // 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