Chromium Code Reviews| Index: src/lithium-allocator.cc |
| diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc |
| index 91a98112b61bd60a50b56d98f8ca4eebacdf01ff..104397e81ec50cb6e4229c11dbe6756391a4549e 100644 |
| --- a/src/lithium-allocator.cc |
| +++ b/src/lithium-allocator.cc |
| @@ -1945,6 +1945,24 @@ void LAllocator::SplitAndSpillIntersecting(LiveRange* current) { |
| if (range->assigned_register() == reg) { |
| UsePosition* next_pos = range->NextRegisterPosition(current->Start()); |
| if (next_pos == NULL) { |
| + HBasicBlock* block = GetBlock(current->Start().InstructionStart()); |
| + HBasicBlock* loop_header = |
| + block->IsLoopHeader() ? block : block->parent_loop_header(); |
| + if (loop_header != NULL) { |
|
danno
2013/01/02 17:35:14
Don't you want a loop here? If there are nested lo
Vyacheslav Egorov (Google)
2013/01/07 06:42:25
I just wanted to keep this code simple. I will add
|
| + // We are going to spill live range inside the loop. |
| + // If possible try to move spilling position backwards to loop header. |
| + // This will reduce number of memory moves on the back edge. |
| + LifetimePosition pos = LifetimePosition::FromInstructionIndex( |
| + loop_header->first_instruction_index()); |
|
danno
2013/01/02 17:35:14
Don't you want last_instruction_index() in case th
Vyacheslav Egorov (Google)
2013/01/07 06:42:25
Not sure I understand. If I make it last_instructi
danno
2013/01/08 12:39:22
Maybe I'm just confused. My thought was that you w
|
| + if (range->Covers(pos)) { |
| + range->ResetLastProcessedUse(); |
| + if (range->NextUsePositionRegisterIsBeneficial(pos) == NULL) { |
| + // No register beneficial use since loop's start. |
| + // Move split position backwards. |
| + split_pos = pos; |
|
danno
2013/01/02 17:35:14
Since split_pos, can be different for every live r
Vyacheslav Egorov (Google)
2013/01/07 06:42:25
Good catch. I misread where split_pos is defined.
|
| + } |
| + } |
| + } |
| SpillAfter(range, split_pos); |
| } else { |
| SpillBetween(range, split_pos, next_pos->pos()); |
|
danno
2013/01/02 17:35:14
Why doesn't your logic to hoist spills no also app
Vyacheslav Egorov (Google)
2013/01/07 06:42:25
It can be applied here. I just did not want to app
|