Chromium Code Reviews

Side by Side Diff: src/heap/heap.cc

Issue 1846963002: Use a dictionary-mode code cache on the map rather than a dual system. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1468 matching lines...)
1479 isolate_->context_slot_cache()->Clear(); 1479 isolate_->context_slot_cache()->Clear();
1480 isolate_->descriptor_lookup_cache()->Clear(); 1480 isolate_->descriptor_lookup_cache()->Clear();
1481 RegExpResultsCache::Clear(string_split_cache()); 1481 RegExpResultsCache::Clear(string_split_cache());
1482 RegExpResultsCache::Clear(regexp_multiple_cache()); 1482 RegExpResultsCache::Clear(regexp_multiple_cache());
1483 1483
1484 isolate_->compilation_cache()->MarkCompactPrologue(); 1484 isolate_->compilation_cache()->MarkCompactPrologue();
1485 1485
1486 CompletelyClearInstanceofCache(); 1486 CompletelyClearInstanceofCache();
1487 1487
1488 FlushNumberStringCache(); 1488 FlushNumberStringCache();
1489 if (FLAG_cleanup_code_caches_at_gc) {
1490 polymorphic_code_cache()->set_cache(undefined_value());
1491 }
1492
1493 ClearNormalizedMapCaches(); 1489 ClearNormalizedMapCaches();
1494 } 1490 }
1495 1491
1496 1492
1497 #ifdef VERIFY_HEAP 1493 #ifdef VERIFY_HEAP
1498 // Visitor class to verify pointers in code or data space do not point into 1494 // Visitor class to verify pointers in code or data space do not point into
1499 // new space. 1495 // new space.
1500 class VerifyNonPointerSpacePointersVisitor : public ObjectVisitor { 1496 class VerifyNonPointerSpacePointersVisitor : public ObjectVisitor {
1501 public: 1497 public:
1502 explicit VerifyNonPointerSpacePointersVisitor(Heap* heap) : heap_(heap) {} 1498 explicit VerifyNonPointerSpacePointersVisitor(Heap* heap) : heap_(heap) {}
(...skipping 1224 matching lines...)
2727 } 2723 }
2728 2724
2729 // Create the code_stubs dictionary. The initial size is set to avoid 2725 // Create the code_stubs dictionary. The initial size is set to avoid
2730 // expanding the dictionary during bootstrapping. 2726 // expanding the dictionary during bootstrapping.
2731 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); 2727 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128));
2732 2728
2733 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size 2729 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size
2734 // is set to avoid expanding the dictionary during bootstrapping. 2730 // is set to avoid expanding the dictionary during bootstrapping.
2735 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64)); 2731 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64));
2736 2732
2737 set_polymorphic_code_cache(PolymorphicCodeCache::cast(
2738 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE)));
2739
2740 set_instanceof_cache_function(Smi::FromInt(0)); 2733 set_instanceof_cache_function(Smi::FromInt(0));
2741 set_instanceof_cache_map(Smi::FromInt(0)); 2734 set_instanceof_cache_map(Smi::FromInt(0));
2742 set_instanceof_cache_answer(Smi::FromInt(0)); 2735 set_instanceof_cache_answer(Smi::FromInt(0));
2743 2736
2744 { 2737 {
2745 HandleScope scope(isolate()); 2738 HandleScope scope(isolate());
2746 #define SYMBOL_INIT(name) \ 2739 #define SYMBOL_INIT(name) \
2747 { \ 2740 { \
2748 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \ 2741 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \
2749 Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \ 2742 Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \
(...skipping 184 matching lines...)
2934 2927
2935 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { 2928 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) {
2936 switch (root_index) { 2929 switch (root_index) {
2937 case kStoreBufferTopRootIndex: 2930 case kStoreBufferTopRootIndex:
2938 case kNumberStringCacheRootIndex: 2931 case kNumberStringCacheRootIndex:
2939 case kInstanceofCacheFunctionRootIndex: 2932 case kInstanceofCacheFunctionRootIndex:
2940 case kInstanceofCacheMapRootIndex: 2933 case kInstanceofCacheMapRootIndex:
2941 case kInstanceofCacheAnswerRootIndex: 2934 case kInstanceofCacheAnswerRootIndex:
2942 case kCodeStubsRootIndex: 2935 case kCodeStubsRootIndex:
2943 case kNonMonomorphicCacheRootIndex: 2936 case kNonMonomorphicCacheRootIndex:
2944 case kPolymorphicCodeCacheRootIndex:
2945 case kEmptyScriptRootIndex: 2937 case kEmptyScriptRootIndex:
2946 case kSymbolRegistryRootIndex: 2938 case kSymbolRegistryRootIndex:
2947 case kScriptListRootIndex: 2939 case kScriptListRootIndex:
2948 case kMaterializedObjectsRootIndex: 2940 case kMaterializedObjectsRootIndex:
2949 case kMicrotaskQueueRootIndex: 2941 case kMicrotaskQueueRootIndex:
2950 case kDetachedContextsRootIndex: 2942 case kDetachedContextsRootIndex:
2951 case kWeakObjectToCodeTableRootIndex: 2943 case kWeakObjectToCodeTableRootIndex:
2952 case kRetainedMapsRootIndex: 2944 case kRetainedMapsRootIndex:
2953 case kNoScriptSharedFunctionInfosRootIndex: 2945 case kNoScriptSharedFunctionInfosRootIndex:
2954 case kWeakStackTraceListRootIndex: 2946 case kWeakStackTraceListRootIndex:
(...skipping 3517 matching lines...)
6472 } 6464 }
6473 6465
6474 6466
6475 // static 6467 // static
6476 int Heap::GetStaticVisitorIdForMap(Map* map) { 6468 int Heap::GetStaticVisitorIdForMap(Map* map) {
6477 return StaticVisitorBase::GetVisitorId(map); 6469 return StaticVisitorBase::GetVisitorId(map);
6478 } 6470 }
6479 6471
6480 } // namespace internal 6472 } // namespace internal
6481 } // namespace v8 6473 } // namespace v8
OLDNEW

Powered by Google App Engine