Chromium Code Reviews| Index: test/cctest/heap/test-heap.cc |
| diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc |
| index 72a55c0f7e5e7f04e43e7ef8f27c63242ef9e0be..07a13e312298fe2ef81eb0b7c4e8487ca22ecd13 100644 |
| --- a/test/cctest/heap/test-heap.cc |
| +++ b/test/cctest/heap/test-heap.cc |
| @@ -6786,6 +6786,63 @@ TEST(Regress615489) { |
| CHECK_LE(size_after, size_before); |
| } |
| +class StaticOneByteResource : public v8::String::ExternalOneByteStringResource { |
| + public: |
| + explicit StaticOneByteResource(const char* data) : data_(data) {} |
| + |
| + ~StaticOneByteResource() {} |
| + |
| + const char* data() const { return data_; } |
| + |
| + size_t length() const { return strlen(data_); } |
| + |
| + private: |
| + const char* data_; |
| +}; |
| + |
| +TEST(Regress631969) { |
| + FLAG_manual_evacuation_candidates_selection = true; |
| + FLAG_parallel_compaction = false; |
| + FLAG_concurrent_sweeping = false; |
| + CcTest::InitializeVM(); |
| + v8::HandleScope scope(CcTest::isolate()); |
| + Heap* heap = CcTest::heap(); |
| + // Get the heap in clean state. |
| + heap->CollectGarbage(OLD_SPACE); |
| + heap->CollectGarbage(OLD_SPACE); |
| + Isolate* isolate = CcTest::i_isolate(); |
| + Factory* factory = isolate->factory(); |
| + // Allocate two string in a fresh page and mark the page as evacuation |
|
Jakob Kummerow
2016/08/02 11:34:08
nit: s/string/strings/
ulan
2016/08/02 15:00:24
Done.
|
| + // candidate. |
| + heap::SimulateFullSpace(heap->old_space()); |
| + Handle<String> s1 = factory->NewStringFromStaticChars("123456789", TENURED); |
| + Handle<String> s2 = factory->NewStringFromStaticChars("01234", TENURED); |
| + Page::FromAddress(s1->address()) |
| + ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
| + |
| + heap::SimulateIncrementalMarking(heap, false); |
| + |
| + // Allocate a cons string and promote it to a fresh page in the old space. |
| + heap::SimulateFullSpace(heap->old_space()); |
| + Handle<String> s3; |
| + factory->NewConsString(s1, s2).ToHandle(&s3); |
| + heap->CollectGarbage(NEW_SPACE); |
| + heap->CollectGarbage(NEW_SPACE); |
| + |
| + // Finish incremental marking. |
| + IncrementalMarking* marking = heap->incremental_marking(); |
| + while (!marking->IsComplete()) { |
| + marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| + if (marking->IsReadyToOverApproximateWeakClosure()) { |
| + marking->FinalizeIncrementally(); |
| + } |
| + } |
| + |
| + s3->MakeExternal(new StaticOneByteResource("12345678901234")); |
| + |
| + heap->CollectGarbage(OLD_SPACE); |
| +} |
| + |
| TEST(LeftTrimFixedArrayInBlackArea) { |
| FLAG_black_allocation = true; |
| CcTest::InitializeVM(); |