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 6968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6979 heap->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(*array, i); | 6979 heap->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(*array, i); |
6980 HeapObject* filler = HeapObject::FromAddress(previous); | 6980 HeapObject* filler = HeapObject::FromAddress(previous); |
6981 CHECK(filler->IsFiller()); | 6981 CHECK(filler->IsFiller()); |
6982 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); | 6982 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); |
6983 } | 6983 } |
6984 } | 6984 } |
6985 | 6985 |
6986 heap::GcAndSweep(heap, OLD_SPACE); | 6986 heap::GcAndSweep(heap, OLD_SPACE); |
6987 } | 6987 } |
6988 | 6988 |
| 6989 TEST(SlotFilteringAfterBlackAreas) { |
| 6990 FLAG_black_allocation = true; |
| 6991 CcTest::InitializeVM(); |
| 6992 v8::HandleScope scope(CcTest::isolate()); |
| 6993 Heap* heap = CcTest::heap(); |
| 6994 Isolate* isolate = heap->isolate(); |
| 6995 MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector(); |
| 6996 heap->CollectAllGarbage(); |
| 6997 |
| 6998 i::MarkCompactCollector* collector = heap->mark_compact_collector(); |
| 6999 i::IncrementalMarking* marking = heap->incremental_marking(); |
| 7000 if (collector->sweeping_in_progress()) { |
| 7001 collector->EnsureSweepingCompleted(); |
| 7002 } |
| 7003 CHECK(marking->IsMarking() || marking->IsStopped()); |
| 7004 if (marking->IsStopped()) { |
| 7005 heap->StartIncrementalMarking(); |
| 7006 } |
| 7007 CHECK(marking->IsMarking()); |
| 7008 marking->StartBlackAllocationForTesting(); |
| 7009 |
| 7010 // Ensure that we allocate a new page, set up a bump pointer area, and |
| 7011 // perform the allocation in a black area. |
| 7012 heap::SimulateFullSpace(heap->old_space()); |
| 7013 Handle<FixedArray> array = isolate->factory()->NewFixedArray(10, TENURED); |
| 7014 Page* page = Page::FromAddress(array->address()); |
| 7015 |
| 7016 // After allocation we empty the allocation info to limit the black area |
| 7017 // only on the allocated array. |
| 7018 heap->old_space()->EmptyAllocationInfo(); |
| 7019 |
| 7020 // Slots in the black area are part of the black object. |
| 7021 CHECK(mark_compact_collector->IsSlotInBlackObject(page, array->address())); |
| 7022 CHECK(mark_compact_collector->IsSlotInBlackObject( |
| 7023 page, array->address() + array->Size() - kPointerSize)); |
| 7024 |
| 7025 // Slots after the black area are not part of the black object and have to |
| 7026 // be filtered out. |
| 7027 CHECK(!mark_compact_collector->IsSlotInBlackObject( |
| 7028 page, array->address() + array->Size())); |
| 7029 } |
| 7030 |
6989 TEST(Regress618958) { | 7031 TEST(Regress618958) { |
6990 CcTest::InitializeVM(); | 7032 CcTest::InitializeVM(); |
6991 v8::HandleScope scope(CcTest::isolate()); | 7033 v8::HandleScope scope(CcTest::isolate()); |
6992 Heap* heap = CcTest::heap(); | 7034 Heap* heap = CcTest::heap(); |
6993 bool isolate_is_locked = true; | 7035 bool isolate_is_locked = true; |
6994 heap->update_external_memory(100 * MB); | 7036 heap->update_external_memory(100 * MB); |
6995 int mark_sweep_count_before = heap->ms_count(); | 7037 int mark_sweep_count_before = heap->ms_count(); |
6996 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, | 7038 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, |
6997 isolate_is_locked); | 7039 isolate_is_locked); |
6998 int mark_sweep_count_after = heap->ms_count(); | 7040 int mark_sweep_count_after = heap->ms_count(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7085 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7127 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
7086 slots[chunk->area_end() - kPointerSize] = false; | 7128 slots[chunk->area_end() - kPointerSize] = false; |
7087 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7129 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7088 CHECK(slots[addr]); | 7130 CHECK(slots[addr]); |
7089 return KEEP_SLOT; | 7131 return KEEP_SLOT; |
7090 }); | 7132 }); |
7091 } | 7133 } |
7092 | 7134 |
7093 } // namespace internal | 7135 } // namespace internal |
7094 } // namespace v8 | 7136 } // namespace v8 |
OLD | NEW |