| 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 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2729 // Create the code_stubs dictionary. The initial size is set to avoid | 2729 // Create the code_stubs dictionary. The initial size is set to avoid |
| 2730 // expanding the dictionary during bootstrapping. | 2730 // expanding the dictionary during bootstrapping. |
| 2731 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); | 2731 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); |
| 2732 | 2732 |
| 2733 set_instanceof_cache_function(Smi::kZero); | 2733 set_instanceof_cache_function(Smi::kZero); |
| 2734 set_instanceof_cache_map(Smi::kZero); | 2734 set_instanceof_cache_map(Smi::kZero); |
| 2735 set_instanceof_cache_answer(Smi::kZero); | 2735 set_instanceof_cache_answer(Smi::kZero); |
| 2736 | 2736 |
| 2737 { | 2737 { |
| 2738 HandleScope scope(isolate()); | 2738 HandleScope scope(isolate()); |
| 2739 #define SYMBOL_INIT(name) \ | 2739 #define SYMBOL_INIT(name) \ |
| 2740 { \ | 2740 { \ |
| 2741 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \ | 2741 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \ |
| 2742 Handle<Symbol> name = \ | 2742 Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \ |
| 2743 isolate()->factory()->NewPrivateSymbol(name##d).ToHandleChecked(); \ | 2743 symbol->set_name(*name##d); \ |
| 2744 roots_[k##name##RootIndex] = *name; \ | 2744 roots_[k##name##RootIndex] = *symbol; \ |
| 2745 } | 2745 } |
| 2746 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) | 2746 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) |
| 2747 #undef SYMBOL_INIT | 2747 #undef SYMBOL_INIT |
| 2748 } | 2748 } |
| 2749 | 2749 |
| 2750 { | 2750 { |
| 2751 HandleScope scope(isolate()); | 2751 HandleScope scope(isolate()); |
| 2752 #define SYMBOL_INIT(name, description) \ | 2752 #define SYMBOL_INIT(name, description) \ |
| 2753 Handle<Symbol> name = factory->NewSymbol(); \ |
| 2753 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ | 2754 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ |
| 2754 Handle<Symbol> name = factory->NewSymbol(name##d).ToHandleChecked(); \ | 2755 name->set_name(*name##d); \ |
| 2755 roots_[k##name##RootIndex] = *name; | 2756 roots_[k##name##RootIndex] = *name; |
| 2756 PUBLIC_SYMBOL_LIST(SYMBOL_INIT) | 2757 PUBLIC_SYMBOL_LIST(SYMBOL_INIT) |
| 2757 #undef SYMBOL_INIT | 2758 #undef SYMBOL_INIT |
| 2758 | 2759 |
| 2759 #define SYMBOL_INIT(name, description) \ | 2760 #define SYMBOL_INIT(name, description) \ |
| 2761 Handle<Symbol> name = factory->NewSymbol(); \ |
| 2760 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ | 2762 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ |
| 2761 Handle<Symbol> name = factory->NewSymbol(name##d).ToHandleChecked(); \ | |
| 2762 name->set_is_well_known_symbol(true); \ | 2763 name->set_is_well_known_symbol(true); \ |
| 2764 name->set_name(*name##d); \ |
| 2763 roots_[k##name##RootIndex] = *name; | 2765 roots_[k##name##RootIndex] = *name; |
| 2764 WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT) | 2766 WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT) |
| 2765 #undef SYMBOL_INIT | 2767 #undef SYMBOL_INIT |
| 2766 } | 2768 } |
| 2767 | 2769 |
| 2768 Handle<NameDictionary> empty_properties_dictionary = | 2770 Handle<NameDictionary> empty_properties_dictionary = |
| 2769 NameDictionary::NewEmpty(isolate(), TENURED); | 2771 NameDictionary::NewEmpty(isolate(), TENURED); |
| 2770 empty_properties_dictionary->SetRequiresCopyOnCapacityChange(); | 2772 empty_properties_dictionary->SetRequiresCopyOnCapacityChange(); |
| 2771 set_empty_properties_dictionary(*empty_properties_dictionary); | 2773 set_empty_properties_dictionary(*empty_properties_dictionary); |
| 2772 | 2774 |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4067 if (!allocation.To(&result)) return allocation; | 4069 if (!allocation.To(&result)) return allocation; |
| 4068 | 4070 |
| 4069 result->set_map_after_allocation(symbol_map(), SKIP_WRITE_BARRIER); | 4071 result->set_map_after_allocation(symbol_map(), SKIP_WRITE_BARRIER); |
| 4070 | 4072 |
| 4071 // Generate a random hash value. | 4073 // Generate a random hash value. |
| 4072 int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask); | 4074 int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask); |
| 4073 | 4075 |
| 4074 Symbol::cast(result) | 4076 Symbol::cast(result) |
| 4075 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); | 4077 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); |
| 4076 Symbol::cast(result)->set_name(undefined_value()); | 4078 Symbol::cast(result)->set_name(undefined_value()); |
| 4077 Symbol::cast(result)->set_descriptive_string(Symbol_parens_string()); | |
| 4078 Symbol::cast(result)->set_flags(0); | 4079 Symbol::cast(result)->set_flags(0); |
| 4079 | 4080 |
| 4080 DCHECK(!Symbol::cast(result)->is_private()); | 4081 DCHECK(!Symbol::cast(result)->is_private()); |
| 4081 return result; | 4082 return result; |
| 4082 } | 4083 } |
| 4083 | 4084 |
| 4084 | 4085 |
| 4085 AllocationResult Heap::AllocateStruct(InstanceType type) { | 4086 AllocationResult Heap::AllocateStruct(InstanceType type) { |
| 4086 Map* map; | 4087 Map* map; |
| 4087 switch (type) { | 4088 switch (type) { |
| (...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6574 case LO_SPACE: | 6575 case LO_SPACE: |
| 6575 return "LO_SPACE"; | 6576 return "LO_SPACE"; |
| 6576 default: | 6577 default: |
| 6577 UNREACHABLE(); | 6578 UNREACHABLE(); |
| 6578 } | 6579 } |
| 6579 return NULL; | 6580 return NULL; |
| 6580 } | 6581 } |
| 6581 | 6582 |
| 6582 } // namespace internal | 6583 } // namespace internal |
| 6583 } // namespace v8 | 6584 } // namespace v8 |
| OLD | NEW |