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

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

Issue 1405673003: provides a mechanism for optimizing compilers to select the different Register configuration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add the TODO comments. Created 5 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 unified diff | Download patch
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/crankshaft/lithium-allocator.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 = RegisterConfiguration::ArchDefault(); 170 const RegisterConfiguration* config =
171 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
171 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { 172 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) {
172 int code = config->GetAllocatableGeneralCode(i); 173 int code = config->GetAllocatableGeneralCode(i);
173 if (source_uses_[code] == 0 && destination_uses_[code] > 0 && 174 if (source_uses_[code] == 0 && destination_uses_[code] > 0 &&
174 code != skip_index) { 175 code != skip_index) {
175 return Register::from_code(code); 176 return Register::from_code(code);
176 } 177 }
177 } 178 }
178 return no_reg; 179 return no_reg;
179 } 180 }
180 181
181 182
182 bool LGapResolver::HasBeenReset() { 183 bool LGapResolver::HasBeenReset() {
183 if (!moves_.is_empty()) return false; 184 if (!moves_.is_empty()) return false;
184 if (spilled_register_ >= 0) return false; 185 if (spilled_register_ >= 0) return false;
185 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); 186 const RegisterConfiguration* config =
187 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
186 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { 188 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) {
187 int code = config->GetAllocatableGeneralCode(i); 189 int code = config->GetAllocatableGeneralCode(i);
188 if (source_uses_[code] != 0) return false; 190 if (source_uses_[code] != 0) return false;
189 if (destination_uses_[code] != 0) return false; 191 if (destination_uses_[code] != 0) return false;
190 } 192 }
191 return true; 193 return true;
192 } 194 }
193 195
194 196
195 void LGapResolver::Verify() { 197 void LGapResolver::Verify() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (spilled_register_ >= 0) { 231 if (spilled_register_ >= 0) {
230 return Register::from_code(spilled_register_); 232 return Register::from_code(spilled_register_);
231 } 233 }
232 234
233 // 2. We may have a free register that we can use without spilling. 235 // 2. We may have a free register that we can use without spilling.
234 Register free = GetFreeRegisterNot(no_reg); 236 Register free = GetFreeRegisterNot(no_reg);
235 if (!free.is(no_reg)) return free; 237 if (!free.is(no_reg)) return free;
236 238
237 // 3. Prefer to spill a register that is not used in any remaining move 239 // 3. Prefer to spill a register that is not used in any remaining move
238 // because it will not need to be restored until the end. 240 // because it will not need to be restored until the end.
239 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); 241 const RegisterConfiguration* config =
242 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
240 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { 243 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) {
241 int code = config->GetAllocatableGeneralCode(i); 244 int code = config->GetAllocatableGeneralCode(i);
242 if (source_uses_[code] == 0 && destination_uses_[code] == 0) { 245 if (source_uses_[code] == 0 && destination_uses_[code] == 0) {
243 Register scratch = Register::from_code(code); 246 Register scratch = Register::from_code(code);
244 __ push(scratch); 247 __ push(scratch);
245 spilled_register_ = code; 248 spilled_register_ = code;
246 return scratch; 249 return scratch;
247 } 250 }
248 } 251 }
249 252
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 source_uses_[destination->index()] = CountSourceUses(destination); 482 source_uses_[destination->index()] = CountSourceUses(destination);
480 } 483 }
481 } 484 }
482 485
483 #undef __ 486 #undef __
484 487
485 } // namespace internal 488 } // namespace internal
486 } // namespace v8 489 } // namespace v8
487 490
488 #endif // V8_TARGET_ARCH_IA32 491 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/crankshaft/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698