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 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 // pages is set after sweeping all pages. | 3071 // pages is set after sweeping all pages. |
3072 return !InOldSpace(object) || page->SweepingDone(); | 3072 return !InOldSpace(object) || page->SweepingDone(); |
3073 } | 3073 } |
3074 | 3074 |
3075 | 3075 |
3076 void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { | 3076 void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { |
3077 // As long as the inspected object is black and we are currently not iterating | 3077 // As long as the inspected object is black and we are currently not iterating |
3078 // the heap using HeapIterator, we can update the live byte count. We cannot | 3078 // the heap using HeapIterator, we can update the live byte count. We cannot |
3079 // update while using HeapIterator because the iterator is temporarily | 3079 // update while using HeapIterator because the iterator is temporarily |
3080 // marking the whole object graph, without updating live bytes. | 3080 // marking the whole object graph, without updating live bytes. |
3081 if (!in_heap_iterator() && | 3081 if (lo_space()->Contains(object)) { |
3082 !mark_compact_collector()->sweeping_in_progress() && | 3082 lo_space()->AdjustLiveBytes(by); |
3083 Marking::IsBlack(Marking::MarkBitFrom(object->address()))) { | 3083 } else if (!in_heap_iterator() && |
| 3084 !mark_compact_collector()->sweeping_in_progress() && |
| 3085 Marking::IsBlack(Marking::MarkBitFrom(object->address()))) { |
3084 if (mode == SEQUENTIAL_TO_SWEEPER) { | 3086 if (mode == SEQUENTIAL_TO_SWEEPER) { |
3085 MemoryChunk::IncrementLiveBytesFromGC(object, by); | 3087 MemoryChunk::IncrementLiveBytesFromGC(object, by); |
3086 } else { | 3088 } else { |
3087 MemoryChunk::IncrementLiveBytesFromMutator(object, by); | 3089 MemoryChunk::IncrementLiveBytesFromMutator(object, by); |
3088 } | 3090 } |
3089 } | 3091 } |
3090 } | 3092 } |
3091 | 3093 |
3092 | 3094 |
3093 FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object, | 3095 FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object, |
(...skipping 3253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6347 } | 6349 } |
6348 | 6350 |
6349 | 6351 |
6350 // static | 6352 // static |
6351 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6353 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6352 return StaticVisitorBase::GetVisitorId(map); | 6354 return StaticVisitorBase::GetVisitorId(map); |
6353 } | 6355 } |
6354 | 6356 |
6355 } // namespace internal | 6357 } // namespace internal |
6356 } // namespace v8 | 6358 } // namespace v8 |
OLD | NEW |