OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 CcTest::heap()->old_space()->EmptyAllocationInfo(); | 790 CcTest::heap()->old_space()->EmptyAllocationInfo(); |
791 | 791 |
792 HeapObject* filler = | 792 HeapObject* filler = |
793 HeapObject::FromAddress(array->address() + array->Size()); | 793 HeapObject::FromAddress(array->address() + array->Size()); |
794 CHECK_EQ(filler->map(), CcTest::heap()->two_pointer_filler_map()); | 794 CHECK_EQ(filler->map(), CcTest::heap()->two_pointer_filler_map()); |
795 | 795 |
796 const size_t shrinked = page->ShrinkToHighWaterMark(); | 796 const size_t shrinked = page->ShrinkToHighWaterMark(); |
797 CHECK_EQ(0u, shrinked); | 797 CHECK_EQ(0u, shrinked); |
798 } | 798 } |
799 | 799 |
800 HEAP_TEST(AdjustBytes) { | |
801 CcTest::InitializeVM(); | |
802 Isolate* isolate = CcTest::i_isolate(); | |
803 HandleScope scope(isolate); | |
804 Heap* heap = isolate->heap(); | |
805 for (int i = 0; i < 3; i++) { | |
806 heap->CollectGarbage(OLD_SPACE, i::GarbageCollectionReason::kTesting); | |
807 } | |
808 heap->mark_compact_collector()->EnsureSweepingCompleted(); | |
809 heap::SealCurrentObjects(CcTest::heap()); | |
810 | |
811 Handle<FixedArray> array = isolate->factory()->NewFixedArray(5000, TENURED); | |
812 | |
813 heap->CollectGarbage(OLD_SPACE, i::GarbageCollectionReason::kTesting); | |
814 heap->delay_sweeper_tasks_for_testing_ = false; | |
815 | |
816 size_t size_before = heap->SizeOfObjects(); | |
817 heap->RightTrimFixedArray(*array, 1000); | |
818 heap->mark_compact_collector()->sweeper().StartSweeperTasks(); | |
819 heap->mark_compact_collector()->EnsureSweepingCompleted(); | |
820 size_t size_after = heap->SizeOfObjects(); | |
821 // Right trimming during sweeping does not affect size counters. | |
822 CHECK_EQ(size_before, size_after); | |
823 heap->RightTrimFixedArray(*array, 1000); | |
824 size_after = heap->SizeOfObjects(); | |
825 // Right trimming before incremental marking runs does not affect size | |
826 // counters. | |
827 CHECK_EQ(size_before, size_after); | |
828 heap->CollectGarbage(OLD_SPACE, i::GarbageCollectionReason::kTesting); | |
829 size_after = heap->SizeOfObjects(); | |
830 CHECK_EQ(size_before, size_after + 2000 * kPointerSize); | |
831 } | |
832 | |
833 } // namespace internal | 800 } // namespace internal |
834 } // namespace v8 | 801 } // namespace v8 |
OLD | NEW |