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

Side by Side Diff: src/compiler/register-allocator.cc

Issue 704193007: [turbofan] add gap move verifier (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase 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 | Annotate | Revision Log
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/linkage.h" 5 #include "src/compiler/linkage.h"
6 #include "src/compiler/pipeline-statistics.h" 6 #include "src/compiler/pipeline-statistics.h"
7 #include "src/compiler/register-allocator.h" 7 #include "src/compiler/register-allocator.h"
8 #include "src/compiler/register-allocator-verifier.h"
9 #include "src/string-stream.h" 8 #include "src/string-stream.h"
10 9
11 namespace v8 { 10 namespace v8 {
12 namespace internal { 11 namespace internal {
13 namespace compiler { 12 namespace compiler {
14 13
15 static inline LifetimePosition Min(LifetimePosition a, LifetimePosition b) { 14 static inline LifetimePosition Min(LifetimePosition a, LifetimePosition b) {
16 return a.Value() < b.Value() ? a : b; 15 return a.Value() < b.Value() ? a : b;
17 } 16 }
18 17
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1109
1111 // We use the phi-ness of some nodes in some later heuristics. 1110 // We use the phi-ness of some nodes in some later heuristics.
1112 live_range->set_is_phi(true); 1111 live_range->set_is_phi(true);
1113 if (!block->IsLoopHeader()) { 1112 if (!block->IsLoopHeader()) {
1114 live_range->set_is_non_loop_phi(true); 1113 live_range->set_is_non_loop_phi(true);
1115 } 1114 }
1116 } 1115 }
1117 } 1116 }
1118 1117
1119 1118
1120 bool RegisterAllocator::Allocate(PipelineStatistics* stats, 1119 bool RegisterAllocator::Allocate(PipelineStatistics* stats) {
1121 VerificationType verification_type) {
1122 SmartPointer<Zone> verifier_zone;
1123 RegisterAllocatorVerifier* verifier = NULL;
1124 if (verification_type == kVerifyAssignment) {
1125 // Don't track usage for this zone in compiler stats.
1126 verifier_zone.Reset(new Zone(local_zone()->isolate()));
1127 verifier = new (verifier_zone.get())
1128 RegisterAllocatorVerifier(verifier_zone.get(), code());
1129 }
1130 assigned_registers_ = new (code_zone()) 1120 assigned_registers_ = new (code_zone())
1131 BitVector(config()->num_general_registers(), code_zone()); 1121 BitVector(config()->num_general_registers(), code_zone());
1132 assigned_double_registers_ = new (code_zone()) 1122 assigned_double_registers_ = new (code_zone())
1133 BitVector(config()->num_aliased_double_registers(), code_zone()); 1123 BitVector(config()->num_aliased_double_registers(), code_zone());
1134 { 1124 {
1135 PhaseScope phase_scope(stats, "meet register constraints"); 1125 PhaseScope phase_scope(stats, "meet register constraints");
1136 MeetRegisterConstraints(); 1126 MeetRegisterConstraints();
1137 } 1127 }
1138 if (!AllocationOk()) return false; 1128 if (!AllocationOk()) return false;
1139 { 1129 {
(...skipping 21 matching lines...) Expand all
1161 { 1151 {
1162 PhaseScope phase_scope(stats, "connect ranges"); 1152 PhaseScope phase_scope(stats, "connect ranges");
1163 ConnectRanges(); 1153 ConnectRanges();
1164 } 1154 }
1165 { 1155 {
1166 PhaseScope phase_scope(stats, "resolve control flow"); 1156 PhaseScope phase_scope(stats, "resolve control flow");
1167 ResolveControlFlow(); 1157 ResolveControlFlow();
1168 } 1158 }
1169 frame()->SetAllocatedRegisters(assigned_registers_); 1159 frame()->SetAllocatedRegisters(assigned_registers_);
1170 frame()->SetAllocatedDoubleRegisters(assigned_double_registers_); 1160 frame()->SetAllocatedDoubleRegisters(assigned_double_registers_);
1171 if (verifier != NULL) {
1172 verifier->VerifyAssignment();
1173 }
1174 return true; 1161 return true;
1175 } 1162 }
1176 1163
1177 1164
1178 void RegisterAllocator::MeetRegisterConstraints() { 1165 void RegisterAllocator::MeetRegisterConstraints() {
1179 for (auto block : code()->instruction_blocks()) { 1166 for (auto block : code()->instruction_blocks()) {
1180 MeetRegisterConstraints(block); 1167 MeetRegisterConstraints(block);
1181 if (!AllocationOk()) return; 1168 if (!AllocationOk()) return;
1182 } 1169 }
1183 } 1170 }
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 } else { 2318 } else {
2332 DCHECK(range->Kind() == GENERAL_REGISTERS); 2319 DCHECK(range->Kind() == GENERAL_REGISTERS);
2333 assigned_registers_->Add(reg); 2320 assigned_registers_->Add(reg);
2334 } 2321 }
2335 range->set_assigned_register(reg, code_zone()); 2322 range->set_assigned_register(reg, code_zone());
2336 } 2323 }
2337 2324
2338 } 2325 }
2339 } 2326 }
2340 } // namespace v8::internal::compiler 2327 } // namespace v8::internal::compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698