| Index: src/register-allocator-ia32.cc
|
| ===================================================================
|
| --- src/register-allocator-ia32.cc (revision 894)
|
| +++ src/register-allocator-ia32.cc (working copy)
|
| @@ -41,7 +41,7 @@
|
| }
|
|
|
|
|
| -Register RegisterAllocator::Allocate() {
|
| +Register RegisterAllocator::AllocateWithoutSpilling() {
|
| // Return the first free register, if any.
|
| for (int i = 0; i < num_registers(); i++) {
|
| if (!registers_.is_used(i)) {
|
| @@ -50,15 +50,21 @@
|
| return result;
|
| }
|
| }
|
| + return no_reg;
|
| +}
|
|
|
| - // Ask the current frame to spill a register.
|
| - ASSERT(code_generator_->frame() != NULL);
|
| - Register result = code_generator_->frame()->SpillAnyRegister();
|
| - if (!result.is(no_reg)) {
|
| - ASSERT(!registers_.is_used(result.code()));
|
| - registers_.Use(result);
|
| +
|
| +Register RegisterAllocator::Allocate() {
|
| + Register result = AllocateWithoutSpilling();
|
| + if (result.is(no_reg)) {
|
| + // Ask the current frame to spill a register.
|
| + ASSERT(code_generator_->frame() != NULL);
|
| + result = code_generator_->frame()->SpillAnyRegister();
|
| + if (!result.is(no_reg)) {
|
| + ASSERT(!registers_.is_used(result.code()));
|
| + registers_.Use(result);
|
| + }
|
| }
|
| -
|
| return result;
|
| }
|
|
|
|
|