OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/ast/context-slot-cache.h" | 10 #include "src/ast/context-slot-cache.h" |
(...skipping 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3193 ObjectMarking::MarkBitFrom(HeapObject::FromAddress(new_start)))) { | 3193 ObjectMarking::MarkBitFrom(HeapObject::FromAddress(new_start)))) { |
3194 IncrementalMarking::TransferMark(this, object, | 3194 IncrementalMarking::TransferMark(this, object, |
3195 HeapObject::FromAddress(new_start)); | 3195 HeapObject::FromAddress(new_start)); |
3196 } | 3196 } |
3197 | 3197 |
3198 // Technically in new space this write might be omitted (except for | 3198 // Technically in new space this write might be omitted (except for |
3199 // debug mode which iterates through the heap), but to play safer | 3199 // debug mode which iterates through the heap), but to play safer |
3200 // we still do it. | 3200 // we still do it. |
3201 CreateFillerObjectAt(old_start, bytes_to_trim, ClearRecordedSlots::kYes); | 3201 CreateFillerObjectAt(old_start, bytes_to_trim, ClearRecordedSlots::kYes); |
3202 | 3202 |
3203 // Clear the mark bits of the black area that belongs now to the filler. | |
3204 // This is an optimization. The sweeper will release black fillers anyway. | |
3205 if (incremental_marking()->black_allocation() && | |
3206 Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(object))) { | |
3207 Page* page = Page::FromAddress(old_start); | |
3208 page->markbits()->ClearRange( | |
3209 page->AddressToMarkbitIndex(old_start), | |
3210 page->AddressToMarkbitIndex(old_start + bytes_to_trim)); | |
3211 } | |
3212 | |
3213 // Initialize header of the trimmed array. Since left trimming is only | 3203 // Initialize header of the trimmed array. Since left trimming is only |
3214 // performed on pages which are not concurrently swept creating a filler | 3204 // performed on pages which are not concurrently swept creating a filler |
3215 // object does not require synchronization. | 3205 // object does not require synchronization. |
3216 Object** former_start = HeapObject::RawField(object, 0); | 3206 Object** former_start = HeapObject::RawField(object, 0); |
3217 int new_start_index = elements_to_trim * (element_size / kPointerSize); | 3207 int new_start_index = elements_to_trim * (element_size / kPointerSize); |
3218 former_start[new_start_index] = map; | 3208 former_start[new_start_index] = map; |
3219 former_start[new_start_index + 1] = Smi::FromInt(len - elements_to_trim); | 3209 former_start[new_start_index + 1] = Smi::FromInt(len - elements_to_trim); |
3220 | 3210 |
3221 FixedArrayBase* new_object = | 3211 FixedArrayBase* new_object = |
3222 FixedArrayBase::cast(HeapObject::FromAddress(new_start)); | 3212 FixedArrayBase::cast(HeapObject::FromAddress(new_start)); |
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6384 } | 6374 } |
6385 | 6375 |
6386 | 6376 |
6387 // static | 6377 // static |
6388 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6378 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6389 return StaticVisitorBase::GetVisitorId(map); | 6379 return StaticVisitorBase::GetVisitorId(map); |
6390 } | 6380 } |
6391 | 6381 |
6392 } // namespace internal | 6382 } // namespace internal |
6393 } // namespace v8 | 6383 } // namespace v8 |
OLD | NEW |