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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 } | 908 } |
909 | 909 |
910 return next_gc_likely_to_collect_more; | 910 return next_gc_likely_to_collect_more; |
911 } | 911 } |
912 | 912 |
913 | 913 |
914 int Heap::NotifyContextDisposed(bool dependant_context) { | 914 int Heap::NotifyContextDisposed(bool dependant_context) { |
915 if (!dependant_context) { | 915 if (!dependant_context) { |
916 tracer()->ResetSurvivalEvents(); | 916 tracer()->ResetSurvivalEvents(); |
917 old_generation_size_configured_ = false; | 917 old_generation_size_configured_ = false; |
| 918 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
918 } | 919 } |
919 if (isolate()->concurrent_recompilation_enabled()) { | 920 if (isolate()->concurrent_recompilation_enabled()) { |
920 // Flush the queued recompilation tasks. | 921 // Flush the queued recompilation tasks. |
921 isolate()->optimizing_compiler_thread()->Flush(); | 922 isolate()->optimizing_compiler_thread()->Flush(); |
922 } | 923 } |
923 AgeInlineCaches(); | 924 AgeInlineCaches(); |
924 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); | 925 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); |
925 return ++contexts_disposed_; | 926 return ++contexts_disposed_; |
926 } | 927 } |
927 | 928 |
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 factory->NewTypeFeedbackVector(spec); | 3101 factory->NewTypeFeedbackVector(spec); |
3101 dummy_vector->Set(FeedbackVectorICSlot(0), | 3102 dummy_vector->Set(FeedbackVectorICSlot(0), |
3102 *TypeFeedbackVector::MegamorphicSentinel(isolate()), | 3103 *TypeFeedbackVector::MegamorphicSentinel(isolate()), |
3103 SKIP_WRITE_BARRIER); | 3104 SKIP_WRITE_BARRIER); |
3104 set_keyed_load_dummy_vector(*dummy_vector); | 3105 set_keyed_load_dummy_vector(*dummy_vector); |
3105 } else { | 3106 } else { |
3106 set_keyed_load_dummy_vector(empty_fixed_array()); | 3107 set_keyed_load_dummy_vector(empty_fixed_array()); |
3107 } | 3108 } |
3108 | 3109 |
3109 set_detached_contexts(empty_fixed_array()); | 3110 set_detached_contexts(empty_fixed_array()); |
| 3111 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
3110 | 3112 |
3111 set_weak_object_to_code_table( | 3113 set_weak_object_to_code_table( |
3112 *WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, | 3114 *WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, |
3113 TENURED)); | 3115 TENURED)); |
3114 | 3116 |
3115 Handle<SeededNumberDictionary> slow_element_dictionary = | 3117 Handle<SeededNumberDictionary> slow_element_dictionary = |
3116 SeededNumberDictionary::New(isolate(), 0, TENURED); | 3118 SeededNumberDictionary::New(isolate(), 0, TENURED); |
3117 slow_element_dictionary->set_requires_slow_elements(); | 3119 slow_element_dictionary->set_requires_slow_elements(); |
3118 set_empty_slow_element_dictionary(*slow_element_dictionary); | 3120 set_empty_slow_element_dictionary(*slow_element_dictionary); |
3119 | 3121 |
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5740 } | 5742 } |
5741 | 5743 |
5742 | 5744 |
5743 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { | 5745 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { |
5744 Object* dep = weak_object_to_code_table()->Lookup(obj); | 5746 Object* dep = weak_object_to_code_table()->Lookup(obj); |
5745 if (dep->IsDependentCode()) return DependentCode::cast(dep); | 5747 if (dep->IsDependentCode()) return DependentCode::cast(dep); |
5746 return DependentCode::cast(empty_fixed_array()); | 5748 return DependentCode::cast(empty_fixed_array()); |
5747 } | 5749 } |
5748 | 5750 |
5749 | 5751 |
| 5752 void Heap::AddRetainedMap(Handle<Map> map) { |
| 5753 if (FLAG_retain_maps_for_n_gc == 0) return; |
| 5754 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 5755 Handle<ArrayList> array(retained_maps(), isolate()); |
| 5756 array = ArrayList::Add( |
| 5757 array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate())); |
| 5758 if (*array != retained_maps()) { |
| 5759 set_retained_maps(*array); |
| 5760 } |
| 5761 } |
| 5762 |
| 5763 |
5750 void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { | 5764 void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { |
5751 v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); | 5765 v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); |
5752 } | 5766 } |
5753 | 5767 |
5754 #ifdef DEBUG | 5768 #ifdef DEBUG |
5755 | 5769 |
5756 class PrintHandleVisitor : public ObjectVisitor { | 5770 class PrintHandleVisitor : public ObjectVisitor { |
5757 public: | 5771 public: |
5758 void VisitPointers(Object** start, Object** end) { | 5772 void VisitPointers(Object** start, Object** end) { |
5759 for (Object** p = start; p < end; p++) | 5773 for (Object** p = start; p < end; p++) |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6524 static_cast<int>(object_sizes_last_time_[index])); | 6538 static_cast<int>(object_sizes_last_time_[index])); |
6525 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6539 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6526 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6540 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6527 | 6541 |
6528 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6542 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6529 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6543 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6530 ClearObjectStats(); | 6544 ClearObjectStats(); |
6531 } | 6545 } |
6532 } | 6546 } |
6533 } // namespace v8::internal | 6547 } // namespace v8::internal |
OLD | NEW |