| 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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 current_gc_callback_flags_); | 774 current_gc_callback_flags_); |
| 775 return; | 775 return; |
| 776 } | 776 } |
| 777 DCHECK(FLAG_overapproximate_weak_closure); | 777 DCHECK(FLAG_overapproximate_weak_closure); |
| 778 if (!incremental_marking()->weak_closure_was_overapproximated()) { | 778 if (!incremental_marking()->weak_closure_was_overapproximated()) { |
| 779 OverApproximateWeakClosure("GC interrupt"); | 779 OverApproximateWeakClosure("GC interrupt"); |
| 780 } | 780 } |
| 781 } | 781 } |
| 782 | 782 |
| 783 | 783 |
| 784 void Heap::ScheduleIdleScavengeIfNeededCallback(int bytes_allocated, |
| 785 void* arg) { |
| 786 Heap* heap = static_cast<Heap*>(arg); |
| 787 heap->ScheduleIdleScavengeIfNeeded(bytes_allocated); |
| 788 } |
| 789 |
| 790 |
| 784 void Heap::ScheduleIdleScavengeIfNeeded(int bytes_allocated) { | 791 void Heap::ScheduleIdleScavengeIfNeeded(int bytes_allocated) { |
| 785 scavenge_job_->ScheduleIdleTaskIfNeeded(this, bytes_allocated); | 792 scavenge_job_->ScheduleIdleTaskIfNeeded(this, bytes_allocated); |
| 786 } | 793 } |
| 787 | 794 |
| 788 | 795 |
| 789 void Heap::OverApproximateWeakClosure(const char* gc_reason) { | 796 void Heap::OverApproximateWeakClosure(const char* gc_reason) { |
| 790 if (FLAG_trace_incremental_marking) { | 797 if (FLAG_trace_incremental_marking) { |
| 791 PrintF("[IncrementalMarking] Overapproximate weak closure (%s).\n", | 798 PrintF("[IncrementalMarking] Overapproximate weak closure (%s).\n", |
| 792 gc_reason); | 799 gc_reason); |
| 793 } | 800 } |
| (...skipping 4170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4964 | 4971 |
| 4965 // Update inline allocation limit for old spaces. | 4972 // Update inline allocation limit for old spaces. |
| 4966 PagedSpaces spaces(this); | 4973 PagedSpaces spaces(this); |
| 4967 for (PagedSpace* space = spaces.next(); space != NULL; | 4974 for (PagedSpace* space = spaces.next(); space != NULL; |
| 4968 space = spaces.next()) { | 4975 space = spaces.next()) { |
| 4969 space->EmptyAllocationInfo(); | 4976 space->EmptyAllocationInfo(); |
| 4970 } | 4977 } |
| 4971 } | 4978 } |
| 4972 | 4979 |
| 4973 | 4980 |
| 4974 void Heap::LowerInlineAllocationLimit(intptr_t step) { | |
| 4975 new_space()->LowerInlineAllocationLimit(step); | |
| 4976 } | |
| 4977 | |
| 4978 | |
| 4979 void Heap::ResetInlineAllocationLimit() { | |
| 4980 new_space()->LowerInlineAllocationLimit( | |
| 4981 ScavengeJob::kBytesAllocatedBeforeNextIdleTask); | |
| 4982 } | |
| 4983 | |
| 4984 | |
| 4985 V8_DECLARE_ONCE(initialize_gc_once); | 4981 V8_DECLARE_ONCE(initialize_gc_once); |
| 4986 | 4982 |
| 4987 static void InitializeGCOnce() { | 4983 static void InitializeGCOnce() { |
| 4988 Scavenger::Initialize(); | 4984 Scavenger::Initialize(); |
| 4989 StaticScavengeVisitor::Initialize(); | 4985 StaticScavengeVisitor::Initialize(); |
| 4990 MarkCompactCollector::Initialize(); | 4986 MarkCompactCollector::Initialize(); |
| 4991 } | 4987 } |
| 4992 | 4988 |
| 4993 | 4989 |
| 4994 bool Heap::SetUp() { | 4990 bool Heap::SetUp() { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5083 | 5079 |
| 5084 array_buffer_tracker_ = new ArrayBufferTracker(this); | 5080 array_buffer_tracker_ = new ArrayBufferTracker(this); |
| 5085 | 5081 |
| 5086 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 5082 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
| 5087 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 5083 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
| 5088 | 5084 |
| 5089 store_buffer()->SetUp(); | 5085 store_buffer()->SetUp(); |
| 5090 | 5086 |
| 5091 mark_compact_collector()->SetUp(); | 5087 mark_compact_collector()->SetUp(); |
| 5092 | 5088 |
| 5093 ResetInlineAllocationLimit(); | 5089 new_space()->AddInlineAllocationObserver( |
| 5090 ScavengeJob::kBytesAllocatedBeforeNextIdleTask, |
| 5091 ScheduleIdleScavengeIfNeededCallback, this); |
| 5094 | 5092 |
| 5095 return true; | 5093 return true; |
| 5096 } | 5094 } |
| 5097 | 5095 |
| 5098 | 5096 |
| 5099 bool Heap::CreateHeapObjects() { | 5097 bool Heap::CreateHeapObjects() { |
| 5100 // Create initial maps. | 5098 // Create initial maps. |
| 5101 if (!CreateInitialMaps()) return false; | 5099 if (!CreateInitialMaps()) return false; |
| 5102 CreateApiObjects(); | 5100 CreateApiObjects(); |
| 5103 | 5101 |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6120 } | 6118 } |
| 6121 | 6119 |
| 6122 | 6120 |
| 6123 // static | 6121 // static |
| 6124 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6122 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6125 return StaticVisitorBase::GetVisitorId(map); | 6123 return StaticVisitorBase::GetVisitorId(map); |
| 6126 } | 6124 } |
| 6127 | 6125 |
| 6128 } // namespace internal | 6126 } // namespace internal |
| 6129 } // namespace v8 | 6127 } // namespace v8 |
| OLD | NEW |