| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 { MaybeObject* maybe_obj = AllocateHeapNumber(V8_INFINITY, TENURED); | 2742 { MaybeObject* maybe_obj = AllocateHeapNumber(V8_INFINITY, TENURED); |
| 2743 if (!maybe_obj->ToObject(&obj)) return false; | 2743 if (!maybe_obj->ToObject(&obj)) return false; |
| 2744 } | 2744 } |
| 2745 set_infinity_value(HeapNumber::cast(obj)); | 2745 set_infinity_value(HeapNumber::cast(obj)); |
| 2746 | 2746 |
| 2747 // The hole has not been created yet, but we want to put something | 2747 // The hole has not been created yet, but we want to put something |
| 2748 // predictable in the gaps in the string table, so lets make that Smi zero. | 2748 // predictable in the gaps in the string table, so lets make that Smi zero. |
| 2749 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); | 2749 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); |
| 2750 | 2750 |
| 2751 // Allocate initial string table. | 2751 // Allocate initial string table. |
| 2752 { MaybeObject* maybe_obj = StringTable::Allocate(kInitialStringTableSize); | 2752 { MaybeObject* maybe_obj = |
| 2753 StringTable::Allocate(this, kInitialStringTableSize); |
| 2753 if (!maybe_obj->ToObject(&obj)) return false; | 2754 if (!maybe_obj->ToObject(&obj)) return false; |
| 2754 } | 2755 } |
| 2755 // Don't use set_string_table() due to asserts. | 2756 // Don't use set_string_table() due to asserts. |
| 2756 roots_[kStringTableRootIndex] = obj; | 2757 roots_[kStringTableRootIndex] = obj; |
| 2757 | 2758 |
| 2758 // Finish initializing oddballs after creating the string table. | 2759 // Finish initializing oddballs after creating the string table. |
| 2759 { MaybeObject* maybe_obj = | 2760 { MaybeObject* maybe_obj = |
| 2760 undefined_value()->Initialize("undefined", | 2761 undefined_value()->Initialize("undefined", |
| 2761 nan_value(), | 2762 nan_value(), |
| 2762 Oddball::kUndefined); | 2763 Oddball::kUndefined); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2833 | 2834 |
| 2834 // Allocate the foreign for __proto__. | 2835 // Allocate the foreign for __proto__. |
| 2835 { MaybeObject* maybe_obj = | 2836 { MaybeObject* maybe_obj = |
| 2836 AllocateForeign((Address) &Accessors::ObjectPrototype); | 2837 AllocateForeign((Address) &Accessors::ObjectPrototype); |
| 2837 if (!maybe_obj->ToObject(&obj)) return false; | 2838 if (!maybe_obj->ToObject(&obj)) return false; |
| 2838 } | 2839 } |
| 2839 set_prototype_accessors(Foreign::cast(obj)); | 2840 set_prototype_accessors(Foreign::cast(obj)); |
| 2840 | 2841 |
| 2841 // Allocate the code_stubs dictionary. The initial size is set to avoid | 2842 // Allocate the code_stubs dictionary. The initial size is set to avoid |
| 2842 // expanding the dictionary during bootstrapping. | 2843 // expanding the dictionary during bootstrapping. |
| 2843 { MaybeObject* maybe_obj = UnseededNumberDictionary::Allocate(128); | 2844 { MaybeObject* maybe_obj = UnseededNumberDictionary::Allocate(this, 128); |
| 2844 if (!maybe_obj->ToObject(&obj)) return false; | 2845 if (!maybe_obj->ToObject(&obj)) return false; |
| 2845 } | 2846 } |
| 2846 set_code_stubs(UnseededNumberDictionary::cast(obj)); | 2847 set_code_stubs(UnseededNumberDictionary::cast(obj)); |
| 2847 | 2848 |
| 2848 | 2849 |
| 2849 // Allocate the non_monomorphic_cache used in stub-cache.cc. The initial size | 2850 // Allocate the non_monomorphic_cache used in stub-cache.cc. The initial size |
| 2850 // is set to avoid expanding the dictionary during bootstrapping. | 2851 // is set to avoid expanding the dictionary during bootstrapping. |
| 2851 { MaybeObject* maybe_obj = UnseededNumberDictionary::Allocate(64); | 2852 { MaybeObject* maybe_obj = UnseededNumberDictionary::Allocate(this, 64); |
| 2852 if (!maybe_obj->ToObject(&obj)) return false; | 2853 if (!maybe_obj->ToObject(&obj)) return false; |
| 2853 } | 2854 } |
| 2854 set_non_monomorphic_cache(UnseededNumberDictionary::cast(obj)); | 2855 set_non_monomorphic_cache(UnseededNumberDictionary::cast(obj)); |
| 2855 | 2856 |
| 2856 { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache(); | 2857 { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache(); |
| 2857 if (!maybe_obj->ToObject(&obj)) return false; | 2858 if (!maybe_obj->ToObject(&obj)) return false; |
| 2858 } | 2859 } |
| 2859 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); | 2860 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); |
| 2860 | 2861 |
| 2861 set_instanceof_cache_function(Smi::FromInt(0)); | 2862 set_instanceof_cache_function(Smi::FromInt(0)); |
| 2862 set_instanceof_cache_map(Smi::FromInt(0)); | 2863 set_instanceof_cache_map(Smi::FromInt(0)); |
| 2863 set_instanceof_cache_answer(Smi::FromInt(0)); | 2864 set_instanceof_cache_answer(Smi::FromInt(0)); |
| 2864 | 2865 |
| 2865 CreateFixedStubs(); | 2866 CreateFixedStubs(); |
| 2866 | 2867 |
| 2867 // Allocate the dictionary of intrinsic function names. | 2868 // Allocate the dictionary of intrinsic function names. |
| 2868 { MaybeObject* maybe_obj = NameDictionary::Allocate(Runtime::kNumFunctions); | 2869 { MaybeObject* maybe_obj = |
| 2870 NameDictionary::Allocate(this, Runtime::kNumFunctions); |
| 2869 if (!maybe_obj->ToObject(&obj)) return false; | 2871 if (!maybe_obj->ToObject(&obj)) return false; |
| 2870 } | 2872 } |
| 2871 { MaybeObject* maybe_obj = Runtime::InitializeIntrinsicFunctionNames(this, | 2873 { MaybeObject* maybe_obj = Runtime::InitializeIntrinsicFunctionNames(this, |
| 2872 obj); | 2874 obj); |
| 2873 if (!maybe_obj->ToObject(&obj)) return false; | 2875 if (!maybe_obj->ToObject(&obj)) return false; |
| 2874 } | 2876 } |
| 2875 set_intrinsic_function_names(NameDictionary::cast(obj)); | 2877 set_intrinsic_function_names(NameDictionary::cast(obj)); |
| 2876 | 2878 |
| 2877 { MaybeObject* maybe_obj = AllocateInitialNumberStringCache(); | 2879 { MaybeObject* maybe_obj = AllocateInitialNumberStringCache(); |
| 2878 if (!maybe_obj->ToObject(&obj)) return false; | 2880 if (!maybe_obj->ToObject(&obj)) return false; |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4517 | 4519 |
| 4518 // Initial size of the backing store to avoid resize of the storage during | 4520 // Initial size of the backing store to avoid resize of the storage during |
| 4519 // bootstrapping. The size differs between the JS global object ad the | 4521 // bootstrapping. The size differs between the JS global object ad the |
| 4520 // builtins object. | 4522 // builtins object. |
| 4521 int initial_size = map->instance_type() == JS_GLOBAL_OBJECT_TYPE ? 64 : 512; | 4523 int initial_size = map->instance_type() == JS_GLOBAL_OBJECT_TYPE ? 64 : 512; |
| 4522 | 4524 |
| 4523 // Allocate a dictionary object for backing storage. | 4525 // Allocate a dictionary object for backing storage. |
| 4524 NameDictionary* dictionary; | 4526 NameDictionary* dictionary; |
| 4525 MaybeObject* maybe_dictionary = | 4527 MaybeObject* maybe_dictionary = |
| 4526 NameDictionary::Allocate( | 4528 NameDictionary::Allocate( |
| 4529 this, |
| 4527 map->NumberOfOwnDescriptors() * 2 + initial_size); | 4530 map->NumberOfOwnDescriptors() * 2 + initial_size); |
| 4528 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; | 4531 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; |
| 4529 | 4532 |
| 4530 // The global object might be created from an object template with accessors. | 4533 // The global object might be created from an object template with accessors. |
| 4531 // Fill these accessors into the dictionary. | 4534 // Fill these accessors into the dictionary. |
| 4532 DescriptorArray* descs = map->instance_descriptors(); | 4535 DescriptorArray* descs = map->instance_descriptors(); |
| 4533 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 4536 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 4534 PropertyDetails details = descs->GetDetails(i); | 4537 PropertyDetails details = descs->GetDetails(i); |
| 4535 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. | 4538 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. |
| 4536 PropertyDetails d = PropertyDetails(details.attributes(), | 4539 PropertyDetails d = PropertyDetails(details.attributes(), |
| (...skipping 3282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7819 static_cast<int>(object_sizes_last_time_[index])); | 7822 static_cast<int>(object_sizes_last_time_[index])); |
| 7820 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7823 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7821 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7824 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7822 | 7825 |
| 7823 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7826 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7824 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7827 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7825 ClearObjectStats(); | 7828 ClearObjectStats(); |
| 7826 } | 7829 } |
| 7827 | 7830 |
| 7828 } } // namespace v8::internal | 7831 } } // namespace v8::internal |
| OLD | NEW |