Reuse backing store of two zone lists by using Rewind(0) instead of Clear().

Review URL: http://codereview.chromium.org/6647019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7108 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
fschneider@chromium.org 2011-03-09 15:50:24 +00:00
parent ca20d718b3
commit 012db51660
3 changed files with 7 additions and 5 deletions

View File

@ -640,7 +640,7 @@ void HGraph::OrderBlocks() {
HBasicBlock* start = blocks_[0]; HBasicBlock* start = blocks_[0];
Postorder(start, &visited, &reverse_result, NULL); Postorder(start, &visited, &reverse_result, NULL);
blocks_.Clear(); blocks_.Rewind(0);
int index = 0; int index = 0;
for (int i = reverse_result.length() - 1; i >= 0; --i) { for (int i = reverse_result.length() - 1; i >= 0; --i) {
HBasicBlock* b = reverse_result[i]; HBasicBlock* b = reverse_result[i];

View File

@ -379,7 +379,7 @@ class HEnvironment: public ZoneObject {
void ClearHistory() { void ClearHistory() {
pop_count_ = 0; pop_count_ = 0;
push_count_ = 0; push_count_ = 0;
assigned_variables_.Clear(); assigned_variables_.Rewind(0);
} }
void SetValueAt(int index, HValue* value) { void SetValueAt(int index, HValue* value) {

View File

@ -1436,7 +1436,7 @@ void LAllocator::AllocateDoubleRegisters() {
void LAllocator::AllocateRegisters() { void LAllocator::AllocateRegisters() {
ASSERT(mode_ != NONE); ASSERT(mode_ != NONE);
reusable_slots_.Clear(); ASSERT(unhandled_live_ranges_.is_empty());
for (int i = 0; i < live_ranges_.length(); ++i) { for (int i = 0; i < live_ranges_.length(); ++i) {
if (live_ranges_[i] != NULL) { if (live_ranges_[i] != NULL) {
@ -1448,6 +1448,7 @@ void LAllocator::AllocateRegisters() {
SortUnhandled(); SortUnhandled();
ASSERT(UnhandledIsSorted()); ASSERT(UnhandledIsSorted());
ASSERT(reusable_slots_.is_empty());
ASSERT(active_live_ranges_.is_empty()); ASSERT(active_live_ranges_.is_empty());
ASSERT(inactive_live_ranges_.is_empty()); ASSERT(inactive_live_ranges_.is_empty());
@ -1532,8 +1533,9 @@ void LAllocator::AllocateRegisters() {
} }
} }
active_live_ranges_.Clear(); reusable_slots_.Rewind(0);
inactive_live_ranges_.Clear(); active_live_ranges_.Rewind(0);
inactive_live_ranges_.Rewind(0);
} }