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 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3060 | 3060 |
3061 set_polymorphic_code_cache(PolymorphicCodeCache::cast( | 3061 set_polymorphic_code_cache(PolymorphicCodeCache::cast( |
3062 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE))); | 3062 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE))); |
3063 | 3063 |
3064 set_instanceof_cache_function(Smi::FromInt(0)); | 3064 set_instanceof_cache_function(Smi::FromInt(0)); |
3065 set_instanceof_cache_map(Smi::FromInt(0)); | 3065 set_instanceof_cache_map(Smi::FromInt(0)); |
3066 set_instanceof_cache_answer(Smi::FromInt(0)); | 3066 set_instanceof_cache_answer(Smi::FromInt(0)); |
3067 | 3067 |
3068 { | 3068 { |
3069 HandleScope scope(isolate()); | 3069 HandleScope scope(isolate()); |
3070 #define SYMBOL_INIT(name) \ | 3070 #define SYMBOL_INIT(name) \ |
3071 Handle<Symbol> name = factory->NewPrivateOwnSymbol(); \ | 3071 { \ |
3072 roots_[k##name##RootIndex] = *name; | 3072 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \ |
3073 Handle<Object> symbol(isolate()->factory()->NewPrivateOwnSymbol(name##d)); \ | |
3074 roots_[k##name##RootIndex] = *symbol; \ | |
3075 } | |
3073 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) | 3076 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) |
3074 #undef SYMBOL_INIT | 3077 #undef SYMBOL_INIT |
3075 } | 3078 } |
3076 | 3079 |
3077 { | 3080 { |
3078 HandleScope scope(isolate()); | 3081 HandleScope scope(isolate()); |
3079 #define SYMBOL_INIT(name, varname, description) \ | 3082 #define SYMBOL_INIT(name, varname, description) \ |
3080 Handle<Symbol> name = factory->NewSymbol(); \ | 3083 Handle<Symbol> name = factory->NewSymbol(); \ |
3081 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ | 3084 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ |
3082 name->set_name(*name##d); \ | 3085 name->set_name(*name##d); \ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3171 isolate_->context_slot_cache()->Clear(); | 3174 isolate_->context_slot_cache()->Clear(); |
3172 | 3175 |
3173 // Initialize descriptor cache. | 3176 // Initialize descriptor cache. |
3174 isolate_->descriptor_lookup_cache()->Clear(); | 3177 isolate_->descriptor_lookup_cache()->Clear(); |
3175 | 3178 |
3176 // Initialize compilation cache. | 3179 // Initialize compilation cache. |
3177 isolate_->compilation_cache()->Clear(); | 3180 isolate_->compilation_cache()->Clear(); |
3178 } | 3181 } |
3179 | 3182 |
3180 | 3183 |
3184 void Heap::AddPrivateGlobalSymbols(Handle<Object> private_intern_table) { | |
3185 #define ADD_SYMBOL_TO_PRIVATE_INTERN_TABLE(name_arg) \ | |
3186 { \ | |
3187 Handle<Symbol> symbol(Symbol::cast(roots_[k##name_arg##RootIndex])); \ | |
3188 Handle<String> name_arg##d(String::cast(symbol->name())); \ | |
3189 JSObject::SetProperty(Handle<JSObject>::cast(private_intern_table), \ | |
Toon Verwaest
2015/05/26 09:06:26
You probably want to use AddProperty here
Erik Corry Chromium.org
2015/05/26 09:51:32
Done.
| |
3190 name_arg##d, symbol, STRICT).Assert(); \ | |
3191 } | |
3192 PRIVATE_SYMBOL_LIST(ADD_SYMBOL_TO_PRIVATE_INTERN_TABLE) | |
3193 #undef ADD_SYMBOL_TO_PRIVATE_INTERN_TABLE | |
3194 } | |
3195 | |
3196 | |
3181 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { | 3197 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { |
3182 switch (root_index) { | 3198 switch (root_index) { |
3183 case kStoreBufferTopRootIndex: | 3199 case kStoreBufferTopRootIndex: |
3184 case kNumberStringCacheRootIndex: | 3200 case kNumberStringCacheRootIndex: |
3185 case kInstanceofCacheFunctionRootIndex: | 3201 case kInstanceofCacheFunctionRootIndex: |
3186 case kInstanceofCacheMapRootIndex: | 3202 case kInstanceofCacheMapRootIndex: |
3187 case kInstanceofCacheAnswerRootIndex: | 3203 case kInstanceofCacheAnswerRootIndex: |
3188 case kCodeStubsRootIndex: | 3204 case kCodeStubsRootIndex: |
3189 case kNonMonomorphicCacheRootIndex: | 3205 case kNonMonomorphicCacheRootIndex: |
3190 case kPolymorphicCodeCacheRootIndex: | 3206 case kPolymorphicCodeCacheRootIndex: |
(...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6591 *object_type = "CODE_TYPE"; \ | 6607 *object_type = "CODE_TYPE"; \ |
6592 *object_sub_type = "CODE_AGE/" #name; \ | 6608 *object_sub_type = "CODE_AGE/" #name; \ |
6593 return true; | 6609 return true; |
6594 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6610 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6595 #undef COMPARE_AND_RETURN_NAME | 6611 #undef COMPARE_AND_RETURN_NAME |
6596 } | 6612 } |
6597 return false; | 6613 return false; |
6598 } | 6614 } |
6599 } | 6615 } |
6600 } // namespace v8::internal | 6616 } // namespace v8::internal |
OLD | NEW |