Make test-dictionary work for GC stress builder.

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
parent 1570d627
......@@ -233,4 +233,24 @@ static inline int FlagDependentPortOffset() {
}
// 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_
......@@ -34,16 +34,6 @@
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();
......
......@@ -11505,10 +11505,6 @@ static void event_handler(const v8::JitCodeEvent* event) {
}
// Implemented in the test-alloc.cc test suite.
void SimulateFullSpace(i::PagedSpace* space);
static bool MatchPointers(void* key1, void* key2) {
return key1 == key2;
}
......
......@@ -114,7 +114,8 @@ TEST(ObjectHashSetCausesGC) {
// 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));
......@@ -143,7 +144,8 @@ TEST(ObjectHashTableCausesGC) {
// 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());
......
......@@ -1781,10 +1781,6 @@ TEST(InstanceOfStubWriteBarrier) {
}
// Implemented in the test-alloc.cc test suite.
void SimulateFullSpace(PagedSpace* space);
TEST(PrototypeTransitionClearing) {
InitializeVM();
v8::HandleScope scope;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment