Chromium Code Reviews| 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/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2660 set_exception(*factory->NewOddball(factory->exception_map(), "exception", | 2660 set_exception(*factory->NewOddball(factory->exception_map(), "exception", |
| 2661 handle(Smi::FromInt(-5), isolate()), | 2661 handle(Smi::FromInt(-5), isolate()), |
| 2662 "undefined", Oddball::kException)); | 2662 "undefined", Oddball::kException)); |
| 2663 | 2663 |
| 2664 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { | 2664 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { |
| 2665 Handle<String> str = | 2665 Handle<String> str = |
| 2666 factory->InternalizeUtf8String(constant_string_table[i].contents); | 2666 factory->InternalizeUtf8String(constant_string_table[i].contents); |
| 2667 roots_[constant_string_table[i].index] = *str; | 2667 roots_[constant_string_table[i].index] = *str; |
| 2668 } | 2668 } |
| 2669 | 2669 |
| 2670 // The {hidden_string} is special because it is an empty string, but does not | |
| 2671 // match any string (even the {empty_string}) when looked up in properties. | |
| 2672 // Allocate the hidden string which is used to identify the hidden properties | |
| 2673 // in JSObjects. The hash code has a special value so that it will not match | |
| 2674 // the empty string when searching for the property. It cannot be part of the | |
| 2675 // loop above because it needs to be allocated manually with the special | |
| 2676 // hash code in place. The hash code for the hidden_string is zero to ensure | |
| 2677 // that it will always be at the first entry in property descriptors. | |
| 2678 set_hidden_string(*factory->NewOneByteInternalizedString( | |
| 2679 OneByteVector("", 0), String::kEmptyStringHash)); | |
| 2680 | |
| 2681 // Create the code_stubs dictionary. The initial size is set to avoid | 2670 // Create the code_stubs dictionary. The initial size is set to avoid |
| 2682 // expanding the dictionary during bootstrapping. | 2671 // expanding the dictionary during bootstrapping. |
| 2683 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); | 2672 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); |
| 2684 | 2673 |
| 2685 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size | 2674 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size |
| 2686 // is set to avoid expanding the dictionary during bootstrapping. | 2675 // is set to avoid expanding the dictionary during bootstrapping. |
| 2687 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64)); | 2676 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64)); |
| 2688 | 2677 |
| 2689 set_polymorphic_code_cache(PolymorphicCodeCache::cast( | 2678 set_polymorphic_code_cache(PolymorphicCodeCache::cast( |
| 2690 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE))); | 2679 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE))); |
| 2691 | 2680 |
| 2692 set_instanceof_cache_function(Smi::FromInt(0)); | 2681 set_instanceof_cache_function(Smi::FromInt(0)); |
| 2693 set_instanceof_cache_map(Smi::FromInt(0)); | 2682 set_instanceof_cache_map(Smi::FromInt(0)); |
| 2694 set_instanceof_cache_answer(Smi::FromInt(0)); | 2683 set_instanceof_cache_answer(Smi::FromInt(0)); |
| 2695 | 2684 |
| 2696 { | 2685 { |
| 2697 HandleScope scope(isolate()); | 2686 HandleScope scope(isolate()); |
| 2698 #define SYMBOL_INIT(name) \ | 2687 #define SYMBOL_INIT(name) \ |
| 2699 { \ | 2688 { \ |
| 2700 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \ | 2689 Handle<String> name##d = factory->NewStringFromStaticChars(#name); \ |
| 2701 Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \ | 2690 Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \ |
| 2702 symbol->set_name(*name##d); \ | 2691 symbol->set_name(*name##d); \ |
| 2703 roots_[k##name##RootIndex] = *symbol; \ | 2692 roots_[k##name##RootIndex] = *symbol; \ |
| 2704 } | 2693 } |
| 2705 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) | 2694 PRIVATE_SYMBOL_LIST(SYMBOL_INIT) |
| 2706 #undef SYMBOL_INIT | 2695 #undef SYMBOL_INIT |
| 2707 } | 2696 } |
| 2708 | 2697 |
| 2698 // The {hidden_properties_symbol} is special because it is the only name with | |
| 2699 // hash code zero. This ensures that it will always be the first entry as | |
| 2700 // sorted by hash code in descriptor arrays. It is used to identify the hidden | |
| 2701 // properties in JSObjects. | |
| 2702 // kIsNotArrayIndexMask is a computed hash with value zero. | |
| 2703 Symbol::cast(roots_[khidden_properties_symbolRootIndex]) | |
| 2704 ->set_hash_field(Name::kIsNotArrayIndexMask); | |
|
ulan
2016/02/17 10:45:22
Oh well
| |
| 2705 | |
| 2709 { | 2706 { |
| 2710 HandleScope scope(isolate()); | 2707 HandleScope scope(isolate()); |
| 2711 #define SYMBOL_INIT(name, description) \ | 2708 #define SYMBOL_INIT(name, description) \ |
| 2712 Handle<Symbol> name = factory->NewSymbol(); \ | 2709 Handle<Symbol> name = factory->NewSymbol(); \ |
| 2713 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ | 2710 Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ |
| 2714 name->set_name(*name##d); \ | 2711 name->set_name(*name##d); \ |
| 2715 roots_[k##name##RootIndex] = *name; | 2712 roots_[k##name##RootIndex] = *name; |
| 2716 PUBLIC_SYMBOL_LIST(SYMBOL_INIT) | 2713 PUBLIC_SYMBOL_LIST(SYMBOL_INIT) |
| 2717 #undef SYMBOL_INIT | 2714 #undef SYMBOL_INIT |
| 2718 | 2715 |
| (...skipping 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6265 } | 6262 } |
| 6266 | 6263 |
| 6267 | 6264 |
| 6268 // static | 6265 // static |
| 6269 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6266 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6270 return StaticVisitorBase::GetVisitorId(map); | 6267 return StaticVisitorBase::GetVisitorId(map); |
| 6271 } | 6268 } |
| 6272 | 6269 |
| 6273 } // namespace internal | 6270 } // namespace internal |
| 6274 } // namespace v8 | 6271 } // namespace v8 |
| OLD | NEW |