From 012db51660dd1f59abae8a9130b955a2c73f8e37 Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Wed, 9 Mar 2011 15:50:24 +0000 Subject: [PATCH] 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 --- src/hydrogen.cc | 2 +- src/hydrogen.h | 2 +- src/lithium-allocator.cc | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index c54455e..b999ab9 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -640,7 +640,7 @@ void HGraph::OrderBlocks() { HBasicBlock* start = blocks_[0]; Postorder(start, &visited, &reverse_result, NULL); - blocks_.Clear(); + blocks_.Rewind(0); int index = 0; for (int i = reverse_result.length() - 1; i >= 0; --i) { HBasicBlock* b = reverse_result[i]; diff --git a/src/hydrogen.h b/src/hydrogen.h index b359db3..21f3677 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -379,7 +379,7 @@ class HEnvironment: public ZoneObject { void ClearHistory() { pop_count_ = 0; push_count_ = 0; - assigned_variables_.Clear(); + assigned_variables_.Rewind(0); } void SetValueAt(int index, HValue* value) { diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc index 5755bb2..1e79c00 100644 --- a/src/lithium-allocator.cc +++ b/src/lithium-allocator.cc @@ -1436,7 +1436,7 @@ void LAllocator::AllocateDoubleRegisters() { void LAllocator::AllocateRegisters() { ASSERT(mode_ != NONE); - reusable_slots_.Clear(); + ASSERT(unhandled_live_ranges_.is_empty()); for (int i = 0; i < live_ranges_.length(); ++i) { if (live_ranges_[i] != NULL) { @@ -1448,6 +1448,7 @@ void LAllocator::AllocateRegisters() { SortUnhandled(); ASSERT(UnhandledIsSorted()); + ASSERT(reusable_slots_.is_empty()); ASSERT(active_live_ranges_.is_empty()); ASSERT(inactive_live_ranges_.is_empty()); @@ -1532,8 +1533,9 @@ void LAllocator::AllocateRegisters() { } } - active_live_ranges_.Clear(); - inactive_live_ranges_.Clear(); + reusable_slots_.Rewind(0); + active_live_ranges_.Rewind(0); + inactive_live_ranges_.Rewind(0); } -- 2.7.4