| 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 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2609 | 2609 |
| 2610 // The old-space-step might have finished sweeping and restarted marking. | 2610 // The old-space-step might have finished sweeping and restarted marking. |
| 2611 // Verify that it did not turn the page of the new node into an evacuation | 2611 // Verify that it did not turn the page of the new node into an evacuation |
| 2612 // candidate. | 2612 // candidate. |
| 2613 DCHECK(!MarkCompactCollector::IsOnEvacuationCandidate(new_node)); | 2613 DCHECK(!MarkCompactCollector::IsOnEvacuationCandidate(new_node)); |
| 2614 | 2614 |
| 2615 const size_t kThreshold = IncrementalMarking::kAllocatedThreshold; | 2615 const size_t kThreshold = IncrementalMarking::kAllocatedThreshold; |
| 2616 | 2616 |
| 2617 // Memory in the linear allocation area is counted as allocated. We may free | 2617 // Memory in the linear allocation area is counted as allocated. We may free |
| 2618 // a little of this again immediately - see below. | 2618 // a little of this again immediately - see below. |
| 2619 owner_->Allocate(static_cast<int>(new_node_size)); | 2619 owner_->AccountAllocatedBytes(new_node_size); |
| 2620 | 2620 |
| 2621 if (owner_->heap()->inline_allocation_disabled()) { | 2621 if (owner_->heap()->inline_allocation_disabled()) { |
| 2622 // Keep the linear allocation area empty if requested to do so, just | 2622 // Keep the linear allocation area empty if requested to do so, just |
| 2623 // return area back to the free list instead. | 2623 // return area back to the free list instead. |
| 2624 owner_->Free(new_node->address() + size_in_bytes, bytes_left); | 2624 owner_->Free(new_node->address() + size_in_bytes, bytes_left); |
| 2625 owner_->SetAllocationInfo(new_node->address() + size_in_bytes, | 2625 owner_->SetAllocationInfo(new_node->address() + size_in_bytes, |
| 2626 new_node->address() + size_in_bytes); | 2626 new_node->address() + size_in_bytes); |
| 2627 } else if (bytes_left > kThreshold && | 2627 } else if (bytes_left > kThreshold && |
| 2628 owner_->heap()->incremental_marking()->IsMarkingIncomplete() && | 2628 owner_->heap()->incremental_marking()->IsMarkingIncomplete() && |
| 2629 FLAG_incremental_marking) { | 2629 FLAG_incremental_marking) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3002 heap()->fixed_array_map(); | 3002 heap()->fixed_array_map(); |
| 3003 reinterpret_cast<Object**>(object->address())[1] = Smi::kZero; | 3003 reinterpret_cast<Object**>(object->address())[1] = Smi::kZero; |
| 3004 } | 3004 } |
| 3005 | 3005 |
| 3006 heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags, | 3006 heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags, |
| 3007 kNoGCCallbackFlags); | 3007 kNoGCCallbackFlags); |
| 3008 AllocationStep(object->address(), object_size); | 3008 AllocationStep(object->address(), object_size); |
| 3009 | 3009 |
| 3010 if (heap()->incremental_marking()->black_allocation()) { | 3010 if (heap()->incremental_marking()->black_allocation()) { |
| 3011 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object)); | 3011 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object)); |
| 3012 MemoryChunk::IncrementLiveBytesFromGC(object, object_size); | 3012 MemoryChunk::IncrementLiveBytes(object, object_size); |
| 3013 } | 3013 } |
| 3014 return object; | 3014 return object; |
| 3015 } | 3015 } |
| 3016 | 3016 |
| 3017 | 3017 |
| 3018 size_t LargeObjectSpace::CommittedPhysicalMemory() { | 3018 size_t LargeObjectSpace::CommittedPhysicalMemory() { |
| 3019 // On a platform that provides lazy committing of memory, we over-account | 3019 // On a platform that provides lazy committing of memory, we over-account |
| 3020 // the actually committed memory. There is no easy way right now to support | 3020 // the actually committed memory. There is no easy way right now to support |
| 3021 // precise accounting of committed memory in large object space. | 3021 // precise accounting of committed memory in large object space. |
| 3022 return CommittedMemory(); | 3022 return CommittedMemory(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 object->ShortPrint(); | 3247 object->ShortPrint(); |
| 3248 PrintF("\n"); | 3248 PrintF("\n"); |
| 3249 } | 3249 } |
| 3250 printf(" --------------------------------------\n"); | 3250 printf(" --------------------------------------\n"); |
| 3251 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3251 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3252 } | 3252 } |
| 3253 | 3253 |
| 3254 #endif // DEBUG | 3254 #endif // DEBUG |
| 3255 } // namespace internal | 3255 } // namespace internal |
| 3256 } // namespace v8 | 3256 } // namespace v8 |
| OLD | NEW |