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/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 roots_[k##name##RootIndex] = *name; | 2675 roots_[k##name##RootIndex] = *name; |
2676 WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT) | 2676 WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT) |
2677 #undef SYMBOL_INIT | 2677 #undef SYMBOL_INIT |
2678 } | 2678 } |
2679 | 2679 |
2680 Handle<NameDictionary> empty_properties_dictionary = | 2680 Handle<NameDictionary> empty_properties_dictionary = |
2681 NameDictionary::New(isolate(), 0, TENURED); | 2681 NameDictionary::New(isolate(), 0, TENURED); |
2682 empty_properties_dictionary->SetRequiresCopyOnCapacityChange(); | 2682 empty_properties_dictionary->SetRequiresCopyOnCapacityChange(); |
2683 set_empty_properties_dictionary(*empty_properties_dictionary); | 2683 set_empty_properties_dictionary(*empty_properties_dictionary); |
2684 | 2684 |
| 2685 set_public_symbol_table(*empty_properties_dictionary); |
| 2686 set_api_symbol_table(*empty_properties_dictionary); |
| 2687 set_api_private_symbol_table(*empty_properties_dictionary); |
| 2688 |
2685 set_number_string_cache( | 2689 set_number_string_cache( |
2686 *factory->NewFixedArray(kInitialNumberStringCacheSize * 2, TENURED)); | 2690 *factory->NewFixedArray(kInitialNumberStringCacheSize * 2, TENURED)); |
2687 | 2691 |
2688 // Allocate cache for single character one byte strings. | 2692 // Allocate cache for single character one byte strings. |
2689 set_single_character_string_cache( | 2693 set_single_character_string_cache( |
2690 *factory->NewFixedArray(String::kMaxOneByteCharCode + 1, TENURED)); | 2694 *factory->NewFixedArray(String::kMaxOneByteCharCode + 1, TENURED)); |
2691 | 2695 |
2692 // Allocate cache for string split and regexp-multiple. | 2696 // Allocate cache for string split and regexp-multiple. |
2693 set_string_split_cache(*factory->NewFixedArray( | 2697 set_string_split_cache(*factory->NewFixedArray( |
2694 RegExpResultsCache::kRegExpResultsCacheSize, TENURED)); | 2698 RegExpResultsCache::kRegExpResultsCacheSize, TENURED)); |
2695 set_regexp_multiple_cache(*factory->NewFixedArray( | 2699 set_regexp_multiple_cache(*factory->NewFixedArray( |
2696 RegExpResultsCache::kRegExpResultsCacheSize, TENURED)); | 2700 RegExpResultsCache::kRegExpResultsCacheSize, TENURED)); |
2697 | 2701 |
2698 // Allocate cache for external strings pointing to native source code. | 2702 // Allocate cache for external strings pointing to native source code. |
2699 set_natives_source_cache( | 2703 set_natives_source_cache( |
2700 *factory->NewFixedArray(Natives::GetBuiltinsCount())); | 2704 *factory->NewFixedArray(Natives::GetBuiltinsCount())); |
2701 | 2705 |
2702 set_experimental_natives_source_cache( | 2706 set_experimental_natives_source_cache( |
2703 *factory->NewFixedArray(ExperimentalNatives::GetBuiltinsCount())); | 2707 *factory->NewFixedArray(ExperimentalNatives::GetBuiltinsCount())); |
2704 | 2708 |
2705 set_extra_natives_source_cache( | 2709 set_extra_natives_source_cache( |
2706 *factory->NewFixedArray(ExtraNatives::GetBuiltinsCount())); | 2710 *factory->NewFixedArray(ExtraNatives::GetBuiltinsCount())); |
2707 | 2711 |
2708 set_experimental_extra_natives_source_cache( | 2712 set_experimental_extra_natives_source_cache( |
2709 *factory->NewFixedArray(ExperimentalExtraNatives::GetBuiltinsCount())); | 2713 *factory->NewFixedArray(ExperimentalExtraNatives::GetBuiltinsCount())); |
2710 | 2714 |
2711 set_undefined_cell(*factory->NewCell(factory->undefined_value())); | 2715 set_undefined_cell(*factory->NewCell(factory->undefined_value())); |
2712 | 2716 |
2713 // The symbol registry is initialized lazily. | |
2714 set_symbol_registry(Smi::kZero); | |
2715 | |
2716 // Microtask queue uses the empty fixed array as a sentinel for "empty". | 2717 // Microtask queue uses the empty fixed array as a sentinel for "empty". |
2717 // Number of queued microtasks stored in Isolate::pending_microtask_count(). | 2718 // Number of queued microtasks stored in Isolate::pending_microtask_count(). |
2718 set_microtask_queue(empty_fixed_array()); | 2719 set_microtask_queue(empty_fixed_array()); |
2719 | 2720 |
2720 { | 2721 { |
2721 StaticFeedbackVectorSpec spec; | 2722 StaticFeedbackVectorSpec spec; |
2722 FeedbackVectorSlot slot = spec.AddLoadICSlot(); | 2723 FeedbackVectorSlot slot = spec.AddLoadICSlot(); |
2723 DCHECK_EQ(slot, FeedbackVectorSlot(TypeFeedbackVector::kDummyLoadICSlot)); | 2724 DCHECK_EQ(slot, FeedbackVectorSlot(TypeFeedbackVector::kDummyLoadICSlot)); |
2724 | 2725 |
2725 slot = spec.AddKeyedLoadICSlot(); | 2726 slot = spec.AddKeyedLoadICSlot(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 } | 2867 } |
2867 | 2868 |
2868 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { | 2869 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { |
2869 switch (root_index) { | 2870 switch (root_index) { |
2870 case kNumberStringCacheRootIndex: | 2871 case kNumberStringCacheRootIndex: |
2871 case kInstanceofCacheFunctionRootIndex: | 2872 case kInstanceofCacheFunctionRootIndex: |
2872 case kInstanceofCacheMapRootIndex: | 2873 case kInstanceofCacheMapRootIndex: |
2873 case kInstanceofCacheAnswerRootIndex: | 2874 case kInstanceofCacheAnswerRootIndex: |
2874 case kCodeStubsRootIndex: | 2875 case kCodeStubsRootIndex: |
2875 case kEmptyScriptRootIndex: | 2876 case kEmptyScriptRootIndex: |
2876 case kSymbolRegistryRootIndex: | |
2877 case kScriptListRootIndex: | 2877 case kScriptListRootIndex: |
2878 case kMaterializedObjectsRootIndex: | 2878 case kMaterializedObjectsRootIndex: |
2879 case kMicrotaskQueueRootIndex: | 2879 case kMicrotaskQueueRootIndex: |
2880 case kDetachedContextsRootIndex: | 2880 case kDetachedContextsRootIndex: |
2881 case kWeakObjectToCodeTableRootIndex: | 2881 case kWeakObjectToCodeTableRootIndex: |
2882 case kWeakNewSpaceObjectToCodeListRootIndex: | 2882 case kWeakNewSpaceObjectToCodeListRootIndex: |
2883 case kRetainedMapsRootIndex: | 2883 case kRetainedMapsRootIndex: |
2884 case kNoScriptSharedFunctionInfosRootIndex: | 2884 case kNoScriptSharedFunctionInfosRootIndex: |
2885 case kWeakStackTraceListRootIndex: | 2885 case kWeakStackTraceListRootIndex: |
2886 case kSerializedTemplatesRootIndex: | 2886 case kSerializedTemplatesRootIndex: |
| 2887 case kPublicSymbolTableRootIndex: |
| 2888 case kApiSymbolTableRootIndex: |
| 2889 case kApiPrivateSymbolTableRootIndex: |
2887 // Smi values | 2890 // Smi values |
2888 #define SMI_ENTRY(type, name, Name) case k##Name##RootIndex: | 2891 #define SMI_ENTRY(type, name, Name) case k##Name##RootIndex: |
2889 SMI_ROOT_LIST(SMI_ENTRY) | 2892 SMI_ROOT_LIST(SMI_ENTRY) |
2890 #undef SMI_ENTRY | 2893 #undef SMI_ENTRY |
2891 // String table | 2894 // String table |
2892 case kStringTableRootIndex: | 2895 case kStringTableRootIndex: |
2893 return true; | 2896 return true; |
2894 | 2897 |
2895 default: | 2898 default: |
2896 return false; | 2899 return false; |
(...skipping 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6476 } | 6479 } |
6477 | 6480 |
6478 | 6481 |
6479 // static | 6482 // static |
6480 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6483 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6481 return StaticVisitorBase::GetVisitorId(map); | 6484 return StaticVisitorBase::GetVisitorId(map); |
6482 } | 6485 } |
6483 | 6486 |
6484 } // namespace internal | 6487 } // namespace internal |
6485 } // namespace v8 | 6488 } // namespace v8 |
OLD | NEW |