| 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 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2752 if (!maybe_result->To(&site)) return maybe_result; | 2752 if (!maybe_result->To(&site)) return maybe_result; |
| 2753 site->Initialize(); | 2753 site->Initialize(); |
| 2754 | 2754 |
| 2755 // Link the site | 2755 // Link the site |
| 2756 site->set_weak_next(allocation_sites_list()); | 2756 site->set_weak_next(allocation_sites_list()); |
| 2757 set_allocation_sites_list(site); | 2757 set_allocation_sites_list(site); |
| 2758 return site; | 2758 return site; |
| 2759 } | 2759 } |
| 2760 | 2760 |
| 2761 | 2761 |
| 2762 MaybeObject* Heap::CreateOddball(Map* map, |
| 2763 const char* to_string, |
| 2764 Object* to_number, |
| 2765 byte kind) { |
| 2766 Object* result; |
| 2767 { MaybeObject* maybe_result = Allocate(map, OLD_POINTER_SPACE); |
| 2768 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2769 } |
| 2770 return Oddball::cast(result)->Initialize(this, to_string, to_number, kind); |
| 2771 } |
| 2772 |
| 2773 |
| 2762 bool Heap::CreateApiObjects() { | 2774 bool Heap::CreateApiObjects() { |
| 2763 Object* obj; | 2775 Object* obj; |
| 2764 | 2776 |
| 2765 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 2777 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 2766 if (!maybe_obj->ToObject(&obj)) return false; | 2778 if (!maybe_obj->ToObject(&obj)) return false; |
| 2767 } | 2779 } |
| 2768 // Don't use Smi-only elements optimizations for objects with the neander | 2780 // Don't use Smi-only elements optimizations for objects with the neander |
| 2769 // map. There are too many cases where element values are set directly with a | 2781 // map. There are too many cases where element values are set directly with a |
| 2770 // bottleneck to trap the Smi-only -> fast elements transition, and there | 2782 // bottleneck to trap the Smi-only -> fast elements transition, and there |
| 2771 // appears to be no benefit for optimize this case. | 2783 // appears to be no benefit for optimize this case. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2824 // { JSConstructEntryStub stub; | 2836 // { JSConstructEntryStub stub; |
| 2825 // js_construct_entry_code_ = *stub.GetCode(); | 2837 // js_construct_entry_code_ = *stub.GetCode(); |
| 2826 // } | 2838 // } |
| 2827 // To workaround the problem, make separate functions without inlining. | 2839 // To workaround the problem, make separate functions without inlining. |
| 2828 Heap::CreateJSEntryStub(); | 2840 Heap::CreateJSEntryStub(); |
| 2829 Heap::CreateJSConstructEntryStub(); | 2841 Heap::CreateJSConstructEntryStub(); |
| 2830 } | 2842 } |
| 2831 | 2843 |
| 2832 | 2844 |
| 2833 bool Heap::CreateInitialObjects() { | 2845 bool Heap::CreateInitialObjects() { |
| 2834 HandleScope scope(isolate()); | 2846 Object* obj; |
| 2835 Factory* factory = isolate()->factory(); | |
| 2836 | 2847 |
| 2837 // The -0 value must be set before NumberFromDouble works. | 2848 // The -0 value must be set before NumberFromDouble works. |
| 2838 set_minus_zero_value(*factory->NewHeapNumber(-0.0, TENURED)); | 2849 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED); |
| 2850 if (!maybe_obj->ToObject(&obj)) return false; |
| 2851 } |
| 2852 set_minus_zero_value(HeapNumber::cast(obj)); |
| 2839 ASSERT(std::signbit(minus_zero_value()->Number()) != 0); | 2853 ASSERT(std::signbit(minus_zero_value()->Number()) != 0); |
| 2840 | 2854 |
| 2841 set_nan_value(*factory->NewHeapNumber(OS::nan_value(), TENURED)); | 2855 { MaybeObject* maybe_obj = AllocateHeapNumber(OS::nan_value(), TENURED); |
| 2842 set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, TENURED)); | 2856 if (!maybe_obj->ToObject(&obj)) return false; |
| 2857 } |
| 2858 set_nan_value(HeapNumber::cast(obj)); |
| 2859 |
| 2860 { MaybeObject* maybe_obj = AllocateHeapNumber(V8_INFINITY, TENURED); |
| 2861 if (!maybe_obj->ToObject(&obj)) return false; |
| 2862 } |
| 2863 set_infinity_value(HeapNumber::cast(obj)); |
| 2843 | 2864 |
| 2844 // The hole has not been created yet, but we want to put something | 2865 // The hole has not been created yet, but we want to put something |
| 2845 // predictable in the gaps in the string table, so lets make that Smi zero. | 2866 // predictable in the gaps in the string table, so lets make that Smi zero. |
| 2846 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); | 2867 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); |
| 2847 | 2868 |
| 2848 // Allocate initial string table. | 2869 // Allocate initial string table. |
| 2849 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); | 2870 { MaybeObject* maybe_obj = |
| 2871 StringTable::Allocate(this, kInitialStringTableSize); |
| 2872 if (!maybe_obj->ToObject(&obj)) return false; |
| 2873 } |
| 2874 // Don't use set_string_table() due to asserts. |
| 2875 roots_[kStringTableRootIndex] = obj; |
| 2850 | 2876 |
| 2851 // Finish initializing oddballs after creating the string table. | 2877 // Finish initializing oddballs after creating the string table. |
| 2852 Oddball::Initialize(isolate(), | 2878 { MaybeObject* maybe_obj = |
| 2853 factory->undefined_value(), | 2879 undefined_value()->Initialize(this, |
| 2854 "undefined", | 2880 "undefined", |
| 2855 factory->nan_value(), | 2881 nan_value(), |
| 2856 Oddball::kUndefined); | 2882 Oddball::kUndefined); |
| 2883 if (!maybe_obj->ToObject(&obj)) return false; |
| 2884 } |
| 2857 | 2885 |
| 2858 // Initialize the null_value. | 2886 // Initialize the null_value. |
| 2859 Oddball::Initialize(isolate(), | 2887 { MaybeObject* maybe_obj = null_value()->Initialize( |
| 2860 factory->null_value(), | 2888 this, "null", Smi::FromInt(0), Oddball::kNull); |
| 2861 "null", | 2889 if (!maybe_obj->ToObject(&obj)) return false; |
| 2862 handle(Smi::FromInt(0), isolate()), | 2890 } |
| 2863 Oddball::kNull); | |
| 2864 | 2891 |
| 2865 set_true_value(*factory->NewOddball(factory->boolean_map(), | 2892 { MaybeObject* maybe_obj = CreateOddball(boolean_map(), |
| 2866 "true", | 2893 "true", |
| 2867 handle(Smi::FromInt(1), isolate()), | 2894 Smi::FromInt(1), |
| 2868 Oddball::kTrue)); | 2895 Oddball::kTrue); |
| 2896 if (!maybe_obj->ToObject(&obj)) return false; |
| 2897 } |
| 2898 set_true_value(Oddball::cast(obj)); |
| 2869 | 2899 |
| 2870 set_false_value(*factory->NewOddball(factory->boolean_map(), | 2900 { MaybeObject* maybe_obj = CreateOddball(boolean_map(), |
| 2871 "false", | 2901 "false", |
| 2872 handle(Smi::FromInt(0), isolate()), | 2902 Smi::FromInt(0), |
| 2873 Oddball::kFalse)); | 2903 Oddball::kFalse); |
| 2904 if (!maybe_obj->ToObject(&obj)) return false; |
| 2905 } |
| 2906 set_false_value(Oddball::cast(obj)); |
| 2874 | 2907 |
| 2875 set_the_hole_value(*factory->NewOddball(factory->the_hole_map(), | 2908 { MaybeObject* maybe_obj = CreateOddball(the_hole_map(), |
| 2876 "hole", | 2909 "hole", |
| 2877 handle(Smi::FromInt(-1), isolate()), | 2910 Smi::FromInt(-1), |
| 2878 Oddball::kTheHole)); | 2911 Oddball::kTheHole); |
| 2912 if (!maybe_obj->ToObject(&obj)) return false; |
| 2913 } |
| 2914 set_the_hole_value(Oddball::cast(obj)); |
| 2879 | 2915 |
| 2880 set_uninitialized_value( | 2916 { MaybeObject* maybe_obj = CreateOddball(uninitialized_map(), |
| 2881 *factory->NewOddball(factory->uninitialized_map(), | 2917 "uninitialized", |
| 2882 "uninitialized", | 2918 Smi::FromInt(-1), |
| 2883 handle(Smi::FromInt(-1), isolate()), | 2919 Oddball::kUninitialized); |
| 2884 Oddball::kUninitialized)); | 2920 if (!maybe_obj->ToObject(&obj)) return false; |
| 2921 } |
| 2922 set_uninitialized_value(Oddball::cast(obj)); |
| 2885 | 2923 |
| 2886 set_arguments_marker(*factory->NewOddball(factory->arguments_marker_map(), | 2924 { MaybeObject* maybe_obj = CreateOddball(arguments_marker_map(), |
| 2887 "arguments_marker", | 2925 "arguments_marker", |
| 2888 handle(Smi::FromInt(-4), isolate()), | 2926 Smi::FromInt(-4), |
| 2889 Oddball::kArgumentMarker)); | 2927 Oddball::kArgumentMarker); |
| 2928 if (!maybe_obj->ToObject(&obj)) return false; |
| 2929 } |
| 2930 set_arguments_marker(Oddball::cast(obj)); |
| 2890 | 2931 |
| 2891 set_no_interceptor_result_sentinel( | 2932 { MaybeObject* maybe_obj = CreateOddball(no_interceptor_result_sentinel_map(), |
| 2892 *factory->NewOddball(factory->no_interceptor_result_sentinel_map(), | 2933 "no_interceptor_result_sentinel", |
| 2893 "no_interceptor_result_sentinel", | 2934 Smi::FromInt(-2), |
| 2894 handle(Smi::FromInt(-2), isolate()), | 2935 Oddball::kOther); |
| 2895 Oddball::kOther)); | 2936 if (!maybe_obj->ToObject(&obj)) return false; |
| 2937 } |
| 2938 set_no_interceptor_result_sentinel(Oddball::cast(obj)); |
| 2896 | 2939 |
| 2897 set_termination_exception( | 2940 { MaybeObject* maybe_obj = CreateOddball(termination_exception_map(), |
| 2898 *factory->NewOddball(factory->termination_exception_map(), | 2941 "termination_exception", |
| 2899 "termination_exception", | 2942 Smi::FromInt(-3), |
| 2900 handle(Smi::FromInt(-3), isolate()), | 2943 Oddball::kOther); |
| 2901 Oddball::kOther)); | 2944 if (!maybe_obj->ToObject(&obj)) return false; |
| 2945 } |
| 2946 set_termination_exception(Oddball::cast(obj)); |
| 2902 | 2947 |
| 2903 for (unsigned i = 0; i < ARRAY_SIZE(constant_string_table); i++) { | 2948 for (unsigned i = 0; i < ARRAY_SIZE(constant_string_table); i++) { |
| 2904 Handle<String> str = | 2949 { MaybeObject* maybe_obj = |
| 2905 factory->InternalizeUtf8String(constant_string_table[i].contents); | 2950 InternalizeUtf8String(constant_string_table[i].contents); |
| 2906 roots_[constant_string_table[i].index] = *str; | 2951 if (!maybe_obj->ToObject(&obj)) return false; |
| 2952 } |
| 2953 roots_[constant_string_table[i].index] = String::cast(obj); |
| 2907 } | 2954 } |
| 2908 | 2955 |
| 2909 Object* obj; | |
| 2910 | |
| 2911 // Allocate the hidden string which is used to identify the hidden properties | 2956 // Allocate the hidden string which is used to identify the hidden properties |
| 2912 // in JSObjects. The hash code has a special value so that it will not match | 2957 // in JSObjects. The hash code has a special value so that it will not match |
| 2913 // the empty string when searching for the property. It cannot be part of the | 2958 // the empty string when searching for the property. It cannot be part of the |
| 2914 // loop above because it needs to be allocated manually with the special | 2959 // loop above because it needs to be allocated manually with the special |
| 2915 // hash code in place. The hash code for the hidden_string is zero to ensure | 2960 // hash code in place. The hash code for the hidden_string is zero to ensure |
| 2916 // that it will always be at the first entry in property descriptors. | 2961 // that it will always be at the first entry in property descriptors. |
| 2917 { MaybeObject* maybe_obj = AllocateOneByteInternalizedString( | 2962 { MaybeObject* maybe_obj = AllocateOneByteInternalizedString( |
| 2918 OneByteVector("", 0), String::kEmptyStringHash); | 2963 OneByteVector("", 0), String::kEmptyStringHash); |
| 2919 if (!maybe_obj->ToObject(&obj)) return false; | 2964 if (!maybe_obj->ToObject(&obj)) return false; |
| 2920 } | 2965 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2940 } | 2985 } |
| 2941 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); | 2986 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); |
| 2942 | 2987 |
| 2943 set_instanceof_cache_function(Smi::FromInt(0)); | 2988 set_instanceof_cache_function(Smi::FromInt(0)); |
| 2944 set_instanceof_cache_map(Smi::FromInt(0)); | 2989 set_instanceof_cache_map(Smi::FromInt(0)); |
| 2945 set_instanceof_cache_answer(Smi::FromInt(0)); | 2990 set_instanceof_cache_answer(Smi::FromInt(0)); |
| 2946 | 2991 |
| 2947 CreateFixedStubs(); | 2992 CreateFixedStubs(); |
| 2948 | 2993 |
| 2949 // Allocate the dictionary of intrinsic function names. | 2994 // Allocate the dictionary of intrinsic function names. |
| 2950 { | 2995 { MaybeObject* maybe_obj = |
| 2951 Handle<NameDictionary> function_names = | 2996 NameDictionary::Allocate(this, Runtime::kNumFunctions); |
| 2952 NameDictionary::New(isolate(), Runtime::kNumFunctions); | 2997 if (!maybe_obj->ToObject(&obj)) return false; |
| 2953 Runtime::InitializeIntrinsicFunctionNames(isolate(), function_names); | |
| 2954 set_intrinsic_function_names(*function_names); | |
| 2955 } | 2998 } |
| 2999 set_intrinsic_function_names(NameDictionary::cast(obj)); |
| 2956 | 3000 |
| 2957 { MaybeObject* maybe_obj = AllocateInitialNumberStringCache(); | 3001 { MaybeObject* maybe_obj = AllocateInitialNumberStringCache(); |
| 2958 if (!maybe_obj->ToObject(&obj)) return false; | 3002 if (!maybe_obj->ToObject(&obj)) return false; |
| 2959 } | 3003 } |
| 2960 set_number_string_cache(FixedArray::cast(obj)); | 3004 set_number_string_cache(FixedArray::cast(obj)); |
| 2961 | 3005 |
| 2962 // Allocate cache for single character one byte strings. | 3006 // Allocate cache for single character one byte strings. |
| 2963 { MaybeObject* maybe_obj = | 3007 { MaybeObject* maybe_obj = |
| 2964 AllocateFixedArray(String::kMaxOneByteCharCode + 1, TENURED); | 3008 AllocateFixedArray(String::kMaxOneByteCharCode + 1, TENURED); |
| 2965 if (!maybe_obj->ToObject(&obj)) return false; | 3009 if (!maybe_obj->ToObject(&obj)) return false; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 index = | 3188 index = |
| 3145 ((index + kArrayEntriesPerCacheEntry) & (kRegExpResultsCacheSize - 1)); | 3189 ((index + kArrayEntriesPerCacheEntry) & (kRegExpResultsCacheSize - 1)); |
| 3146 if (cache->get(index + kStringOffset) == key_string && | 3190 if (cache->get(index + kStringOffset) == key_string && |
| 3147 cache->get(index + kPatternOffset) == key_pattern) { | 3191 cache->get(index + kPatternOffset) == key_pattern) { |
| 3148 return cache->get(index + kArrayOffset); | 3192 return cache->get(index + kArrayOffset); |
| 3149 } | 3193 } |
| 3150 return Smi::FromInt(0); | 3194 return Smi::FromInt(0); |
| 3151 } | 3195 } |
| 3152 | 3196 |
| 3153 | 3197 |
| 3154 void RegExpResultsCache::Enter(Isolate* isolate, | 3198 void RegExpResultsCache::Enter(Heap* heap, |
| 3155 Handle<String> key_string, | 3199 String* key_string, |
| 3156 Handle<Object> key_pattern, | 3200 Object* key_pattern, |
| 3157 Handle<FixedArray> value_array, | 3201 FixedArray* value_array, |
| 3158 ResultsCacheType type) { | 3202 ResultsCacheType type) { |
| 3159 Factory* factory = isolate->factory(); | 3203 FixedArray* cache; |
| 3160 Handle<FixedArray> cache; | |
| 3161 if (!key_string->IsInternalizedString()) return; | 3204 if (!key_string->IsInternalizedString()) return; |
| 3162 if (type == STRING_SPLIT_SUBSTRINGS) { | 3205 if (type == STRING_SPLIT_SUBSTRINGS) { |
| 3163 ASSERT(key_pattern->IsString()); | 3206 ASSERT(key_pattern->IsString()); |
| 3164 if (!key_pattern->IsInternalizedString()) return; | 3207 if (!key_pattern->IsInternalizedString()) return; |
| 3165 cache = factory->string_split_cache(); | 3208 cache = heap->string_split_cache(); |
| 3166 } else { | 3209 } else { |
| 3167 ASSERT(type == REGEXP_MULTIPLE_INDICES); | 3210 ASSERT(type == REGEXP_MULTIPLE_INDICES); |
| 3168 ASSERT(key_pattern->IsFixedArray()); | 3211 ASSERT(key_pattern->IsFixedArray()); |
| 3169 cache = factory->regexp_multiple_cache(); | 3212 cache = heap->regexp_multiple_cache(); |
| 3170 } | 3213 } |
| 3171 | 3214 |
| 3172 uint32_t hash = key_string->Hash(); | 3215 uint32_t hash = key_string->Hash(); |
| 3173 uint32_t index = ((hash & (kRegExpResultsCacheSize - 1)) & | 3216 uint32_t index = ((hash & (kRegExpResultsCacheSize - 1)) & |
| 3174 ~(kArrayEntriesPerCacheEntry - 1)); | 3217 ~(kArrayEntriesPerCacheEntry - 1)); |
| 3175 if (cache->get(index + kStringOffset) == Smi::FromInt(0)) { | 3218 if (cache->get(index + kStringOffset) == Smi::FromInt(0)) { |
| 3176 cache->set(index + kStringOffset, *key_string); | 3219 cache->set(index + kStringOffset, key_string); |
| 3177 cache->set(index + kPatternOffset, *key_pattern); | 3220 cache->set(index + kPatternOffset, key_pattern); |
| 3178 cache->set(index + kArrayOffset, *value_array); | 3221 cache->set(index + kArrayOffset, value_array); |
| 3179 } else { | 3222 } else { |
| 3180 uint32_t index2 = | 3223 uint32_t index2 = |
| 3181 ((index + kArrayEntriesPerCacheEntry) & (kRegExpResultsCacheSize - 1)); | 3224 ((index + kArrayEntriesPerCacheEntry) & (kRegExpResultsCacheSize - 1)); |
| 3182 if (cache->get(index2 + kStringOffset) == Smi::FromInt(0)) { | 3225 if (cache->get(index2 + kStringOffset) == Smi::FromInt(0)) { |
| 3183 cache->set(index2 + kStringOffset, *key_string); | 3226 cache->set(index2 + kStringOffset, key_string); |
| 3184 cache->set(index2 + kPatternOffset, *key_pattern); | 3227 cache->set(index2 + kPatternOffset, key_pattern); |
| 3185 cache->set(index2 + kArrayOffset, *value_array); | 3228 cache->set(index2 + kArrayOffset, value_array); |
| 3186 } else { | 3229 } else { |
| 3187 cache->set(index2 + kStringOffset, Smi::FromInt(0)); | 3230 cache->set(index2 + kStringOffset, Smi::FromInt(0)); |
| 3188 cache->set(index2 + kPatternOffset, Smi::FromInt(0)); | 3231 cache->set(index2 + kPatternOffset, Smi::FromInt(0)); |
| 3189 cache->set(index2 + kArrayOffset, Smi::FromInt(0)); | 3232 cache->set(index2 + kArrayOffset, Smi::FromInt(0)); |
| 3190 cache->set(index + kStringOffset, *key_string); | 3233 cache->set(index + kStringOffset, key_string); |
| 3191 cache->set(index + kPatternOffset, *key_pattern); | 3234 cache->set(index + kPatternOffset, key_pattern); |
| 3192 cache->set(index + kArrayOffset, *value_array); | 3235 cache->set(index + kArrayOffset, value_array); |
| 3193 } | 3236 } |
| 3194 } | 3237 } |
| 3195 // If the array is a reasonably short list of substrings, convert it into a | 3238 // If the array is a reasonably short list of substrings, convert it into a |
| 3196 // list of internalized strings. | 3239 // list of internalized strings. |
| 3197 if (type == STRING_SPLIT_SUBSTRINGS && value_array->length() < 100) { | 3240 if (type == STRING_SPLIT_SUBSTRINGS && value_array->length() < 100) { |
| 3198 for (int i = 0; i < value_array->length(); i++) { | 3241 for (int i = 0; i < value_array->length(); i++) { |
| 3199 Handle<String> str(String::cast(value_array->get(i)), isolate); | 3242 String* str = String::cast(value_array->get(i)); |
| 3200 Handle<String> internalized_str = factory->InternalizeString(str); | 3243 Object* internalized_str; |
| 3201 value_array->set(i, *internalized_str); | 3244 MaybeObject* maybe_string = heap->InternalizeString(str); |
| 3245 if (maybe_string->ToObject(&internalized_str)) { |
| 3246 value_array->set(i, internalized_str); |
| 3247 } |
| 3202 } | 3248 } |
| 3203 } | 3249 } |
| 3204 // Convert backing store to a copy-on-write array. | 3250 // Convert backing store to a copy-on-write array. |
| 3205 value_array->set_map_no_write_barrier(*factory->fixed_cow_array_map()); | 3251 value_array->set_map_no_write_barrier(heap->fixed_cow_array_map()); |
| 3206 } | 3252 } |
| 3207 | 3253 |
| 3208 | 3254 |
| 3209 void RegExpResultsCache::Clear(FixedArray* cache) { | 3255 void RegExpResultsCache::Clear(FixedArray* cache) { |
| 3210 for (int i = 0; i < kRegExpResultsCacheSize; i++) { | 3256 for (int i = 0; i < kRegExpResultsCacheSize; i++) { |
| 3211 cache->set(i, Smi::FromInt(0)); | 3257 cache->set(i, Smi::FromInt(0)); |
| 3212 } | 3258 } |
| 3213 } | 3259 } |
| 3214 | 3260 |
| 3215 | 3261 |
| (...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5919 } | 5965 } |
| 5920 | 5966 |
| 5921 | 5967 |
| 5922 bool Heap::CreateHeapObjects() { | 5968 bool Heap::CreateHeapObjects() { |
| 5923 // Create initial maps. | 5969 // Create initial maps. |
| 5924 if (!CreateInitialMaps()) return false; | 5970 if (!CreateInitialMaps()) return false; |
| 5925 if (!CreateApiObjects()) return false; | 5971 if (!CreateApiObjects()) return false; |
| 5926 | 5972 |
| 5927 // Create initial objects | 5973 // Create initial objects |
| 5928 if (!CreateInitialObjects()) return false; | 5974 if (!CreateInitialObjects()) return false; |
| 5929 CHECK_EQ(0, gc_count_); | |
| 5930 | 5975 |
| 5931 native_contexts_list_ = undefined_value(); | 5976 native_contexts_list_ = undefined_value(); |
| 5932 array_buffers_list_ = undefined_value(); | 5977 array_buffers_list_ = undefined_value(); |
| 5933 allocation_sites_list_ = undefined_value(); | 5978 allocation_sites_list_ = undefined_value(); |
| 5934 weak_object_to_code_table_ = undefined_value(); | 5979 weak_object_to_code_table_ = undefined_value(); |
| 5980 |
| 5981 HandleScope scope(isolate()); |
| 5982 Runtime::InitializeIntrinsicFunctionNames( |
| 5983 isolate(), handle(intrinsic_function_names(), isolate())); |
| 5984 |
| 5935 return true; | 5985 return true; |
| 5936 } | 5986 } |
| 5937 | 5987 |
| 5938 | 5988 |
| 5939 void Heap::SetStackLimits() { | 5989 void Heap::SetStackLimits() { |
| 5940 ASSERT(isolate_ != NULL); | 5990 ASSERT(isolate_ != NULL); |
| 5941 ASSERT(isolate_ == isolate()); | 5991 ASSERT(isolate_ == isolate()); |
| 5942 // On 64 bit machines, pointers are generally out of range of Smis. We write | 5992 // On 64 bit machines, pointers are generally out of range of Smis. We write |
| 5943 // something that looks like an out of range Smi to the GC. | 5993 // something that looks like an out of range Smi to the GC. |
| 5944 | 5994 |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7108 static_cast<int>(object_sizes_last_time_[index])); | 7158 static_cast<int>(object_sizes_last_time_[index])); |
| 7109 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7159 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7110 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7160 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7111 | 7161 |
| 7112 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7162 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7113 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7163 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7114 ClearObjectStats(); | 7164 ClearObjectStats(); |
| 7115 } | 7165 } |
| 7116 | 7166 |
| 7117 } } // namespace v8::internal | 7167 } } // namespace v8::internal |
| OLD | NEW |