Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/spaces.h" | 5 #include "src/heap/spaces.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 2972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2983 reinterpret_cast<Object**>(object->address())[0] = | 2983 reinterpret_cast<Object**>(object->address())[0] = |
| 2984 heap()->fixed_array_map(); | 2984 heap()->fixed_array_map(); |
| 2985 reinterpret_cast<Object**>(object->address())[1] = Smi::kZero; | 2985 reinterpret_cast<Object**>(object->address())[1] = Smi::kZero; |
| 2986 } | 2986 } |
| 2987 | 2987 |
| 2988 heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags, | 2988 heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags, |
| 2989 kNoGCCallbackFlags); | 2989 kNoGCCallbackFlags); |
| 2990 AllocationStep(object->address(), object_size); | 2990 AllocationStep(object->address(), object_size); |
| 2991 | 2991 |
| 2992 if (heap()->incremental_marking()->black_allocation()) { | 2992 if (heap()->incremental_marking()->black_allocation()) { |
| 2993 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object)); | 2993 // We cannot use ObjectMarking here as the object still lacks a size. |
|
Hannes Payer (out of office)
2017/01/18 14:43:35
This one is really unfortunate. However, we do not
Michael Lippautz
2017/01/18 15:58:07
Acknowledged.
| |
| 2994 Marking::WhiteToBlack(ObjectMarking::MarkBitFrom(object)); | |
| 2994 MemoryChunk::IncrementLiveBytes(object, object_size); | 2995 MemoryChunk::IncrementLiveBytes(object, object_size); |
| 2995 } | 2996 } |
| 2996 return object; | 2997 return object; |
| 2997 } | 2998 } |
| 2998 | 2999 |
| 2999 | 3000 |
| 3000 size_t LargeObjectSpace::CommittedPhysicalMemory() { | 3001 size_t LargeObjectSpace::CommittedPhysicalMemory() { |
| 3001 // On a platform that provides lazy committing of memory, we over-account | 3002 // On a platform that provides lazy committing of memory, we over-account |
| 3002 // the actually committed memory. There is no easy way right now to support | 3003 // the actually committed memory. There is no easy way right now to support |
| 3003 // precise accounting of committed memory in large object space. | 3004 // precise accounting of committed memory in large object space. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 3032 } | 3033 } |
| 3033 } | 3034 } |
| 3034 return NULL; | 3035 return NULL; |
| 3035 } | 3036 } |
| 3036 | 3037 |
| 3037 | 3038 |
| 3038 void LargeObjectSpace::ClearMarkingStateOfLiveObjects() { | 3039 void LargeObjectSpace::ClearMarkingStateOfLiveObjects() { |
| 3039 LargePage* current = first_page_; | 3040 LargePage* current = first_page_; |
| 3040 while (current != NULL) { | 3041 while (current != NULL) { |
| 3041 HeapObject* object = current->GetObject(); | 3042 HeapObject* object = current->GetObject(); |
| 3042 MarkBit mark_bit = ObjectMarking::MarkBitFrom(object); | 3043 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(object))); |
| 3043 DCHECK(Marking::IsBlack(mark_bit)); | 3044 ObjectMarking::BlackToWhite(object); |
| 3044 Marking::BlackToWhite(mark_bit); | |
| 3045 Page::FromAddress(object->address())->ResetProgressBar(); | 3045 Page::FromAddress(object->address())->ResetProgressBar(); |
| 3046 Page::FromAddress(object->address())->ResetLiveBytes(); | 3046 Page::FromAddress(object->address())->ResetLiveBytes(); |
| 3047 current = current->next_page(); | 3047 current = current->next_page(); |
| 3048 } | 3048 } |
| 3049 } | 3049 } |
| 3050 | 3050 |
| 3051 void LargeObjectSpace::InsertChunkMapEntries(LargePage* page) { | 3051 void LargeObjectSpace::InsertChunkMapEntries(LargePage* page) { |
| 3052 // Register all MemoryChunk::kAlignment-aligned chunks covered by | 3052 // Register all MemoryChunk::kAlignment-aligned chunks covered by |
| 3053 // this large page in the chunk map. | 3053 // this large page in the chunk map. |
| 3054 uintptr_t start = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; | 3054 uintptr_t start = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3229 object->ShortPrint(); | 3229 object->ShortPrint(); |
| 3230 PrintF("\n"); | 3230 PrintF("\n"); |
| 3231 } | 3231 } |
| 3232 printf(" --------------------------------------\n"); | 3232 printf(" --------------------------------------\n"); |
| 3233 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3233 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3234 } | 3234 } |
| 3235 | 3235 |
| 3236 #endif // DEBUG | 3236 #endif // DEBUG |
| 3237 } // namespace internal | 3237 } // namespace internal |
| 3238 } // namespace v8 | 3238 } // namespace v8 |
| OLD | NEW |