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

Side by Side Diff: src/crankshaft/ia32/lithium-gap-resolver-ia32.cc

Issue 2092413002: [RegisterConfiguration] Streamline access to arch defaults, simplify Registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile. Created 4 years, 5 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 | « src/crankshaft/ia32/lithium-codegen-ia32.cc ('k') | src/crankshaft/lithium.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h"
8 #include "src/crankshaft/ia32/lithium-gap-resolver-ia32.h" 8 #include "src/crankshaft/ia32/lithium-gap-resolver-ia32.h"
9 #include "src/register-configuration.h" 9 #include "src/register-configuration.h"
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (!moves_[i].IsEliminated() && moves_[i].source()->Equals(operand)) { 160 if (!moves_[i].IsEliminated() && moves_[i].source()->Equals(operand)) {
161 ++count; 161 ++count;
162 } 162 }
163 } 163 }
164 return count; 164 return count;
165 } 165 }
166 166
167 167
168 Register LGapResolver::GetFreeRegisterNot(Register reg) { 168 Register LGapResolver::GetFreeRegisterNot(Register reg) {
169 int skip_index = reg.is(no_reg) ? -1 : reg.code(); 169 int skip_index = reg.is(no_reg) ? -1 : reg.code();
170 const RegisterConfiguration* config = 170 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft();
171 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
172 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { 171 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) {
173 int code = config->GetAllocatableGeneralCode(i); 172 int code = config->GetAllocatableGeneralCode(i);
174 if (source_uses_[code] == 0 && destination_uses_[code] > 0 && 173 if (source_uses_[code] == 0 && destination_uses_[code] > 0 &&
175 code != skip_index) { 174 code != skip_index) {
176 return Register::from_code(code); 175 return Register::from_code(code);
177 } 176 }
178 } 177 }
179 return no_reg; 178 return no_reg;
180 } 179 }
181 180
182 181
183 bool LGapResolver::HasBeenReset() { 182 bool LGapResolver::HasBeenReset() {
184 if (!moves_.is_empty()) return false; 183 if (!moves_.is_empty()) return false;
185 if (spilled_register_ >= 0) return false; 184 if (spilled_register_ >= 0) return false;
186 const RegisterConfiguration* config = 185 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft();
187 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
188 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { 186 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) {
189 int code = config->GetAllocatableGeneralCode(i); 187 int code = config->GetAllocatableGeneralCode(i);
190 if (source_uses_[code] != 0) return false; 188 if (source_uses_[code] != 0) return false;
191 if (destination_uses_[code] != 0) return false; 189 if (destination_uses_[code] != 0) return false;
192 } 190 }
193 return true; 191 return true;
194 } 192 }
195 193
196 194
197 void LGapResolver::Verify() { 195 void LGapResolver::Verify() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (spilled_register_ >= 0) { 229 if (spilled_register_ >= 0) {
232 return Register::from_code(spilled_register_); 230 return Register::from_code(spilled_register_);
233 } 231 }
234 232
235 // 2. We may have a free register that we can use without spilling. 233 // 2. We may have a free register that we can use without spilling.
236 Register free = GetFreeRegisterNot(no_reg); 234 Register free = GetFreeRegisterNot(no_reg);
237 if (!free.is(no_reg)) return free; 235 if (!free.is(no_reg)) return free;
238 236
239 // 3. Prefer to spill a register that is not used in any remaining move 237 // 3. Prefer to spill a register that is not used in any remaining move
240 // because it will not need to be restored until the end. 238 // because it will not need to be restored until the end.
241 const RegisterConfiguration* config = 239 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft();
242 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
243 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { 240 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) {
244 int code = config->GetAllocatableGeneralCode(i); 241 int code = config->GetAllocatableGeneralCode(i);
245 if (source_uses_[code] == 0 && destination_uses_[code] == 0) { 242 if (source_uses_[code] == 0 && destination_uses_[code] == 0) {
246 Register scratch = Register::from_code(code); 243 Register scratch = Register::from_code(code);
247 __ push(scratch); 244 __ push(scratch);
248 spilled_register_ = code; 245 spilled_register_ = code;
249 return scratch; 246 return scratch;
250 } 247 }
251 } 248 }
252 249
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 source_uses_[destination->index()] = CountSourceUses(destination); 481 source_uses_[destination->index()] = CountSourceUses(destination);
485 } 482 }
486 } 483 }
487 484
488 #undef __ 485 #undef __
489 486
490 } // namespace internal 487 } // namespace internal
491 } // namespace v8 488 } // namespace v8
492 489
493 #endif // V8_TARGET_ARCH_IA32 490 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/crankshaft/ia32/lithium-codegen-ia32.cc ('k') | src/crankshaft/lithium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698