R=yangguo@chromium.org
TEST=cctest/test-dictionary
Review URL: https://codereview.chromium.org/
11299098
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13010
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
}
+// Helper function that simulates a fill new-space in the heap.
+static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
+ int new_linear_size = static_cast<int>(
+ *space->allocation_limit_address() - *space->allocation_top_address());
+ v8::internal::MaybeObject* maybe = space->AllocateRaw(new_linear_size);
+ v8::internal::FreeListNode* node = v8::internal::FreeListNode::cast(maybe);
+ node->set_size(space->heap(), new_linear_size);
+}
+
+
+// Helper function that simulates a full old-space in the heap.
+static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
+ int old_linear_size = static_cast<int>(space->limit() - space->top());
+ space->Free(space->top(), old_linear_size);
+ space->SetTop(space->limit(), space->limit());
+ space->ResetFreeList();
+ space->ClearStats();
+}
+
+
#endif // ifndef CCTEST_H_
using namespace v8::internal;
-// Also used in test-heap.cc test cases.
-void SimulateFullSpace(PagedSpace* space) {
- int old_linear_size = static_cast<int>(space->limit() - space->top());
- space->Free(space->top(), old_linear_size);
- space->SetTop(space->limit(), space->limit());
- space->ResetFreeList();
- space->ClearStats();
-}
-
-
static MaybeObject* AllocateAfterFailures() {
static int attempts = 0;
if (++attempts < 3) return Failure::RetryAfterGC();
}
-// Implemented in the test-alloc.cc test suite.
-void SimulateFullSpace(i::PagedSpace* space);
-
-
static bool MatchPointers(void* key1, void* key2) {
return key1 == key2;
}
// Simulate a full heap so that generating an identity hash code
// in subsequent calls will request GC.
- FLAG_gc_interval = 0;
+ SimulateFullSpace(HEAP->new_space());
+ SimulateFullSpace(HEAP->old_pointer_space());
// Calling Contains() should not cause GC ever.
CHECK(!table->Contains(*key));
// Simulate a full heap so that generating an identity hash code
// in subsequent calls will request GC.
- FLAG_gc_interval = 0;
+ SimulateFullSpace(HEAP->new_space());
+ SimulateFullSpace(HEAP->old_pointer_space());
// Calling Lookup() should not cause GC ever.
CHECK(table->Lookup(*key)->IsTheHole());
}
-// Implemented in the test-alloc.cc test suite.
-void SimulateFullSpace(PagedSpace* space);
-
-
TEST(PrototypeTransitionClearing) {
InitializeVM();
v8::HandleScope scope;