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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/ast/context-slot-cache.h" | 10 #include "src/ast/context-slot-cache.h" |
(...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2808 cell->clear(); | 2808 cell->clear(); |
2809 } | 2809 } |
2810 | 2810 |
2811 set_detached_contexts(empty_fixed_array()); | 2811 set_detached_contexts(empty_fixed_array()); |
2812 set_retained_maps(ArrayList::cast(empty_fixed_array())); | 2812 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
2813 | 2813 |
2814 set_weak_object_to_code_table( | 2814 set_weak_object_to_code_table( |
2815 *WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, | 2815 *WeakHashTable::New(isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, |
2816 TENURED)); | 2816 TENURED)); |
2817 | 2817 |
| 2818 set_stack_frame_cache(*WeakHashTable::New( |
| 2819 isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, TENURED)); |
| 2820 |
2818 set_weak_new_space_object_to_code_list( | 2821 set_weak_new_space_object_to_code_list( |
2819 ArrayList::cast(*(factory->NewFixedArray(16, TENURED)))); | 2822 ArrayList::cast(*(factory->NewFixedArray(16, TENURED)))); |
2820 weak_new_space_object_to_code_list()->SetLength(0); | 2823 weak_new_space_object_to_code_list()->SetLength(0); |
2821 | 2824 |
2822 set_code_coverage_list(undefined_value()); | 2825 set_code_coverage_list(undefined_value()); |
2823 | 2826 |
2824 set_script_list(Smi::kZero); | 2827 set_script_list(Smi::kZero); |
2825 | 2828 |
2826 Handle<SeededNumberDictionary> slow_element_dictionary = | 2829 Handle<SeededNumberDictionary> slow_element_dictionary = |
2827 SeededNumberDictionary::NewEmpty(isolate(), TENURED); | 2830 SeededNumberDictionary::NewEmpty(isolate(), TENURED); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2930 case kInstanceofCacheFunctionRootIndex: | 2933 case kInstanceofCacheFunctionRootIndex: |
2931 case kInstanceofCacheMapRootIndex: | 2934 case kInstanceofCacheMapRootIndex: |
2932 case kInstanceofCacheAnswerRootIndex: | 2935 case kInstanceofCacheAnswerRootIndex: |
2933 case kCodeStubsRootIndex: | 2936 case kCodeStubsRootIndex: |
2934 case kEmptyScriptRootIndex: | 2937 case kEmptyScriptRootIndex: |
2935 case kScriptListRootIndex: | 2938 case kScriptListRootIndex: |
2936 case kMaterializedObjectsRootIndex: | 2939 case kMaterializedObjectsRootIndex: |
2937 case kMicrotaskQueueRootIndex: | 2940 case kMicrotaskQueueRootIndex: |
2938 case kDetachedContextsRootIndex: | 2941 case kDetachedContextsRootIndex: |
2939 case kWeakObjectToCodeTableRootIndex: | 2942 case kWeakObjectToCodeTableRootIndex: |
| 2943 case kStackFrameCacheRootIndex: |
2940 case kWeakNewSpaceObjectToCodeListRootIndex: | 2944 case kWeakNewSpaceObjectToCodeListRootIndex: |
2941 case kRetainedMapsRootIndex: | 2945 case kRetainedMapsRootIndex: |
2942 case kCodeCoverageListRootIndex: | 2946 case kCodeCoverageListRootIndex: |
2943 case kNoScriptSharedFunctionInfosRootIndex: | 2947 case kNoScriptSharedFunctionInfosRootIndex: |
2944 case kWeakStackTraceListRootIndex: | 2948 case kWeakStackTraceListRootIndex: |
2945 case kSerializedTemplatesRootIndex: | 2949 case kSerializedTemplatesRootIndex: |
2946 case kSerializedGlobalProxySizesRootIndex: | 2950 case kSerializedGlobalProxySizesRootIndex: |
2947 case kPublicSymbolTableRootIndex: | 2951 case kPublicSymbolTableRootIndex: |
2948 case kApiSymbolTableRootIndex: | 2952 case kApiSymbolTableRootIndex: |
2949 case kApiPrivateSymbolTableRootIndex: | 2953 case kApiPrivateSymbolTableRootIndex: |
(...skipping 2898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5848 Handle<DependentCode> dep) { | 5852 Handle<DependentCode> dep) { |
5849 DCHECK(!InNewSpace(*obj)); | 5853 DCHECK(!InNewSpace(*obj)); |
5850 DCHECK(!InNewSpace(*dep)); | 5854 DCHECK(!InNewSpace(*dep)); |
5851 Handle<WeakHashTable> table(weak_object_to_code_table(), isolate()); | 5855 Handle<WeakHashTable> table(weak_object_to_code_table(), isolate()); |
5852 table = WeakHashTable::Put(table, obj, dep); | 5856 table = WeakHashTable::Put(table, obj, dep); |
5853 if (*table != weak_object_to_code_table()) | 5857 if (*table != weak_object_to_code_table()) |
5854 set_weak_object_to_code_table(*table); | 5858 set_weak_object_to_code_table(*table); |
5855 DCHECK_EQ(*dep, LookupWeakObjectToCodeDependency(obj)); | 5859 DCHECK_EQ(*dep, LookupWeakObjectToCodeDependency(obj)); |
5856 } | 5860 } |
5857 | 5861 |
5858 | |
5859 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { | 5862 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { |
5860 Object* dep = weak_object_to_code_table()->Lookup(obj); | 5863 Object* dep = weak_object_to_code_table()->Lookup(obj); |
5861 if (dep->IsDependentCode()) return DependentCode::cast(dep); | 5864 if (dep->IsDependentCode()) return DependentCode::cast(dep); |
5862 return DependentCode::cast(empty_fixed_array()); | 5865 return DependentCode::cast(empty_fixed_array()); |
5863 } | 5866 } |
5864 | 5867 |
| 5868 void Heap::SetStackFrameCache(WeakHashTable* table) { |
| 5869 set_stack_frame_cache(table); |
| 5870 } |
| 5871 |
5865 namespace { | 5872 namespace { |
5866 void CompactWeakFixedArray(Object* object) { | 5873 void CompactWeakFixedArray(Object* object) { |
5867 if (object->IsWeakFixedArray()) { | 5874 if (object->IsWeakFixedArray()) { |
5868 WeakFixedArray* array = WeakFixedArray::cast(object); | 5875 WeakFixedArray* array = WeakFixedArray::cast(object); |
5869 array->Compact<WeakFixedArray::NullCallback>(); | 5876 array->Compact<WeakFixedArray::NullCallback>(); |
5870 } | 5877 } |
5871 } | 5878 } |
5872 } // anonymous namespace | 5879 } // anonymous namespace |
5873 | 5880 |
5874 void Heap::CompactWeakFixedArrays() { | 5881 void Heap::CompactWeakFixedArrays() { |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6404 } | 6411 } |
6405 | 6412 |
6406 | 6413 |
6407 // static | 6414 // static |
6408 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6415 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6409 return StaticVisitorBase::GetVisitorId(map); | 6416 return StaticVisitorBase::GetVisitorId(map); |
6410 } | 6417 } |
6411 | 6418 |
6412 } // namespace internal | 6419 } // namespace internal |
6413 } // namespace v8 | 6420 } // namespace v8 |
OLD | NEW |