Index: test/cctest/heap/test-heap.cc |
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc |
index 426eb63a74da0c8383323f0f0534b5361b432522..e0252781cffae1cdd215c88c59e325e64f02fd9d 100644 |
--- a/test/cctest/heap/test-heap.cc |
+++ b/test/cctest/heap/test-heap.cc |
@@ -711,6 +711,44 @@ TEST(DeleteWeakGlobalHandle) { |
CHECK(WeakPointerCleared); |
} |
+TEST(DoNotPromoteWhiteObjectsOnScavenge) { |
+ CcTest::InitializeVM(); |
+ Isolate* isolate = CcTest::i_isolate(); |
+ Heap* heap = isolate->heap(); |
+ Factory* factory = isolate->factory(); |
+ |
+ HandleScope scope(isolate); |
+ Handle<Object> white = factory->NewStringFromStaticChars("white"); |
+ |
+ CHECK(Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(*white)))); |
+ |
+ heap->CollectGarbage(NEW_SPACE); |
+ |
+ CHECK(heap->InNewSpace(*white)); |
+} |
+ |
+TEST(PromoteGreyOrBlackObjectsOnScavenge) { |
+ CcTest::InitializeVM(); |
+ Isolate* isolate = CcTest::i_isolate(); |
+ Heap* heap = isolate->heap(); |
+ Factory* factory = isolate->factory(); |
+ |
+ HandleScope scope(isolate); |
+ Handle<Object> marked = factory->NewStringFromStaticChars("marked"); |
+ |
+ IncrementalMarking* marking = heap->incremental_marking(); |
+ marking->Stop(); |
+ heap->StartIncrementalMarking(); |
+ while (Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(*marked)))) { |
+ marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
+ IncrementalMarking::FORCE_MARKING, |
+ IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
+ } |
+ |
+ heap->CollectGarbage(NEW_SPACE); |
+ |
+ CHECK(!heap->InNewSpace(*marked)); |
+} |
TEST(BytecodeArray) { |
static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; |