Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(903)

Side by Side Diff: src/heap.cc

Issue 255003002: Make CreateInitialObjects more concise. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 } 2413 }
2414 #ifdef DEBUG 2414 #ifdef DEBUG
2415 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); 2415 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address());
2416 ASSERT(chunk->owner()->identity() == space); 2416 ASSERT(chunk->owner()->identity() == space);
2417 #endif 2417 #endif
2418 CreateFillerObjectAt(allocation->address(), size); 2418 CreateFillerObjectAt(allocation->address(), size);
2419 return allocation; 2419 return allocation;
2420 } 2420 }
2421 2421
2422 2422
2423 MaybeObject* Heap::AllocatePolymorphicCodeCache() {
2424 return AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE);
2425 }
2426
2427
2428 const Heap::StringTypeTable Heap::string_type_table[] = { 2423 const Heap::StringTypeTable Heap::string_type_table[] = {
2429 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ 2424 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \
2430 {type, size, k##camel_name##MapRootIndex}, 2425 {type, size, k##camel_name##MapRootIndex},
2431 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) 2426 STRING_TYPE_LIST(STRING_TYPE_ELEMENT)
2432 #undef STRING_TYPE_ELEMENT 2427 #undef STRING_TYPE_ELEMENT
2433 }; 2428 };
2434 2429
2435 2430
2436 const Heap::ConstantStringTable Heap::constant_string_table[] = { 2431 const Heap::ConstantStringTable Heap::constant_string_table[] = {
2437 #define CONSTANT_STRING_ELEMENT(name, contents) \ 2432 #define CONSTANT_STRING_ELEMENT(name, contents) \
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 global_property_cell_map()); 2732 global_property_cell_map());
2738 PropertyCell* cell = PropertyCell::cast(result); 2733 PropertyCell* cell = PropertyCell::cast(result);
2739 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), 2734 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()),
2740 SKIP_WRITE_BARRIER); 2735 SKIP_WRITE_BARRIER);
2741 cell->set_value(the_hole_value()); 2736 cell->set_value(the_hole_value());
2742 cell->set_type(HeapType::None()); 2737 cell->set_type(HeapType::None());
2743 return result; 2738 return result;
2744 } 2739 }
2745 2740
2746 2741
2747 bool Heap::CreateApiObjects() { 2742 void Heap::CreateApiObjects() {
2748 Object* obj; 2743 HandleScope scope(isolate());
2744 Factory* factory = isolate()->factory();
2745 Handle<Map> new_neander_map =
2746 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
2749 2747
2750 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
2751 if (!maybe_obj->ToObject(&obj)) return false;
2752 }
2753 // Don't use Smi-only elements optimizations for objects with the neander 2748 // Don't use Smi-only elements optimizations for objects with the neander
2754 // map. There are too many cases where element values are set directly with a 2749 // map. There are too many cases where element values are set directly with a
2755 // bottleneck to trap the Smi-only -> fast elements transition, and there 2750 // bottleneck to trap the Smi-only -> fast elements transition, and there
2756 // appears to be no benefit for optimize this case. 2751 // appears to be no benefit for optimize this case.
2757 Map* new_neander_map = Map::cast(obj);
2758 new_neander_map->set_elements_kind(TERMINAL_FAST_ELEMENTS_KIND); 2752 new_neander_map->set_elements_kind(TERMINAL_FAST_ELEMENTS_KIND);
2759 set_neander_map(new_neander_map); 2753 set_neander_map(*new_neander_map);
2760 2754
2761 { MaybeObject* maybe_obj = AllocateJSObjectFromMap(neander_map()); 2755 Handle<JSObject> listeners = factory->NewNeanderObject();
2762 if (!maybe_obj->ToObject(&obj)) return false; 2756 Handle<FixedArray> elements = factory->NewFixedArray(2);
2763 } 2757 elements->set(0, Smi::FromInt(0));
2764 Object* elements; 2758 listeners->set_elements(*elements);
2765 { MaybeObject* maybe_elements = AllocateFixedArray(2); 2759 set_message_listeners(*listeners);
2766 if (!maybe_elements->ToObject(&elements)) return false;
2767 }
2768 FixedArray::cast(elements)->set(0, Smi::FromInt(0));
2769 JSObject::cast(obj)->set_elements(FixedArray::cast(elements));
2770 set_message_listeners(JSObject::cast(obj));
2771
2772 return true;
2773 } 2760 }
2774 2761
2775 2762
2776 void Heap::CreateJSEntryStub() { 2763 void Heap::CreateJSEntryStub() {
2777 JSEntryStub stub(isolate()); 2764 JSEntryStub stub(isolate());
2778 set_js_entry_code(*stub.GetCode()); 2765 set_js_entry_code(*stub.GetCode());
2779 } 2766 }
2780 2767
2781 2768
2782 void Heap::CreateJSConstructEntryStub() { 2769 void Heap::CreateJSConstructEntryStub() {
(...skipping 25 matching lines...) Expand all
2808 // } 2795 // }
2809 // { JSConstructEntryStub stub; 2796 // { JSConstructEntryStub stub;
2810 // js_construct_entry_code_ = *stub.GetCode(); 2797 // js_construct_entry_code_ = *stub.GetCode();
2811 // } 2798 // }
2812 // To workaround the problem, make separate functions without inlining. 2799 // To workaround the problem, make separate functions without inlining.
2813 Heap::CreateJSEntryStub(); 2800 Heap::CreateJSEntryStub();
2814 Heap::CreateJSConstructEntryStub(); 2801 Heap::CreateJSConstructEntryStub();
2815 } 2802 }
2816 2803
2817 2804
2818 bool Heap::CreateInitialObjects() { 2805 void Heap::CreateInitialObjects() {
2819 HandleScope scope(isolate()); 2806 HandleScope scope(isolate());
2820 Factory* factory = isolate()->factory(); 2807 Factory* factory = isolate()->factory();
2821 2808
2822 // The -0 value must be set before NumberFromDouble works. 2809 // The -0 value must be set before NumberFromDouble works.
2823 set_minus_zero_value(*factory->NewHeapNumber(-0.0, TENURED)); 2810 set_minus_zero_value(*factory->NewHeapNumber(-0.0, TENURED));
2824 ASSERT(std::signbit(minus_zero_value()->Number()) != 0); 2811 ASSERT(std::signbit(minus_zero_value()->Number()) != 0);
2825 2812
2826 set_nan_value(*factory->NewHeapNumber(OS::nan_value(), TENURED)); 2813 set_nan_value(*factory->NewHeapNumber(OS::nan_value(), TENURED));
2827 set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, TENURED)); 2814 set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, TENURED));
2828 2815
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 "exception", 2877 "exception",
2891 handle(Smi::FromInt(-5), isolate()), 2878 handle(Smi::FromInt(-5), isolate()),
2892 Oddball::kException)); 2879 Oddball::kException));
2893 2880
2894 for (unsigned i = 0; i < ARRAY_SIZE(constant_string_table); i++) { 2881 for (unsigned i = 0; i < ARRAY_SIZE(constant_string_table); i++) {
2895 Handle<String> str = 2882 Handle<String> str =
2896 factory->InternalizeUtf8String(constant_string_table[i].contents); 2883 factory->InternalizeUtf8String(constant_string_table[i].contents);
2897 roots_[constant_string_table[i].index] = *str; 2884 roots_[constant_string_table[i].index] = *str;
2898 } 2885 }
2899 2886
2900 Object* obj;
2901
2902 // Allocate the hidden string which is used to identify the hidden properties 2887 // Allocate the hidden string which is used to identify the hidden properties
2903 // in JSObjects. The hash code has a special value so that it will not match 2888 // in JSObjects. The hash code has a special value so that it will not match
2904 // the empty string when searching for the property. It cannot be part of the 2889 // the empty string when searching for the property. It cannot be part of the
2905 // loop above because it needs to be allocated manually with the special 2890 // loop above because it needs to be allocated manually with the special
2906 // hash code in place. The hash code for the hidden_string is zero to ensure 2891 // hash code in place. The hash code for the hidden_string is zero to ensure
2907 // that it will always be at the first entry in property descriptors. 2892 // that it will always be at the first entry in property descriptors.
2908 { MaybeObject* maybe_obj = AllocateOneByteInternalizedString( 2893 hidden_string_ = *factory->NewOneByteInternalizedString(
2909 OneByteVector("", 0), String::kEmptyStringHash); 2894 OneByteVector("", 0), String::kEmptyStringHash);
2910 if (!maybe_obj->ToObject(&obj)) return false;
2911 }
2912 hidden_string_ = String::cast(obj);
2913 2895
2914 // Create the code_stubs dictionary. The initial size is set to avoid 2896 // Create the code_stubs dictionary. The initial size is set to avoid
2915 // expanding the dictionary during bootstrapping. 2897 // expanding the dictionary during bootstrapping.
2916 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); 2898 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128));
2917 2899
2918 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size 2900 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size
2919 // is set to avoid expanding the dictionary during bootstrapping. 2901 // is set to avoid expanding the dictionary during bootstrapping.
2920 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64)); 2902 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64));
2921 2903
2922 { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache(); 2904 set_polymorphic_code_cache(PolymorphicCodeCache::cast(
2923 if (!maybe_obj->ToObject(&obj)) return false; 2905 *factory->NewStruct(POLYMORPHIC_CODE_CACHE_TYPE)));
2924 }
2925 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj));
2926 2906
2927 set_instanceof_cache_function(Smi::FromInt(0)); 2907 set_instanceof_cache_function(Smi::FromInt(0));
2928 set_instanceof_cache_map(Smi::FromInt(0)); 2908 set_instanceof_cache_map(Smi::FromInt(0));
2929 set_instanceof_cache_answer(Smi::FromInt(0)); 2909 set_instanceof_cache_answer(Smi::FromInt(0));
2930 2910
2931 CreateFixedStubs(); 2911 CreateFixedStubs();
2932 2912
2933 // Allocate the dictionary of intrinsic function names. 2913 // Allocate the dictionary of intrinsic function names.
2934 { 2914 Handle<NameDictionary> intrinsic_names =
2935 Handle<NameDictionary> function_names = 2915 NameDictionary::New(isolate(), Runtime::kNumFunctions);
2936 NameDictionary::New(isolate(), Runtime::kNumFunctions); 2916 Runtime::InitializeIntrinsicFunctionNames(isolate(), intrinsic_names);
2937 Runtime::InitializeIntrinsicFunctionNames(isolate(), function_names); 2917 set_intrinsic_function_names(*intrinsic_names);
2938 set_intrinsic_function_names(*function_names);
2939 }
2940 2918
2941 { MaybeObject* maybe_obj = AllocateInitialNumberStringCache(); 2919 set_number_string_cache(*factory->NewFixedArray(
2942 if (!maybe_obj->ToObject(&obj)) return false; 2920 kInitialNumberStringCacheSize * 2, TENURED));
2943 }
2944 set_number_string_cache(FixedArray::cast(obj));
2945 2921
2946 // Allocate cache for single character one byte strings. 2922 // Allocate cache for single character one byte strings.
2947 { MaybeObject* maybe_obj = 2923 set_single_character_string_cache(*factory->NewFixedArray(
2948 AllocateFixedArray(String::kMaxOneByteCharCode + 1, TENURED); 2924 String::kMaxOneByteCharCode + 1, TENURED));
2949 if (!maybe_obj->ToObject(&obj)) return false;
2950 }
2951 set_single_character_string_cache(FixedArray::cast(obj));
2952 2925
2953 // Allocate cache for string split. 2926 // Allocate cache for string split and regexp-multiple.
2954 { MaybeObject* maybe_obj = AllocateFixedArray( 2927 set_string_split_cache(*factory->NewFixedArray(
2955 RegExpResultsCache::kRegExpResultsCacheSize, TENURED); 2928 RegExpResultsCache::kRegExpResultsCacheSize, TENURED));
2956 if (!maybe_obj->ToObject(&obj)) return false; 2929 set_regexp_multiple_cache(*factory->NewFixedArray(
2957 } 2930 RegExpResultsCache::kRegExpResultsCacheSize, TENURED));
2958 set_string_split_cache(FixedArray::cast(obj));
2959
2960 { MaybeObject* maybe_obj = AllocateFixedArray(
2961 RegExpResultsCache::kRegExpResultsCacheSize, TENURED);
2962 if (!maybe_obj->ToObject(&obj)) return false;
2963 }
2964 set_regexp_multiple_cache(FixedArray::cast(obj));
2965 2931
2966 // Allocate cache for external strings pointing to native source code. 2932 // Allocate cache for external strings pointing to native source code.
2967 { MaybeObject* maybe_obj = AllocateFixedArray(Natives::GetBuiltinsCount()); 2933 set_natives_source_cache(*factory->NewFixedArray(
2968 if (!maybe_obj->ToObject(&obj)) return false; 2934 Natives::GetBuiltinsCount()));
2969 }
2970 set_natives_source_cache(FixedArray::cast(obj));
2971 2935
2972 { MaybeObject* maybe_obj = AllocateCell(undefined_value()); 2936 set_undefined_cell(*factory->NewCell(factory->undefined_value()));
2973 if (!maybe_obj->ToObject(&obj)) return false;
2974 }
2975 set_undefined_cell(Cell::cast(obj));
2976 2937
2977 // The symbol registry is initialized lazily. 2938 // The symbol registry is initialized lazily.
2978 set_symbol_registry(undefined_value()); 2939 set_symbol_registry(undefined_value());
2979 2940
2980 // Allocate object to hold object observation state. 2941 // Allocate object to hold object observation state.
2981 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 2942 set_observation_state(*factory->NewJSObjectFromMap(
2982 if (!maybe_obj->ToObject(&obj)) return false; 2943 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize)));
2983 }
2984 { MaybeObject* maybe_obj = AllocateJSObjectFromMap(Map::cast(obj));
2985 if (!maybe_obj->ToObject(&obj)) return false;
2986 }
2987 set_observation_state(JSObject::cast(obj));
2988 2944
2989 // Allocate object to hold object microtask state. 2945 // Allocate object to hold object microtask state.
2990 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 2946 set_microtask_state(*factory->NewJSObjectFromMap(
2991 if (!maybe_obj->ToObject(&obj)) return false; 2947 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize)));
2992 }
2993 { MaybeObject* maybe_obj = AllocateJSObjectFromMap(Map::cast(obj));
2994 if (!maybe_obj->ToObject(&obj)) return false;
2995 }
2996 set_microtask_state(JSObject::cast(obj));
2997 2948
2998 { MaybeObject* maybe_obj = AllocateSymbol(); 2949 set_frozen_symbol(*factory->NewPrivateSymbol());
2999 if (!maybe_obj->ToObject(&obj)) return false; 2950 set_nonexistent_symbol(*factory->NewPrivateSymbol());
3000 } 2951 set_elements_transition_symbol(*factory->NewPrivateSymbol());
3001 Symbol::cast(obj)->set_is_private(true); 2952 set_uninitialized_symbol(*factory->NewPrivateSymbol());
3002 set_frozen_symbol(Symbol::cast(obj)); 2953 set_megamorphic_symbol(*factory->NewPrivateSymbol());
2954 set_observed_symbol(*factory->NewPrivateSymbol());
3003 2955
3004 { MaybeObject* maybe_obj = AllocateSymbol(); 2956 Handle<SeededNumberDictionary> slow_element_dictionary =
3005 if (!maybe_obj->ToObject(&obj)) return false; 2957 SeededNumberDictionary::New(isolate(), 0, TENURED);
3006 } 2958 slow_element_dictionary->set_requires_slow_elements();
3007 Symbol::cast(obj)->set_is_private(true); 2959 set_empty_slow_element_dictionary(*slow_element_dictionary);
3008 set_nonexistent_symbol(Symbol::cast(obj));
3009 2960
3010 { MaybeObject* maybe_obj = AllocateSymbol(); 2961 set_materialized_objects(*factory->NewFixedArray(0, TENURED));
3011 if (!maybe_obj->ToObject(&obj)) return false;
3012 }
3013 Symbol::cast(obj)->set_is_private(true);
3014 set_elements_transition_symbol(Symbol::cast(obj));
3015
3016 { MaybeObject* maybe_obj = AllocateSymbol();
3017 if (!maybe_obj->ToObject(&obj)) return false;
3018 }
3019 Symbol::cast(obj)->set_is_private(true);
3020 set_uninitialized_symbol(Symbol::cast(obj));
3021
3022 { MaybeObject* maybe_obj = AllocateSymbol();
3023 if (!maybe_obj->ToObject(&obj)) return false;
3024 }
3025 Symbol::cast(obj)->set_is_private(true);
3026 set_megamorphic_symbol(Symbol::cast(obj));
3027
3028 {
3029 Handle<SeededNumberDictionary> dict =
3030 SeededNumberDictionary::New(isolate(), 0, TENURED);
3031 dict->set_requires_slow_elements();
3032 set_empty_slow_element_dictionary(*dict);
3033 }
3034
3035 { MaybeObject* maybe_obj = AllocateSymbol();
3036 if (!maybe_obj->ToObject(&obj)) return false;
3037 }
3038 Symbol::cast(obj)->set_is_private(true);
3039 set_observed_symbol(Symbol::cast(obj));
3040
3041 { MaybeObject* maybe_obj = AllocateFixedArray(0, TENURED);
3042 if (!maybe_obj->ToObject(&obj)) return false;
3043 }
3044 set_materialized_objects(FixedArray::cast(obj));
3045 2962
3046 // Handling of script id generation is in Factory::NewScript. 2963 // Handling of script id generation is in Factory::NewScript.
3047 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); 2964 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId));
3048 2965
3049 { MaybeObject* maybe_obj = AllocateAllocationSitesScratchpad(); 2966 set_allocation_sites_scratchpad(*factory->NewFixedArray(
3050 if (!maybe_obj->ToObject(&obj)) return false; 2967 kAllocationSiteScratchpadSize, TENURED));
3051 }
3052 set_allocation_sites_scratchpad(FixedArray::cast(obj));
3053 InitializeAllocationSitesScratchpad(); 2968 InitializeAllocationSitesScratchpad();
3054 2969
3055 // Initialize keyed lookup cache. 2970 // Initialize keyed lookup cache.
3056 isolate_->keyed_lookup_cache()->Clear(); 2971 isolate_->keyed_lookup_cache()->Clear();
3057 2972
3058 // Initialize context slot cache. 2973 // Initialize context slot cache.
3059 isolate_->context_slot_cache()->Clear(); 2974 isolate_->context_slot_cache()->Clear();
3060 2975
3061 // Initialize descriptor cache. 2976 // Initialize descriptor cache.
3062 isolate_->descriptor_lookup_cache()->Clear(); 2977 isolate_->descriptor_lookup_cache()->Clear();
3063 2978
3064 // Initialize compilation cache. 2979 // Initialize compilation cache.
3065 isolate_->compilation_cache()->Clear(); 2980 isolate_->compilation_cache()->Clear();
3066
3067 return true;
3068 } 2981 }
3069 2982
3070 2983
3071 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { 2984 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) {
3072 RootListIndex writable_roots[] = { 2985 RootListIndex writable_roots[] = {
3073 kStoreBufferTopRootIndex, 2986 kStoreBufferTopRootIndex,
3074 kStackLimitRootIndex, 2987 kStackLimitRootIndex,
3075 kNumberStringCacheRootIndex, 2988 kNumberStringCacheRootIndex,
3076 kInstanceofCacheFunctionRootIndex, 2989 kInstanceofCacheFunctionRootIndex,
3077 kInstanceofCacheMapRootIndex, 2990 kInstanceofCacheMapRootIndex,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 3133
3221 void Heap::FlushNumberStringCache() { 3134 void Heap::FlushNumberStringCache() {
3222 // Flush the number to string cache. 3135 // Flush the number to string cache.
3223 int len = number_string_cache()->length(); 3136 int len = number_string_cache()->length();
3224 for (int i = 0; i < len; i++) { 3137 for (int i = 0; i < len; i++) {
3225 number_string_cache()->set_undefined(i); 3138 number_string_cache()->set_undefined(i);
3226 } 3139 }
3227 } 3140 }
3228 3141
3229 3142
3230 MaybeObject* Heap::AllocateAllocationSitesScratchpad() {
3231 MaybeObject* maybe_obj =
3232 AllocateFixedArray(kAllocationSiteScratchpadSize, TENURED);
3233 return maybe_obj;
3234 }
3235
3236
3237 void Heap::FlushAllocationSitesScratchpad() { 3143 void Heap::FlushAllocationSitesScratchpad() {
3238 for (int i = 0; i < allocation_sites_scratchpad_length_; i++) { 3144 for (int i = 0; i < allocation_sites_scratchpad_length_; i++) {
3239 allocation_sites_scratchpad()->set_undefined(i); 3145 allocation_sites_scratchpad()->set_undefined(i);
3240 } 3146 }
3241 allocation_sites_scratchpad_length_ = 0; 3147 allocation_sites_scratchpad_length_ = 0;
3242 } 3148 }
3243 3149
3244 3150
3245 void Heap::InitializeAllocationSitesScratchpad() { 3151 void Heap::InitializeAllocationSitesScratchpad() {
3246 ASSERT(allocation_sites_scratchpad()->length() == 3152 ASSERT(allocation_sites_scratchpad()->length() ==
(...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5435 5341
5436 mark_compact_collector()->SetUp(); 5342 mark_compact_collector()->SetUp();
5437 5343
5438 return true; 5344 return true;
5439 } 5345 }
5440 5346
5441 5347
5442 bool Heap::CreateHeapObjects() { 5348 bool Heap::CreateHeapObjects() {
5443 // Create initial maps. 5349 // Create initial maps.
5444 if (!CreateInitialMaps()) return false; 5350 if (!CreateInitialMaps()) return false;
5445 if (!CreateApiObjects()) return false; 5351 CreateApiObjects();
5446 5352
5447 // Create initial objects 5353 // Create initial objects
5448 if (!CreateInitialObjects()) return false; 5354 CreateInitialObjects();
5449 CHECK_EQ(0, gc_count_); 5355 CHECK_EQ(0, gc_count_);
5450 5356
5451 native_contexts_list_ = undefined_value(); 5357 native_contexts_list_ = undefined_value();
5452 array_buffers_list_ = undefined_value(); 5358 array_buffers_list_ = undefined_value();
5453 allocation_sites_list_ = undefined_value(); 5359 allocation_sites_list_ = undefined_value();
5454 weak_object_to_code_table_ = undefined_value(); 5360 weak_object_to_code_table_ = undefined_value();
5455 return true; 5361 return true;
5456 } 5362 }
5457 5363
5458 5364
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
6630 static_cast<int>(object_sizes_last_time_[index])); 6536 static_cast<int>(object_sizes_last_time_[index]));
6631 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6537 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6632 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6538 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6633 6539
6634 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6540 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6635 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6541 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6636 ClearObjectStats(); 6542 ClearObjectStats();
6637 } 6543 }
6638 6544
6639 } } // namespace v8::internal 6545 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698