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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 HeapObject* object) { | 260 HeapObject* object) { |
261 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 261 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
262 int object_size = FixedDoubleArray::SizeFor(length); | 262 int object_size = FixedDoubleArray::SizeFor(length); |
263 EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size); | 263 EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 static inline void EvacuateFixedTypedArray(Map* map, HeapObject** slot, | 267 static inline void EvacuateFixedTypedArray(Map* map, HeapObject** slot, |
268 HeapObject* object) { | 268 HeapObject* object) { |
269 int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size(); | 269 int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size(); |
270 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size); | 270 EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object, |
271 | 271 object_size); |
272 MapWord map_word = object->map_word(); | |
273 DCHECK(map_word.IsForwardingAddress()); | |
274 FixedTypedArrayBase* target = | |
275 reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress()); | |
276 if (target->base_pointer() != Smi::FromInt(0)) | |
277 target->set_base_pointer(target, SKIP_WRITE_BARRIER); | |
278 } | 272 } |
279 | 273 |
280 | 274 |
281 static inline void EvacuateFixedFloat64Array(Map* map, HeapObject** slot, | 275 static inline void EvacuateFixedFloat64Array(Map* map, HeapObject** slot, |
282 HeapObject* object) { | 276 HeapObject* object) { |
283 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); | 277 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); |
284 EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size); | 278 EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object, |
285 | 279 object_size); |
286 MapWord map_word = object->map_word(); | |
287 DCHECK(map_word.IsForwardingAddress()); | |
288 FixedTypedArrayBase* target = | |
289 reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress()); | |
290 if (target->base_pointer() != Smi::FromInt(0)) | |
291 target->set_base_pointer(target, SKIP_WRITE_BARRIER); | |
292 } | 280 } |
293 | 281 |
294 | 282 |
295 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, | 283 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, |
296 HeapObject* object) { | 284 HeapObject* object) { |
297 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); | 285 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); |
298 | 286 |
299 Heap* heap = map->GetHeap(); | 287 Heap* heap = map->GetHeap(); |
300 MapWord map_word = object->map_word(); | 288 MapWord map_word = object->map_word(); |
301 DCHECK(map_word.IsForwardingAddress()); | 289 DCHECK(map_word.IsForwardingAddress()); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 459 |
472 void ScavengeVisitor::ScavengePointer(Object** p) { | 460 void ScavengeVisitor::ScavengePointer(Object** p) { |
473 Object* object = *p; | 461 Object* object = *p; |
474 if (!heap_->InNewSpace(object)) return; | 462 if (!heap_->InNewSpace(object)) return; |
475 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 463 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
476 reinterpret_cast<HeapObject*>(object)); | 464 reinterpret_cast<HeapObject*>(object)); |
477 } | 465 } |
478 | 466 |
479 } // namespace internal | 467 } // namespace internal |
480 } // namespace v8 | 468 } // namespace v8 |
OLD | NEW |