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

Unified Diff: test/cctest/test-heap.cc

Issue 7983001: Fix new space shrinking to compute correct capacity. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 86be15a5ca272aad04ad804ad589c322f7ca31a4..aeab4014b7453403706d3a2858aa0593aa170570 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -1233,9 +1233,8 @@ TEST(GrowAndShrinkNewSpace) {
new_capacity = new_space->Capacity();
ASSERT_EQ(2 * old_capacity, new_capacity);
- // Fill up new space to the point that it exceeds old capacity.
- while (new_space->SizeAsInt() <= old_capacity) {
- Handle<FixedArray> filler = FACTORY->NewFixedArray(1000, NOT_TENURED);
+ // Fill up new space to the point that it is almost full.
+ while (new_space->SizeAsInt() + FixedArray::SizeFor(1000) < new_capacity) {
ASSERT(HEAP->InNewSpace(*FACTORY->NewFixedArray(1000, NOT_TENURED)));
}
@@ -1263,28 +1262,3 @@ TEST(GrowAndShrinkNewSpace) {
new_capacity = new_space->Capacity();
ASSERT_EQ(old_capacity, new_capacity);
}
-
-
-class HeapIteratorTestHelper {
- public:
- HeapIteratorTestHelper(Object* a, Object* b)
- : a_(a), b_(b), a_found_(false), b_found_(false) {}
- bool a_found() { return a_found_; }
- bool b_found() { return b_found_; }
- void IterateHeap() {
- HeapIterator iterator;
- for (HeapObject* obj = iterator.next();
- obj != NULL;
- obj = iterator.next()) {
- if (obj == a_)
- a_found_ = true;
- else if (obj == b_)
- b_found_ = true;
- }
- }
- private:
- Object* a_;
- Object* b_;
- bool a_found_;
- bool b_found_;
-};
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698