Chromium Code Reviews| Index: vm/locations.cc |
| =================================================================== |
| --- vm/locations.cc (revision 7955) |
| +++ vm/locations.cc (working copy) |
| @@ -30,8 +30,8 @@ |
| blocked_registers[i] = false; |
| } |
| - // Mark all fixed registers as used. |
| - for (intptr_t i = 0; i < count(); i++) { |
| + // Mark all fixed input, temp and output registers as used. |
| + for (intptr_t i = 0; i < input_count(); i++) { |
| Location loc = in(i); |
| if (loc.kind() == Location::kRegister) { |
| ASSERT(!blocked_registers[loc.reg()]); |
| @@ -39,6 +39,19 @@ |
| } |
| } |
| + for (intptr_t i = 0; i < temp_count(); i++) { |
| + Location loc = temp(i); |
| + if (loc.kind() == Location::kRegister) { |
| + ASSERT(!blocked_registers[loc.reg()]); |
| + blocked_registers[loc.reg()] = true; |
| + } |
| + } |
| + |
| + if (out().kind() == Location::kRegister) { |
| + ASSERT(!blocked_registers[out().reg()]); |
| + blocked_registers[out().reg()] = true; |
|
srdjan
2012/05/24 18:57:16
We should be able to have the same input/temp and
|
| + } |
| + |
| // Do not allocate known registers. |
| blocked_registers[CTX] = true; |
| if (TMP != kNoRegister) { |
| @@ -46,7 +59,7 @@ |
| } |
| // Allocate all unallocated input locations. |
| - for (intptr_t i = 0; i < count(); i++) { |
| + for (intptr_t i = 0; i < input_count(); i++) { |
| Location loc = in(i); |
| if (loc.kind() == Location::kUnallocated) { |
| ASSERT(loc.policy() == Location::kRequiresRegister); |
| @@ -55,6 +68,16 @@ |
| } |
| } |
| + // Allocate all unallocated temp locations. |
| + for (intptr_t i = 0; i < temp_count(); i++) { |
| + Location loc = temp(i); |
| + if (loc.kind() == Location::kUnallocated) { |
| + ASSERT(loc.policy() == Location::kRequiresRegister); |
| + set_temp(i, Location::RegisterLocation( |
| + AllocateFreeRegister(&blocked_registers))); |
| + } |
| + } |
| + |
| Location result_location = out(); |
| if (result_location.kind() == Location::kUnallocated) { |
| switch (result_location.policy()) { |