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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 heap->old_space()->AllocateRaw(object_size, alignment); | 185 heap->old_space()->AllocateRaw(object_size, alignment); |
186 | 186 |
187 HeapObject* target = NULL; // Initialization to please compiler. | 187 HeapObject* target = NULL; // Initialization to please compiler. |
188 if (allocation.To(&target)) { | 188 if (allocation.To(&target)) { |
189 MigrateObject(heap, object, target, object_size); | 189 MigrateObject(heap, object, target, object_size); |
190 | 190 |
191 // Update slot to new target. | 191 // Update slot to new target. |
192 *slot = target; | 192 *slot = target; |
193 | 193 |
194 if (object_contents == POINTER_OBJECT) { | 194 if (object_contents == POINTER_OBJECT) { |
195 if (map->instance_type() == JS_FUNCTION_TYPE) { | 195 heap->promotion_queue()->insert(target, object_size); |
196 heap->promotion_queue()->insert(target, | |
197 JSFunction::kNonWeakFieldsEndOffset); | |
198 } else { | |
199 heap->promotion_queue()->insert(target, object_size); | |
200 } | |
201 } | 196 } |
202 heap->IncrementPromotedObjectsSize(object_size); | 197 heap->IncrementPromotedObjectsSize(object_size); |
203 return true; | 198 return true; |
204 } | 199 } |
205 return false; | 200 return false; |
206 } | 201 } |
207 | 202 |
208 | 203 |
209 template <ObjectContents object_contents, AllocationAlignment alignment> | 204 template <ObjectContents object_contents, AllocationAlignment alignment> |
210 static inline void EvacuateObject(Map* map, HeapObject** slot, | 205 static inline void EvacuateObject(Map* map, HeapObject** slot, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 477 |
483 void ScavengeVisitor::ScavengePointer(Object** p) { | 478 void ScavengeVisitor::ScavengePointer(Object** p) { |
484 Object* object = *p; | 479 Object* object = *p; |
485 if (!heap_->InNewSpace(object)) return; | 480 if (!heap_->InNewSpace(object)) return; |
486 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 481 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
487 reinterpret_cast<HeapObject*>(object)); | 482 reinterpret_cast<HeapObject*>(object)); |
488 } | 483 } |
489 | 484 |
490 } // namespace internal | 485 } // namespace internal |
491 } // namespace v8 | 486 } // namespace v8 |
OLD | NEW |