Reviewers: kmillikin,
Description:
Fix issue 982.
When splitting at the beginning of a use interval assign coinciding
position to
the split child instead of leaving it to parent.
BUG=v8:982
Please review this at http://codereview.chromium.org/5898001/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/lithium-allocator.cc
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
+ // 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()) {
+ 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.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev