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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 HeapObject* object) { | 282 HeapObject* object) { |
283 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); | 283 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); |
284 EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object, | 284 EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object, |
285 object_size); | 285 object_size); |
286 } | 286 } |
287 | 287 |
288 | 288 |
289 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, | 289 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, |
290 HeapObject* object) { | 290 HeapObject* object) { |
291 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); | 291 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); |
| 292 |
| 293 Heap* heap = map->GetHeap(); |
| 294 MapWord map_word = object->map_word(); |
| 295 DCHECK(map_word.IsForwardingAddress()); |
| 296 HeapObject* target = map_word.ToForwardingAddress(); |
| 297 if (!heap->InNewSpace(target)) { |
| 298 heap->array_buffer_tracker()->Promote(JSArrayBuffer::cast(target)); |
| 299 } |
292 } | 300 } |
293 | 301 |
294 | 302 |
295 static inline void EvacuateByteArray(Map* map, HeapObject** slot, | 303 static inline void EvacuateByteArray(Map* map, HeapObject** slot, |
296 HeapObject* object) { | 304 HeapObject* object) { |
297 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 305 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
298 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size); | 306 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size); |
299 } | 307 } |
300 | 308 |
301 | 309 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 465 |
458 void ScavengeVisitor::ScavengePointer(Object** p) { | 466 void ScavengeVisitor::ScavengePointer(Object** p) { |
459 Object* object = *p; | 467 Object* object = *p; |
460 if (!heap_->InNewSpace(object)) return; | 468 if (!heap_->InNewSpace(object)) return; |
461 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 469 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
462 reinterpret_cast<HeapObject*>(object)); | 470 reinterpret_cast<HeapObject*>(object)); |
463 } | 471 } |
464 | 472 |
465 } // namespace internal | 473 } // namespace internal |
466 } // namespace v8 | 474 } // namespace v8 |
OLD | NEW |