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/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3231 Address new_end = old_end - bytes_to_trim; | 3231 Address new_end = old_end - bytes_to_trim; |
3232 | 3232 |
3233 // Technically in new space this write might be omitted (except for | 3233 // Technically in new space this write might be omitted (except for |
3234 // debug mode which iterates through the heap), but to play safer | 3234 // debug mode which iterates through the heap), but to play safer |
3235 // we still do it. | 3235 // we still do it. |
3236 // We do not create a filler for objects in large object space. | 3236 // We do not create a filler for objects in large object space. |
3237 // TODO(hpayer): We should shrink the large object page if the size | 3237 // TODO(hpayer): We should shrink the large object page if the size |
3238 // of the object changed significantly. | 3238 // of the object changed significantly. |
3239 if (!lo_space()->Contains(object)) { | 3239 if (!lo_space()->Contains(object)) { |
3240 CreateFillerObjectAt(new_end, bytes_to_trim, ClearRecordedSlots::kYes); | 3240 CreateFillerObjectAt(new_end, bytes_to_trim, ClearRecordedSlots::kYes); |
3241 } | 3241 // Clear the mark bits of the black area that belongs now to the filler. |
3242 | 3242 // This is an optimization. The sweeper will release black fillers anyway. |
3243 // Clear the mark bits of the black area that belongs now to the filler. | 3243 if (incremental_marking()->black_allocation() && |
3244 // This is an optimization. The sweeper will release black fillers anyway. | 3244 Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(new_end))) { |
3245 if (incremental_marking()->black_allocation() && | 3245 Page* page = Page::FromAddress(new_end); |
3246 Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(new_end))) { | 3246 page->markbits()->ClearRange( |
3247 Page* page = Page::FromAddress(new_end); | 3247 page->AddressToMarkbitIndex(new_end), |
3248 page->markbits()->ClearRange( | 3248 page->AddressToMarkbitIndex(new_end + bytes_to_trim)); |
3249 page->AddressToMarkbitIndex(new_end), | 3249 } |
3250 page->AddressToMarkbitIndex(new_end + bytes_to_trim)); | |
3251 } | 3250 } |
3252 | 3251 |
3253 // Initialize header of the trimmed array. We are storing the new length | 3252 // Initialize header of the trimmed array. We are storing the new length |
3254 // using release store after creating a filler for the left-over space to | 3253 // using release store after creating a filler for the left-over space to |
3255 // avoid races with the sweeper thread. | 3254 // avoid races with the sweeper thread. |
3256 object->synchronized_set_length(len - elements_to_trim); | 3255 object->synchronized_set_length(len - elements_to_trim); |
3257 | 3256 |
3258 // Maintain consistency of live bytes during incremental marking | 3257 // Maintain consistency of live bytes during incremental marking |
3259 AdjustLiveBytes(object, -bytes_to_trim); | 3258 AdjustLiveBytes(object, -bytes_to_trim); |
3260 | 3259 |
(...skipping 3254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6515 } | 6514 } |
6516 | 6515 |
6517 | 6516 |
6518 // static | 6517 // static |
6519 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6518 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6520 return StaticVisitorBase::GetVisitorId(map); | 6519 return StaticVisitorBase::GetVisitorId(map); |
6521 } | 6520 } |
6522 | 6521 |
6523 } // namespace internal | 6522 } // namespace internal |
6524 } // namespace v8 | 6523 } // namespace v8 |
OLD | NEW |