| 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 6905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6916 heap->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(*array, i); | 6916 heap->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(*array, i); |
| 6917 HeapObject* filler = HeapObject::FromAddress(previous); | 6917 HeapObject* filler = HeapObject::FromAddress(previous); |
| 6918 CHECK(filler->IsFiller()); | 6918 CHECK(filler->IsFiller()); |
| 6919 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); | 6919 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); |
| 6920 } | 6920 } |
| 6921 } | 6921 } |
| 6922 | 6922 |
| 6923 heap::GcAndSweep(heap, OLD_SPACE); | 6923 heap::GcAndSweep(heap, OLD_SPACE); |
| 6924 } | 6924 } |
| 6925 | 6925 |
| 6926 TEST(SlotFilteringAfterBlackAreas) { | |
| 6927 FLAG_black_allocation = true; | |
| 6928 CcTest::InitializeVM(); | |
| 6929 v8::HandleScope scope(CcTest::isolate()); | |
| 6930 Heap* heap = CcTest::heap(); | |
| 6931 Isolate* isolate = heap->isolate(); | |
| 6932 MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector(); | |
| 6933 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | |
| 6934 | |
| 6935 i::MarkCompactCollector* collector = heap->mark_compact_collector(); | |
| 6936 i::IncrementalMarking* marking = heap->incremental_marking(); | |
| 6937 if (collector->sweeping_in_progress()) { | |
| 6938 collector->EnsureSweepingCompleted(); | |
| 6939 } | |
| 6940 CHECK(marking->IsMarking() || marking->IsStopped()); | |
| 6941 if (marking->IsStopped()) { | |
| 6942 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, | |
| 6943 i::GarbageCollectionReason::kTesting); | |
| 6944 } | |
| 6945 CHECK(marking->IsMarking()); | |
| 6946 marking->StartBlackAllocationForTesting(); | |
| 6947 | |
| 6948 // Ensure that we allocate a new page, set up a bump pointer area, and | |
| 6949 // perform the allocation in a black area. | |
| 6950 heap::SimulateFullSpace(heap->old_space()); | |
| 6951 Handle<FixedArray> array = isolate->factory()->NewFixedArray(10, TENURED); | |
| 6952 Page* page = Page::FromAddress(array->address()); | |
| 6953 | |
| 6954 // After allocation we empty the allocation info to limit the black area | |
| 6955 // only on the allocated array. | |
| 6956 heap->old_space()->EmptyAllocationInfo(); | |
| 6957 | |
| 6958 // Slots in the black area are part of the black object. | |
| 6959 CHECK(mark_compact_collector->IsSlotInBlackObject(page, array->address())); | |
| 6960 CHECK(mark_compact_collector->IsSlotInBlackObject( | |
| 6961 page, array->address() + array->Size() - kPointerSize)); | |
| 6962 | |
| 6963 // Slots after the black area are not part of the black object and have to | |
| 6964 // be filtered out. | |
| 6965 CHECK(!mark_compact_collector->IsSlotInBlackObject( | |
| 6966 page, array->address() + array->Size())); | |
| 6967 } | |
| 6968 | |
| 6969 TEST(Regress618958) { | 6926 TEST(Regress618958) { |
| 6970 CcTest::InitializeVM(); | 6927 CcTest::InitializeVM(); |
| 6971 v8::HandleScope scope(CcTest::isolate()); | 6928 v8::HandleScope scope(CcTest::isolate()); |
| 6972 Heap* heap = CcTest::heap(); | 6929 Heap* heap = CcTest::heap(); |
| 6973 bool isolate_is_locked = true; | 6930 bool isolate_is_locked = true; |
| 6974 heap->update_external_memory(100 * MB); | 6931 heap->update_external_memory(100 * MB); |
| 6975 int mark_sweep_count_before = heap->ms_count(); | 6932 int mark_sweep_count_before = heap->ms_count(); |
| 6976 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, | 6933 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, |
| 6977 isolate_is_locked); | 6934 isolate_is_locked); |
| 6978 int mark_sweep_count_after = heap->ms_count(); | 6935 int mark_sweep_count_after = heap->ms_count(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7069 SlotSet::FREE_EMPTY_BUCKETS); | 7026 SlotSet::FREE_EMPTY_BUCKETS); |
| 7070 slots[chunk->area_end() - kPointerSize] = false; | 7027 slots[chunk->area_end() - kPointerSize] = false; |
| 7071 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7028 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
| 7072 CHECK(slots[addr]); | 7029 CHECK(slots[addr]); |
| 7073 return KEEP_SLOT; | 7030 return KEEP_SLOT; |
| 7074 }); | 7031 }); |
| 7075 } | 7032 } |
| 7076 | 7033 |
| 7077 } // namespace internal | 7034 } // namespace internal |
| 7078 } // namespace v8 | 7035 } // namespace v8 |
| OLD | NEW |