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

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

Issue 14855010: Use first position in LAllocator ordering heuristic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 // This implements an ordering on live ranges so that they are ordered by their 371 // This implements an ordering on live ranges so that they are ordered by their
372 // start positions. This is needed for the correctness of the register 372 // start positions. This is needed for the correctness of the register
373 // allocation algorithm. If two live ranges start at the same offset then there 373 // allocation algorithm. If two live ranges start at the same offset then there
374 // is a tie breaker based on where the value is first used. This part of the 374 // is a tie breaker based on where the value is first used. This part of the
375 // ordering is merely a heuristic. 375 // ordering is merely a heuristic.
376 bool LiveRange::ShouldBeAllocatedBefore(const LiveRange* other) const { 376 bool LiveRange::ShouldBeAllocatedBefore(const LiveRange* other) const {
377 LifetimePosition start = Start(); 377 LifetimePosition start = Start();
378 LifetimePosition other_start = other->Start(); 378 LifetimePosition other_start = other->Start();
379 if (start.Value() == other_start.Value()) { 379 if (start.Value() == other_start.Value()) {
380 UsePosition* pos = FirstPosWithHint(); 380 UsePosition* pos = first_pos();
381 if (pos == NULL) return false; 381 if (pos == NULL) return false;
382 UsePosition* other_pos = other->first_pos(); 382 UsePosition* other_pos = other->first_pos();
383 if (other_pos == NULL) return true; 383 if (other_pos == NULL) return true;
384 return pos->pos().Value() < other_pos->pos().Value(); 384 return pos->pos().Value() < other_pos->pos().Value();
385 } 385 }
386 return start.Value() < other_start.Value(); 386 return start.Value() < other_start.Value();
387 } 387 }
388 388
389 389
390 void LiveRange::ShortenTo(LifetimePosition start) { 390 void LiveRange::ShortenTo(LifetimePosition start) {
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 LiveRange* current = live_ranges()->at(i); 2188 LiveRange* current = live_ranges()->at(i);
2189 if (current != NULL) current->Verify(); 2189 if (current != NULL) current->Verify();
2190 } 2190 }
2191 } 2191 }
2192 2192
2193 2193
2194 #endif 2194 #endif
2195 2195
2196 2196
2197 } } // namespace v8::internal 2197 } } // 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