| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 AllocationResult allocation = | 153 AllocationResult allocation = |
| 154 heap->new_space()->AllocateRaw(object_size, alignment); | 154 heap->new_space()->AllocateRaw(object_size, alignment); |
| 155 | 155 |
| 156 HeapObject* target = NULL; // Initialization to please compiler. | 156 HeapObject* target = NULL; // Initialization to please compiler. |
| 157 if (allocation.To(&target)) { | 157 if (allocation.To(&target)) { |
| 158 // Order is important here: Set the promotion limit before storing a | 158 // Order is important here: Set the promotion limit before storing a |
| 159 // filler for double alignment or migrating the object. Otherwise we | 159 // filler for double alignment or migrating the object. Otherwise we |
| 160 // may end up overwriting promotion queue entries when we migrate the | 160 // may end up overwriting promotion queue entries when we migrate the |
| 161 // object. | 161 // object. |
| 162 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); | 162 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); |
| 163 | |
| 164 MigrateObject(heap, object, target, object_size); | 163 MigrateObject(heap, object, target, object_size); |
| 165 | 164 |
| 166 // Update slot to new target. | 165 // Update slot to new target. |
| 167 *slot = target; | 166 *slot = target; |
| 168 | 167 |
| 169 heap->IncrementSemiSpaceCopiedObjectSize(object_size); | 168 heap->IncrementSemiSpaceCopiedObjectSize(object_size); |
| 170 return true; | 169 return true; |
| 171 } | 170 } |
| 172 return false; | 171 return false; |
| 173 } | 172 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 void ScavengeVisitor::ScavengePointer(Object** p) { | 438 void ScavengeVisitor::ScavengePointer(Object** p) { |
| 440 Object* object = *p; | 439 Object* object = *p; |
| 441 if (!heap_->InNewSpace(object)) return; | 440 if (!heap_->InNewSpace(object)) return; |
| 442 | 441 |
| 443 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 442 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
| 444 reinterpret_cast<HeapObject*>(object)); | 443 reinterpret_cast<HeapObject*>(object)); |
| 445 } | 444 } |
| 446 | 445 |
| 447 } // namespace internal | 446 } // namespace internal |
| 448 } // namespace v8 | 447 } // namespace v8 |
| OLD | NEW |