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/v8.h" | 5 #include "src/v8.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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 int Heap::NotifyContextDisposed(bool dependant_context) { | 921 int Heap::NotifyContextDisposed(bool dependant_context) { |
922 if (!dependant_context) { | 922 if (!dependant_context) { |
923 tracer()->ResetSurvivalEvents(); | 923 tracer()->ResetSurvivalEvents(); |
924 old_generation_size_configured_ = false; | 924 old_generation_size_configured_ = false; |
925 } | 925 } |
926 if (isolate()->concurrent_recompilation_enabled()) { | 926 if (isolate()->concurrent_recompilation_enabled()) { |
927 // Flush the queued recompilation tasks. | 927 // Flush the queued recompilation tasks. |
928 isolate()->optimizing_compiler_thread()->Flush(); | 928 isolate()->optimizing_compiler_thread()->Flush(); |
929 } | 929 } |
930 AgeInlineCaches(); | 930 AgeInlineCaches(); |
| 931 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
931 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); | 932 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); |
932 return ++contexts_disposed_; | 933 return ++contexts_disposed_; |
933 } | 934 } |
934 | 935 |
935 | 936 |
936 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, | 937 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, |
937 int len) { | 938 int len) { |
938 if (len == 0) return; | 939 if (len == 0) return; |
939 | 940 |
940 DCHECK(array->map() != fixed_cow_array_map()); | 941 DCHECK(array->map() != fixed_cow_array_map()); |
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3103 factory->NewTypeFeedbackVector(spec); | 3104 factory->NewTypeFeedbackVector(spec); |
3104 dummy_vector->Set(FeedbackVectorICSlot(0), | 3105 dummy_vector->Set(FeedbackVectorICSlot(0), |
3105 *TypeFeedbackVector::MegamorphicSentinel(isolate()), | 3106 *TypeFeedbackVector::MegamorphicSentinel(isolate()), |
3106 SKIP_WRITE_BARRIER); | 3107 SKIP_WRITE_BARRIER); |
3107 set_keyed_load_dummy_vector(*dummy_vector); | 3108 set_keyed_load_dummy_vector(*dummy_vector); |
3108 } else { | 3109 } else { |
3109 set_keyed_load_dummy_vector(empty_fixed_array()); | 3110 set_keyed_load_dummy_vector(empty_fixed_array()); |
3110 } | 3111 } |
3111 | 3112 |
3112 set_detached_contexts(empty_fixed_array()); | 3113 set_detached_contexts(empty_fixed_array()); |
| 3114 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
3113 | 3115 |
3114 set_weak_object_to_code_table( | 3116 set_weak_object_to_code_table( |
3115 *WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, | 3117 *WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, |
3116 TENURED)); | 3118 TENURED)); |
3117 | 3119 |
3118 Handle<SeededNumberDictionary> slow_element_dictionary = | 3120 Handle<SeededNumberDictionary> slow_element_dictionary = |
3119 SeededNumberDictionary::New(isolate(), 0, TENURED); | 3121 SeededNumberDictionary::New(isolate(), 0, TENURED); |
3120 slow_element_dictionary->set_requires_slow_elements(); | 3122 slow_element_dictionary->set_requires_slow_elements(); |
3121 set_empty_slow_element_dictionary(*slow_element_dictionary); | 3123 set_empty_slow_element_dictionary(*slow_element_dictionary); |
3122 | 3124 |
(...skipping 30 matching lines...) Expand all Loading... |
3153 case kCodeStubsRootIndex: | 3155 case kCodeStubsRootIndex: |
3154 case kNonMonomorphicCacheRootIndex: | 3156 case kNonMonomorphicCacheRootIndex: |
3155 case kPolymorphicCodeCacheRootIndex: | 3157 case kPolymorphicCodeCacheRootIndex: |
3156 case kEmptyScriptRootIndex: | 3158 case kEmptyScriptRootIndex: |
3157 case kSymbolRegistryRootIndex: | 3159 case kSymbolRegistryRootIndex: |
3158 case kMaterializedObjectsRootIndex: | 3160 case kMaterializedObjectsRootIndex: |
3159 case kAllocationSitesScratchpadRootIndex: | 3161 case kAllocationSitesScratchpadRootIndex: |
3160 case kMicrotaskQueueRootIndex: | 3162 case kMicrotaskQueueRootIndex: |
3161 case kDetachedContextsRootIndex: | 3163 case kDetachedContextsRootIndex: |
3162 case kWeakObjectToCodeTableRootIndex: | 3164 case kWeakObjectToCodeTableRootIndex: |
| 3165 case kRetainedMapsRootIndex: |
3163 // Smi values | 3166 // Smi values |
3164 #define SMI_ENTRY(type, name, Name) case k##Name##RootIndex: | 3167 #define SMI_ENTRY(type, name, Name) case k##Name##RootIndex: |
3165 SMI_ROOT_LIST(SMI_ENTRY) | 3168 SMI_ROOT_LIST(SMI_ENTRY) |
3166 #undef SMI_ENTRY | 3169 #undef SMI_ENTRY |
3167 // String table | 3170 // String table |
3168 case kStringTableRootIndex: | 3171 case kStringTableRootIndex: |
3169 return true; | 3172 return true; |
3170 | 3173 |
3171 default: | 3174 default: |
3172 return false; | 3175 return false; |
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5746 } | 5749 } |
5747 | 5750 |
5748 | 5751 |
5749 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { | 5752 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { |
5750 Object* dep = weak_object_to_code_table()->Lookup(obj); | 5753 Object* dep = weak_object_to_code_table()->Lookup(obj); |
5751 if (dep->IsDependentCode()) return DependentCode::cast(dep); | 5754 if (dep->IsDependentCode()) return DependentCode::cast(dep); |
5752 return DependentCode::cast(empty_fixed_array()); | 5755 return DependentCode::cast(empty_fixed_array()); |
5753 } | 5756 } |
5754 | 5757 |
5755 | 5758 |
| 5759 void Heap::AddRetainedMap(Handle<Map> map) { |
| 5760 if (FLAG_retain_maps_for_n_gc == 0) return; |
| 5761 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 5762 Handle<ArrayList> array(retained_maps(), isolate()); |
| 5763 array = ArrayList::Add( |
| 5764 array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate())); |
| 5765 if (*array != retained_maps()) { |
| 5766 set_retained_maps(*array); |
| 5767 } |
| 5768 } |
| 5769 |
| 5770 |
5756 void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { | 5771 void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { |
5757 v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); | 5772 v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); |
5758 } | 5773 } |
5759 | 5774 |
5760 #ifdef DEBUG | 5775 #ifdef DEBUG |
5761 | 5776 |
5762 class PrintHandleVisitor : public ObjectVisitor { | 5777 class PrintHandleVisitor : public ObjectVisitor { |
5763 public: | 5778 public: |
5764 void VisitPointers(Object** start, Object** end) { | 5779 void VisitPointers(Object** start, Object** end) { |
5765 for (Object** p = start; p < end; p++) | 5780 for (Object** p = start; p < end; p++) |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6530 static_cast<int>(object_sizes_last_time_[index])); | 6545 static_cast<int>(object_sizes_last_time_[index])); |
6531 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6546 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6532 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6547 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6533 | 6548 |
6534 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6549 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6535 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6550 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6536 ClearObjectStats(); | 6551 ClearObjectStats(); |
6537 } | 6552 } |
6538 } | 6553 } |
6539 } // namespace v8::internal | 6554 } // namespace v8::internal |
OLD | NEW |