Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/lithium-allocator.cc

Issue 7053039: Fix two bugs in LiveRange::SplitAt: (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 ASSERT(result->IsEmpty()); 296 ASSERT(result->IsEmpty());
297 // Find the last interval that ends before the position. If the 297 // Find the last interval that ends before the position. If the
298 // position is contained in one of the intervals in the chain, we 298 // position is contained in one of the intervals in the chain, we
299 // split that interval and use the first part. 299 // split that interval and use the first part.
300 UseInterval* current = FirstSearchIntervalForPosition(position); 300 UseInterval* current = FirstSearchIntervalForPosition(position);
301 301
302 // If the split position coincides with the beginning of a use interval 302 // If the split position coincides with the beginning of a use interval
303 // we need to split use positons in a special way. 303 // we need to split use positons in a special way.
304 bool split_at_start = false; 304 bool split_at_start = false;
305 305
306 if (current->start().Value() == position.Value()) {
307 // When splitting at start we need to locate the previous use interval.
308 current = first_interval_;
309 }
310
306 while (current != NULL) { 311 while (current != NULL) {
307 if (current->Contains(position)) { 312 if (current->Contains(position)) {
308 current->SplitAt(position); 313 current->SplitAt(position);
309 break; 314 break;
310 } 315 }
311 UseInterval* next = current->next(); 316 UseInterval* next = current->next();
312 if (next->start().Value() >= position.Value()) { 317 if (next->start().Value() >= position.Value()) {
313 split_at_start = (next->start().Value() == position.Value()); 318 split_at_start = (next->start().Value() == position.Value());
314 break; 319 break;
315 } 320 }
(...skipping 29 matching lines...) Expand all
345 } 350 }
346 351
347 // Partition original use positions to the two live ranges. 352 // Partition original use positions to the two live ranges.
348 if (use_before != NULL) { 353 if (use_before != NULL) {
349 use_before->next_ = NULL; 354 use_before->next_ = NULL;
350 } else { 355 } else {
351 first_pos_ = NULL; 356 first_pos_ = NULL;
352 } 357 }
353 result->first_pos_ = use_after; 358 result->first_pos_ = use_after;
354 359
360 // Discard cached iteration state. It might be pointing
361 // to the use that no longer belongs to this live range.
362 last_processed_use_ = NULL;
363 current_interval_ = NULL;
364
355 // Link the new live range in the chain before any of the other 365 // Link the new live range in the chain before any of the other
356 // ranges linked from the range before the split. 366 // ranges linked from the range before the split.
357 result->parent_ = (parent_ == NULL) ? this : parent_; 367 result->parent_ = (parent_ == NULL) ? this : parent_;
358 result->next_ = next_; 368 result->next_ = next_;
359 next_ = result; 369 next_ = result;
360 370
361 #ifdef DEBUG 371 #ifdef DEBUG
362 Verify(); 372 Verify();
363 result->Verify(); 373 result->Verify();
364 #endif 374 #endif
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 LiveRange* current = live_ranges()->at(i); 2124 LiveRange* current = live_ranges()->at(i);
2115 if (current != NULL) current->Verify(); 2125 if (current != NULL) current->Verify();
2116 } 2126 }
2117 } 2127 }
2118 2128
2119 2129
2120 #endif 2130 #endif
2121 2131
2122 2132
2123 } } // namespace v8::internal 2133 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698