Chromium Code Reviews| Index: src/lithium-allocator.cc |
| diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc |
| index 513a67c7c839dbe4c63e7eeda18f6bc8c93cf820..1510cc49aae2b89cd4b69abb8b20e4a61df5811c 100644 |
| --- a/src/lithium-allocator.cc |
| +++ b/src/lithium-allocator.cc |
| @@ -296,13 +296,21 @@ void LiveRange::SplitAt(LifetimePosition position, LiveRange* result) { |
| // position is contained in one of the intervals in the chain, we |
| // split that interval and use the first part. |
| UseInterval* current = FirstSearchIntervalForPosition(position); |
| + |
| + // If split position coincides with the beginning of use interval |
|
Kevin Millikin (Chromium)
2010/12/15 14:01:52
"the split position"..."a use interval" :)
|
| + // we need to split use positons in a special way. |
| + bool split_at_start = false; |
| + |
| while (current != NULL) { |
| if (current->Contains(position)) { |
| current->SplitAt(position); |
| break; |
| } |
| UseInterval* next = current->next(); |
| - if (next->start().Value() >= position.Value()) break; |
| + if (next->start().Value() >= position.Value()) { |
| + split_at_start = (next->start().Value() == position.Value()); |
| + break; |
| + } |
| current = next; |
| } |
| @@ -319,9 +327,16 @@ void LiveRange::SplitAt(LifetimePosition position, LiveRange* result) { |
| // position after it. |
| UsePosition* use_after = first_pos_; |
| UsePosition* use_before = NULL; |
| - while (use_after != NULL && use_after->pos().Value() <= position.Value()) { |
| - use_before = use_after; |
| - use_after = use_after->next(); |
| + if (split_at_start) { |
| + while (use_after != NULL && use_after->pos().Value() < position.Value()) { |
|
Kevin Millikin (Chromium)
2010/12/15 14:01:52
Maybe this case needs a short comment too, somethi
|
| + use_before = use_after; |
| + use_after = use_after->next(); |
| + } |
| + } else { |
| + while (use_after != NULL && use_after->pos().Value() <= position.Value()) { |
| + use_before = use_after; |
| + use_after = use_after->next(); |
| + } |
| } |
| // Partition original use positions to the two live ranges. |