OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/scavenger.h" | 5 #include "src/heap/scavenger.h" |
6 | 6 |
7 #include "src/contexts.h" | 7 #include "src/contexts.h" |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/heap/objects-visiting-inl.h" | 9 #include "src/heap/objects-visiting-inl.h" |
10 #include "src/heap/scavenger-inl.h" | 10 #include "src/heap/scavenger-inl.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); | 288 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); |
289 EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object, | 289 EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object, |
290 object_size, promotion_mode); | 290 object_size, promotion_mode); |
291 } | 291 } |
292 | 292 |
293 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, | 293 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, |
294 HeapObject* object, | 294 HeapObject* object, |
295 PromotionMode promotion_mode) { | 295 PromotionMode promotion_mode) { |
296 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object, | 296 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object, |
297 promotion_mode); | 297 promotion_mode); |
298 | |
299 Heap* heap = map->GetHeap(); | |
300 MapWord map_word = object->map_word(); | |
301 DCHECK(map_word.IsForwardingAddress()); | |
302 HeapObject* target = map_word.ToForwardingAddress(); | |
303 if (!heap->InNewSpace(target)) { | |
304 heap->array_buffer_tracker()->Promote(JSArrayBuffer::cast(target)); | |
305 } | |
306 } | 298 } |
307 | 299 |
308 static inline void EvacuateByteArray(Map* map, HeapObject** slot, | 300 static inline void EvacuateByteArray(Map* map, HeapObject** slot, |
309 HeapObject* object, | 301 HeapObject* object, |
310 PromotionMode promotion_mode) { | 302 PromotionMode promotion_mode) { |
311 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 303 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
312 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size, | 304 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size, |
313 promotion_mode); | 305 promotion_mode); |
314 } | 306 } |
315 | 307 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 470 |
479 void ScavengeVisitor::ScavengePointer(Object** p) { | 471 void ScavengeVisitor::ScavengePointer(Object** p) { |
480 Object* object = *p; | 472 Object* object = *p; |
481 if (!heap_->InNewSpace(object)) return; | 473 if (!heap_->InNewSpace(object)) return; |
482 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 474 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
483 reinterpret_cast<HeapObject*>(object)); | 475 reinterpret_cast<HeapObject*>(object)); |
484 } | 476 } |
485 | 477 |
486 } // namespace internal | 478 } // namespace internal |
487 } // namespace v8 | 479 } // namespace v8 |
OLD | NEW |