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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 84 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
85 // Variables set based on semispace_size_ and old_generation_size_ in | 85 // Variables set based on semispace_size_ and old_generation_size_ in |
86 // ConfigureHeap. | 86 // ConfigureHeap. |
87 // Will be 4 * reserved_semispace_size_ to ensure that young | 87 // Will be 4 * reserved_semispace_size_ to ensure that young |
88 // generation can be aligned to its size. | 88 // generation can be aligned to its size. |
89 maximum_committed_(0), | 89 maximum_committed_(0), |
90 survived_since_last_expansion_(0), | 90 survived_since_last_expansion_(0), |
91 survived_last_scavenge_(0), | 91 survived_last_scavenge_(0), |
92 always_allocate_scope_count_(0), | 92 always_allocate_scope_count_(0), |
93 contexts_disposed_(0), | 93 contexts_disposed_(0), |
| 94 number_of_disposed_maps_(0), |
94 global_ic_age_(0), | 95 global_ic_age_(0), |
95 scan_on_scavenge_pages_(0), | 96 scan_on_scavenge_pages_(0), |
96 new_space_(this), | 97 new_space_(this), |
97 old_space_(NULL), | 98 old_space_(NULL), |
98 code_space_(NULL), | 99 code_space_(NULL), |
99 map_space_(NULL), | 100 map_space_(NULL), |
100 lo_space_(NULL), | 101 lo_space_(NULL), |
101 gc_state_(NOT_IN_GC), | 102 gc_state_(NOT_IN_GC), |
102 gc_post_processing_depth_(0), | 103 gc_post_processing_depth_(0), |
103 allocations_count_(0), | 104 allocations_count_(0), |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 MemoryReducer::Event event; | 1031 MemoryReducer::Event event; |
1031 event.type = MemoryReducer::kContextDisposed; | 1032 event.type = MemoryReducer::kContextDisposed; |
1032 event.time_ms = MonotonicallyIncreasingTimeInMs(); | 1033 event.time_ms = MonotonicallyIncreasingTimeInMs(); |
1033 memory_reducer_->NotifyContextDisposed(event); | 1034 memory_reducer_->NotifyContextDisposed(event); |
1034 } | 1035 } |
1035 if (isolate()->concurrent_recompilation_enabled()) { | 1036 if (isolate()->concurrent_recompilation_enabled()) { |
1036 // Flush the queued recompilation tasks. | 1037 // Flush the queued recompilation tasks. |
1037 isolate()->optimizing_compile_dispatcher()->Flush(); | 1038 isolate()->optimizing_compile_dispatcher()->Flush(); |
1038 } | 1039 } |
1039 AgeInlineCaches(); | 1040 AgeInlineCaches(); |
1040 set_retained_maps(ArrayList::cast(empty_fixed_array())); | 1041 number_of_disposed_maps_ = retained_maps()->Length(); |
1041 tracer()->AddContextDisposalTime(MonotonicallyIncreasingTimeInMs()); | 1042 tracer()->AddContextDisposalTime(MonotonicallyIncreasingTimeInMs()); |
1042 return ++contexts_disposed_; | 1043 return ++contexts_disposed_; |
1043 } | 1044 } |
1044 | 1045 |
1045 | 1046 |
1046 void Heap::StartIncrementalMarking(int gc_flags, | 1047 void Heap::StartIncrementalMarking(int gc_flags, |
1047 const GCCallbackFlags gc_callback_flags, | 1048 const GCCallbackFlags gc_callback_flags, |
1048 const char* reason) { | 1049 const char* reason) { |
1049 DCHECK(incremental_marking()->IsStopped()); | 1050 DCHECK(incremental_marking()->IsStopped()); |
1050 set_current_gc_flags(gc_flags); | 1051 set_current_gc_flags(gc_flags); |
(...skipping 4308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5359 | 5360 |
5360 | 5361 |
5361 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { | 5362 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { |
5362 Object* dep = weak_object_to_code_table()->Lookup(obj); | 5363 Object* dep = weak_object_to_code_table()->Lookup(obj); |
5363 if (dep->IsDependentCode()) return DependentCode::cast(dep); | 5364 if (dep->IsDependentCode()) return DependentCode::cast(dep); |
5364 return DependentCode::cast(empty_fixed_array()); | 5365 return DependentCode::cast(empty_fixed_array()); |
5365 } | 5366 } |
5366 | 5367 |
5367 | 5368 |
5368 void Heap::AddRetainedMap(Handle<Map> map) { | 5369 void Heap::AddRetainedMap(Handle<Map> map) { |
5369 if (FLAG_retain_maps_for_n_gc == 0) return; | |
5370 Handle<WeakCell> cell = Map::WeakCellForMap(map); | 5370 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
5371 Handle<ArrayList> array(retained_maps(), isolate()); | 5371 Handle<ArrayList> array(retained_maps(), isolate()); |
5372 array = ArrayList::Add( | 5372 array = ArrayList::Add( |
5373 array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate()), | 5373 array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate()), |
5374 ArrayList::kReloadLengthAfterAllocation); | 5374 ArrayList::kReloadLengthAfterAllocation); |
5375 if (*array != retained_maps()) { | 5375 if (*array != retained_maps()) { |
5376 set_retained_maps(*array); | 5376 set_retained_maps(*array); |
5377 } | 5377 } |
5378 } | 5378 } |
5379 | 5379 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6161 } | 6161 } |
6162 | 6162 |
6163 | 6163 |
6164 // static | 6164 // static |
6165 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6165 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6166 return StaticVisitorBase::GetVisitorId(map); | 6166 return StaticVisitorBase::GetVisitorId(map); |
6167 } | 6167 } |
6168 | 6168 |
6169 } // namespace internal | 6169 } // namespace internal |
6170 } // namespace v8 | 6170 } // namespace v8 |
OLD | NEW |