Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 6748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6759 Heap* heap = CcTest::heap(); | 6759 Heap* heap = CcTest::heap(); |
| 6760 Isolate* isolate = heap->isolate(); | 6760 Isolate* isolate = heap->isolate(); |
| 6761 | 6761 |
| 6762 intptr_t size_before = heap->SizeOfObjects(); | 6762 intptr_t size_before = heap->SizeOfObjects(); |
| 6763 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); | 6763 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); |
| 6764 array->Shrink(1); | 6764 array->Shrink(1); |
| 6765 intptr_t size_after = heap->SizeOfObjects(); | 6765 intptr_t size_after = heap->SizeOfObjects(); |
| 6766 CHECK_EQ(size_after, size_before + array->Size()); | 6766 CHECK_EQ(size_after, size_before + array->Size()); |
| 6767 } | 6767 } |
| 6768 | 6768 |
| 6769 TEST(MyTest) { | |
|
Hannes Payer (out of office)
2016/05/30 11:27:10
I know, it's your test. But let's rename it to som
ulan
2016/05/30 12:41:08
good catch :)
| |
| 6770 FLAG_black_allocation = true; | |
| 6771 CcTest::InitializeVM(); | |
| 6772 v8::HandleScope scope(CcTest::isolate()); | |
| 6773 Heap* heap = CcTest::heap(); | |
| 6774 Isolate* isolate = heap->isolate(); | |
| 6775 heap->CollectAllGarbage(); | |
| 6776 | |
| 6777 i::MarkCompactCollector* collector = heap->mark_compact_collector(); | |
| 6778 i::IncrementalMarking* marking = heap->incremental_marking(); | |
| 6779 if (collector->sweeping_in_progress()) { | |
| 6780 collector->EnsureSweepingCompleted(); | |
| 6781 } | |
| 6782 CHECK(marking->IsMarking() || marking->IsStopped()); | |
| 6783 if (marking->IsStopped()) { | |
| 6784 heap->StartIncrementalMarking(); | |
| 6785 } | |
| 6786 CHECK(marking->IsMarking()); | |
| 6787 marking->StartBlackAllocationForTesting(); | |
| 6788 { | |
| 6789 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | |
| 6790 v8::HandleScope inner(CcTest::isolate()); | |
| 6791 isolate->factory()->NewFixedArray(500, TENURED)->Size(); | |
| 6792 } | |
| 6793 while (!marking->IsComplete()) { | |
| 6794 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | |
| 6795 if (marking->IsReadyToOverApproximateWeakClosure()) { | |
| 6796 marking->FinalizeIncrementally(); | |
| 6797 } | |
| 6798 } | |
| 6799 CHECK(marking->IsComplete()); | |
| 6800 intptr_t size_before = heap->SizeOfObjects(); | |
| 6801 CcTest::heap()->CollectAllGarbage(); | |
| 6802 intptr_t size_after = heap->SizeOfObjects(); | |
| 6803 // Live size does not increase after garbage collection. | |
| 6804 CHECK_LE(size_after, size_before); | |
| 6805 } | |
| 6806 | |
| 6769 } // namespace internal | 6807 } // namespace internal |
| 6770 } // namespace v8 | 6808 } // namespace v8 |
| OLD | NEW |