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> symbol(isolate()->factory()->NewPrivateSymbol()); \ | 2742 Handle<Symbol> name = \ |
2743 symbol->set_name(*name##d); \ | 2743 isolate()->factory()->NewPrivateSymbol(name##d).ToHandleChecked(); \ |
2744 roots_[k##name##RootIndex] = *symbol; \ | 2744 roots_[k##name##RootIndex] = *name; \ |
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(); \ | |
2754 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ | 2753 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ |
2755 name->set_name(*name##d); \ | 2754 Handle<Symbol> name = factory->NewSymbol(name##d).ToHandleChecked(); \ |
2756 roots_[k##name##RootIndex] = *name; | 2755 roots_[k##name##RootIndex] = *name; |
2757 PUBLIC_SYMBOL_LIST(SYMBOL_INIT) | 2756 PUBLIC_SYMBOL_LIST(SYMBOL_INIT) |
2758 #undef SYMBOL_INIT | 2757 #undef SYMBOL_INIT |
2759 | 2758 |
2760 #define SYMBOL_INIT(name, description) \ | 2759 #define SYMBOL_INIT(name, description) \ |
2761 Handle<Symbol> name = factory->NewSymbol(); \ | |
2762 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ | 2760 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ |
| 2761 Handle<Symbol> name = factory->NewSymbol(name##d).ToHandleChecked(); \ |
2763 name->set_is_well_known_symbol(true); \ | 2762 name->set_is_well_known_symbol(true); \ |
2764 name->set_name(*name##d); \ | |
2765 roots_[k##name##RootIndex] = *name; | 2763 roots_[k##name##RootIndex] = *name; |
2766 WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT) | 2764 WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT) |
2767 #undef SYMBOL_INIT | 2765 #undef SYMBOL_INIT |
2768 } | 2766 } |
2769 | 2767 |
2770 Handle<NameDictionary> empty_properties_dictionary = | 2768 Handle<NameDictionary> empty_properties_dictionary = |
2771 NameDictionary::NewEmpty(isolate(), TENURED); | 2769 NameDictionary::NewEmpty(isolate(), TENURED); |
2772 empty_properties_dictionary->SetRequiresCopyOnCapacityChange(); | 2770 empty_properties_dictionary->SetRequiresCopyOnCapacityChange(); |
2773 set_empty_properties_dictionary(*empty_properties_dictionary); | 2771 set_empty_properties_dictionary(*empty_properties_dictionary); |
2774 | 2772 |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4069 if (!allocation.To(&result)) return allocation; | 4067 if (!allocation.To(&result)) return allocation; |
4070 | 4068 |
4071 result->set_map_after_allocation(symbol_map(), SKIP_WRITE_BARRIER); | 4069 result->set_map_after_allocation(symbol_map(), SKIP_WRITE_BARRIER); |
4072 | 4070 |
4073 // Generate a random hash value. | 4071 // Generate a random hash value. |
4074 int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask); | 4072 int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask); |
4075 | 4073 |
4076 Symbol::cast(result) | 4074 Symbol::cast(result) |
4077 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); | 4075 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); |
4078 Symbol::cast(result)->set_name(undefined_value()); | 4076 Symbol::cast(result)->set_name(undefined_value()); |
| 4077 Symbol::cast(result)->set_descriptive_string(Symbol_parens_string()); |
4079 Symbol::cast(result)->set_flags(0); | 4078 Symbol::cast(result)->set_flags(0); |
4080 | 4079 |
4081 DCHECK(!Symbol::cast(result)->is_private()); | 4080 DCHECK(!Symbol::cast(result)->is_private()); |
4082 return result; | 4081 return result; |
4083 } | 4082 } |
4084 | 4083 |
4085 | 4084 |
4086 AllocationResult Heap::AllocateStruct(InstanceType type) { | 4085 AllocationResult Heap::AllocateStruct(InstanceType type) { |
4087 Map* map; | 4086 Map* map; |
4088 switch (type) { | 4087 switch (type) { |
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6575 case LO_SPACE: | 6574 case LO_SPACE: |
6576 return "LO_SPACE"; | 6575 return "LO_SPACE"; |
6577 default: | 6576 default: |
6578 UNREACHABLE(); | 6577 UNREACHABLE(); |
6579 } | 6578 } |
6580 return NULL; | 6579 return NULL; |
6581 } | 6580 } |
6582 | 6581 |
6583 } // namespace internal | 6582 } // namespace internal |
6584 } // namespace v8 | 6583 } // namespace v8 |
OLD | NEW |