| 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 3065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 bool Heap::CanMoveObjectStart(HeapObject* object) { | 3076 bool Heap::CanMoveObjectStart(HeapObject* object) { |
| 3077 if (!FLAG_move_object_start) return false; | 3077 if (!FLAG_move_object_start) return false; |
| 3078 | 3078 |
| 3079 // Sampling heap profiler may have a reference to the object. | 3079 // Sampling heap profiler may have a reference to the object. |
| 3080 if (isolate()->heap_profiler()->is_sampling_allocations()) return false; | 3080 if (isolate()->heap_profiler()->is_sampling_allocations()) return false; |
| 3081 | 3081 |
| 3082 Address address = object->address(); | 3082 Address address = object->address(); |
| 3083 | 3083 |
| 3084 if (lo_space()->Contains(object)) return false; | 3084 if (lo_space()->Contains(object)) return false; |
| 3085 | 3085 |
| 3086 Page* page = Page::FromAddress(address); | 3086 // We can move the object start if the page was already swept. |
| 3087 // We can move the object start if: | 3087 return Page::FromAddress(address)->SweepingDone(); |
| 3088 // (1) the object is not in old space, | |
| 3089 // (2) the page of the object was already swept, | |
| 3090 // (3) the page was already concurrently swept. This case is an optimization | |
| 3091 // for concurrent sweeping. The WasSwept predicate for concurrently swept | |
| 3092 // pages is set after sweeping all pages. | |
| 3093 return !InOldSpace(object) || page->SweepingDone(); | |
| 3094 } | 3088 } |
| 3095 | 3089 |
| 3096 | 3090 |
| 3097 void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { | 3091 void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { |
| 3098 // As long as the inspected object is black and we are currently not iterating | 3092 // As long as the inspected object is black and we are currently not iterating |
| 3099 // the heap using HeapIterator, we can update the live byte count. We cannot | 3093 // the heap using HeapIterator, we can update the live byte count. We cannot |
| 3100 // update while using HeapIterator because the iterator is temporarily | 3094 // update while using HeapIterator because the iterator is temporarily |
| 3101 // marking the whole object graph, without updating live bytes. | 3095 // marking the whole object graph, without updating live bytes. |
| 3102 if (lo_space()->Contains(object)) { | 3096 if (lo_space()->Contains(object)) { |
| 3103 lo_space()->AdjustLiveBytes(by); | 3097 lo_space()->AdjustLiveBytes(by); |
| (...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6438 } | 6432 } |
| 6439 | 6433 |
| 6440 | 6434 |
| 6441 // static | 6435 // static |
| 6442 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6436 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6443 return StaticVisitorBase::GetVisitorId(map); | 6437 return StaticVisitorBase::GetVisitorId(map); |
| 6444 } | 6438 } |
| 6445 | 6439 |
| 6446 } // namespace internal | 6440 } // namespace internal |
| 6447 } // namespace v8 | 6441 } // namespace v8 |
| OLD | NEW |