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/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 // object does not require synchronization. | 3136 // object does not require synchronization. |
3137 DCHECK(CanMoveObjectStart(object)); | 3137 DCHECK(CanMoveObjectStart(object)); |
3138 Object** former_start = HeapObject::RawField(object, 0); | 3138 Object** former_start = HeapObject::RawField(object, 0); |
3139 int new_start_index = elements_to_trim * (element_size / kPointerSize); | 3139 int new_start_index = elements_to_trim * (element_size / kPointerSize); |
3140 former_start[new_start_index] = map; | 3140 former_start[new_start_index] = map; |
3141 former_start[new_start_index + 1] = Smi::FromInt(len - elements_to_trim); | 3141 former_start[new_start_index + 1] = Smi::FromInt(len - elements_to_trim); |
3142 FixedArrayBase* new_object = | 3142 FixedArrayBase* new_object = |
3143 FixedArrayBase::cast(HeapObject::FromAddress(new_start)); | 3143 FixedArrayBase::cast(HeapObject::FromAddress(new_start)); |
3144 | 3144 |
3145 // Remove recorded slots for the new map and length offset. | 3145 // Remove recorded slots for the new map and length offset. |
3146 ClearRecordedSlot(new_object, HeapObject::RawField(new_object, 0)); | 3146 ClearRecordedSlot(new_object, HeapObject::RawField(object, 0)); |
3147 ClearRecordedSlot(new_object, HeapObject::RawField( | 3147 ClearRecordedSlot( |
3148 new_object, FixedArrayBase::kLengthOffset)); | 3148 new_object, HeapObject::RawField(object, FixedArrayBase::kLengthOffset)); |
3149 | 3149 |
3150 // Maintain consistency of live bytes during incremental marking | 3150 // Maintain consistency of live bytes during incremental marking |
3151 Marking::TransferMark(this, object->address(), new_start); | 3151 Marking::TransferMark(this, object->address(), new_start); |
3152 AdjustLiveBytes(new_object, -bytes_to_trim, Heap::CONCURRENT_TO_SWEEPER); | 3152 AdjustLiveBytes(new_object, -bytes_to_trim, Heap::CONCURRENT_TO_SWEEPER); |
3153 | 3153 |
3154 // Notify the heap profiler of change in object layout. | 3154 // Notify the heap profiler of change in object layout. |
3155 OnMoveEvent(new_object, object, new_object->Size()); | 3155 OnMoveEvent(new_object, object, new_object->Size()); |
3156 return new_object; | 3156 return new_object; |
3157 } | 3157 } |
3158 | 3158 |
(...skipping 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6355 } | 6355 } |
6356 | 6356 |
6357 | 6357 |
6358 // static | 6358 // static |
6359 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6359 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6360 return StaticVisitorBase::GetVisitorId(map); | 6360 return StaticVisitorBase::GetVisitorId(map); |
6361 } | 6361 } |
6362 | 6362 |
6363 } // namespace internal | 6363 } // namespace internal |
6364 } // namespace v8 | 6364 } // namespace v8 |
OLD | NEW |