| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/heap.h" | 5 #include "src/heap/heap.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3115 bool Heap::CanMoveObjectStart(HeapObject* object) { | 3115 bool Heap::CanMoveObjectStart(HeapObject* object) { |
| 3116 if (!FLAG_move_object_start) return false; | 3116 if (!FLAG_move_object_start) return false; |
| 3117 | 3117 |
| 3118 // Sampling heap profiler may have a reference to the object. | 3118 // Sampling heap profiler may have a reference to the object. |
| 3119 if (isolate()->heap_profiler()->is_sampling_allocations()) return false; | 3119 if (isolate()->heap_profiler()->is_sampling_allocations()) return false; |
| 3120 | 3120 |
| 3121 Address address = object->address(); | 3121 Address address = object->address(); |
| 3122 | 3122 |
| 3123 if (lo_space()->Contains(object)) return false; | 3123 if (lo_space()->Contains(object)) return false; |
| 3124 | 3124 |
| 3125 Page* page = Page::FromAddress(address); | 3125 // We can move the object start if the page was already swept. |
| 3126 // We can move the object start if: | 3126 return Page::FromAddress(address)->SweepingDone(); |
| 3127 // (1) the object is not in old space, | |
| 3128 // (2) the page of the object was already swept, | |
| 3129 // (3) the page was already concurrently swept. This case is an optimization | |
| 3130 // for concurrent sweeping. The WasSwept predicate for concurrently swept | |
| 3131 // pages is set after sweeping all pages. | |
| 3132 return !InOldSpace(object) || page->SweepingDone(); | |
| 3133 } | 3127 } |
| 3134 | 3128 |
| 3135 | 3129 |
| 3136 void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { | 3130 void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { |
| 3137 // As long as the inspected object is black and we are currently not iterating | 3131 // As long as the inspected object is black and we are currently not iterating |
| 3138 // the heap using HeapIterator, we can update the live byte count. We cannot | 3132 // the heap using HeapIterator, we can update the live byte count. We cannot |
| 3139 // update while using HeapIterator because the iterator is temporarily | 3133 // update while using HeapIterator because the iterator is temporarily |
| 3140 // marking the whole object graph, without updating live bytes. | 3134 // marking the whole object graph, without updating live bytes. |
| 3141 if (lo_space()->Contains(object)) { | 3135 if (lo_space()->Contains(object)) { |
| 3142 lo_space()->AdjustLiveBytes(by); | 3136 lo_space()->AdjustLiveBytes(by); |
| (...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6381 } | 6375 } |
| 6382 | 6376 |
| 6383 | 6377 |
| 6384 // static | 6378 // static |
| 6385 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6379 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6386 return StaticVisitorBase::GetVisitorId(map); | 6380 return StaticVisitorBase::GetVisitorId(map); |
| 6387 } | 6381 } |
| 6388 | 6382 |
| 6389 } // namespace internal | 6383 } // namespace internal |
| 6390 } // namespace v8 | 6384 } // namespace v8 |
| OLD | NEW |