Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

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

Issue 1149863005: Move hash code from hidden string to a private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after
3053 3053
3054 set_polymorphic_code_cache(PolymorphicCodeCache::cast( 3054 set_polymorphic_code_cache(PolymorphicCodeCache::cast(
3055 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE))); 3055 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE)));
3056 3056
3057 set_instanceof_cache_function(Smi::FromInt(0)); 3057 set_instanceof_cache_function(Smi::FromInt(0));
3058 set_instanceof_cache_map(Smi::FromInt(0)); 3058 set_instanceof_cache_map(Smi::FromInt(0));
3059 set_instanceof_cache_answer(Smi::FromInt(0)); 3059 set_instanceof_cache_answer(Smi::FromInt(0));
3060 3060
3061 { 3061 {
3062 HandleScope scope(isolate()); 3062 HandleScope scope(isolate());
3063 #define SYMBOL_INIT(name) \ 3063 #define SYMBOL_INIT(name) \
3064 Handle<Symbol> name = factory->NewPrivateOwnSymbol(); \ 3064 { \
3065 roots_[k##name##RootIndex] = *name; 3065 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \
3066 Handle<Object> symbol(isolate()->factory()->NewPrivateOwnSymbol(name##d)); \
3067 roots_[k##name##RootIndex] = *symbol; \
3068 }
3066 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) 3069 PRIVATE_SYMBOL_LIST(SYMBOL_INIT)
3067 #undef SYMBOL_INIT 3070 #undef SYMBOL_INIT
3068 } 3071 }
3069 3072
3070 { 3073 {
3071 HandleScope scope(isolate()); 3074 HandleScope scope(isolate());
3072 #define SYMBOL_INIT(name, varname, description) \ 3075 #define SYMBOL_INIT(name, varname, description) \
3073 Handle<Symbol> name = factory->NewSymbol(); \ 3076 Handle<Symbol> name = factory->NewSymbol(); \
3074 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ 3077 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \
3075 name->set_name(*name##d); \ 3078 name->set_name(*name##d); \
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 isolate_->context_slot_cache()->Clear(); 3167 isolate_->context_slot_cache()->Clear();
3165 3168
3166 // Initialize descriptor cache. 3169 // Initialize descriptor cache.
3167 isolate_->descriptor_lookup_cache()->Clear(); 3170 isolate_->descriptor_lookup_cache()->Clear();
3168 3171
3169 // Initialize compilation cache. 3172 // Initialize compilation cache.
3170 isolate_->compilation_cache()->Clear(); 3173 isolate_->compilation_cache()->Clear();
3171 } 3174 }
3172 3175
3173 3176
3177 void Heap::AddPrivateGlobalSymbols(Handle<Object> private_intern_table) {
3178 #define ADD_SYMBOL_TO_PRIVATE_INTERN_TABLE(name_arg) \
3179 { \
3180 Handle<Symbol> symbol(Symbol::cast(roots_[k##name_arg##RootIndex])); \
3181 Handle<String> name_arg##d(String::cast(symbol->name())); \
3182 JSObject::AddProperty(Handle<JSObject>::cast(private_intern_table), \
3183 name_arg##d, symbol, NONE); \
3184 }
3185 PRIVATE_SYMBOL_LIST(ADD_SYMBOL_TO_PRIVATE_INTERN_TABLE)
3186 #undef ADD_SYMBOL_TO_PRIVATE_INTERN_TABLE
3187 }
3188
3189
3174 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { 3190 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) {
3175 switch (root_index) { 3191 switch (root_index) {
3176 case kStoreBufferTopRootIndex: 3192 case kStoreBufferTopRootIndex:
3177 case kNumberStringCacheRootIndex: 3193 case kNumberStringCacheRootIndex:
3178 case kInstanceofCacheFunctionRootIndex: 3194 case kInstanceofCacheFunctionRootIndex:
3179 case kInstanceofCacheMapRootIndex: 3195 case kInstanceofCacheMapRootIndex:
3180 case kInstanceofCacheAnswerRootIndex: 3196 case kInstanceofCacheAnswerRootIndex:
3181 case kCodeStubsRootIndex: 3197 case kCodeStubsRootIndex:
3182 case kNonMonomorphicCacheRootIndex: 3198 case kNonMonomorphicCacheRootIndex:
3183 case kPolymorphicCodeCacheRootIndex: 3199 case kPolymorphicCodeCacheRootIndex:
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after
6586 *object_type = "CODE_TYPE"; \ 6602 *object_type = "CODE_TYPE"; \
6587 *object_sub_type = "CODE_AGE/" #name; \ 6603 *object_sub_type = "CODE_AGE/" #name; \
6588 return true; 6604 return true;
6589 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6605 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6590 #undef COMPARE_AND_RETURN_NAME 6606 #undef COMPARE_AND_RETURN_NAME
6591 } 6607 }
6592 return false; 6608 return false;
6593 } 6609 }
6594 } 6610 }
6595 } // namespace v8::internal 6611 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698