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 } |
298 } | 306 } |
299 | 307 |
300 static inline void EvacuateByteArray(Map* map, HeapObject** slot, | 308 static inline void EvacuateByteArray(Map* map, HeapObject** slot, |
301 HeapObject* object, | 309 HeapObject* object, |
302 PromotionMode promotion_mode) { | 310 PromotionMode promotion_mode) { |
303 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 311 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
304 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size, | 312 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size, |
305 promotion_mode); | 313 promotion_mode); |
306 } | 314 } |
307 | 315 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 478 |
471 void ScavengeVisitor::ScavengePointer(Object** p) { | 479 void ScavengeVisitor::ScavengePointer(Object** p) { |
472 Object* object = *p; | 480 Object* object = *p; |
473 if (!heap_->InNewSpace(object)) return; | 481 if (!heap_->InNewSpace(object)) return; |
474 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 482 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
475 reinterpret_cast<HeapObject*>(object)); | 483 reinterpret_cast<HeapObject*>(object)); |
476 } | 484 } |
477 | 485 |
478 } // namespace internal | 486 } // namespace internal |
479 } // namespace v8 | 487 } // namespace v8 |
OLD | NEW |