| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 PagedSpaces spaces(this); | 499 PagedSpaces spaces(this); |
| 500 for (PagedSpace* space = spaces.next(); | 500 for (PagedSpace* space = spaces.next(); |
| 501 space != NULL; | 501 space != NULL; |
| 502 space = spaces.next()) { | 502 space = spaces.next()) { |
| 503 space->RepairFreeListsAfterBoot(); | 503 space->RepairFreeListsAfterBoot(); |
| 504 } | 504 } |
| 505 } | 505 } |
| 506 | 506 |
| 507 | 507 |
| 508 void Heap::ProcessPretenuringFeedback() { | 508 void Heap::ProcessPretenuringFeedback() { |
| 509 if (FLAG_allocation_site_pretenuring && | 509 if (FLAG_allocation_site_pretenuring) { |
| 510 new_space_high_promotion_mode_active_) { | |
| 511 int tenure_decisions = 0; | 510 int tenure_decisions = 0; |
| 512 int dont_tenure_decisions = 0; | 511 int dont_tenure_decisions = 0; |
| 513 int allocation_mementos_found = 0; | 512 int allocation_mementos_found = 0; |
| 514 int allocation_sites = 0; | 513 int allocation_sites = 0; |
| 515 int active_allocation_sites = 0; | 514 int active_allocation_sites = 0; |
| 516 | 515 |
| 517 // If the scratchpad overflowed, we have to iterate over the allocation | 516 // If the scratchpad overflowed, we have to iterate over the allocation |
| 518 // sites list. | 517 // sites list. |
| 519 bool use_scratchpad = | 518 bool use_scratchpad = |
| 520 allocation_sites_scratchpad_length < kAllocationSiteScratchpadSize; | 519 allocation_sites_scratchpad_length < kAllocationSiteScratchpadSize; |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 // have to limit maximal capacity of the young generation. | 1105 // have to limit maximal capacity of the young generation. |
| 1107 SetNewSpaceHighPromotionModeActive(true); | 1106 SetNewSpaceHighPromotionModeActive(true); |
| 1108 if (FLAG_trace_gc) { | 1107 if (FLAG_trace_gc) { |
| 1109 PrintPID("Limited new space size due to high promotion rate: %d MB\n", | 1108 PrintPID("Limited new space size due to high promotion rate: %d MB\n", |
| 1110 new_space_.InitialCapacity() / MB); | 1109 new_space_.InitialCapacity() / MB); |
| 1111 } | 1110 } |
| 1112 // The high promotion mode is our indicator to turn on pretenuring. We have | 1111 // The high promotion mode is our indicator to turn on pretenuring. We have |
| 1113 // to deoptimize all optimized code in global pretenuring mode and all | 1112 // to deoptimize all optimized code in global pretenuring mode and all |
| 1114 // code which should be tenured in local pretenuring mode. | 1113 // code which should be tenured in local pretenuring mode. |
| 1115 if (FLAG_pretenuring) { | 1114 if (FLAG_pretenuring) { |
| 1116 if (FLAG_allocation_site_pretenuring) { | 1115 if (!FLAG_allocation_site_pretenuring) { |
| 1117 ResetAllAllocationSitesDependentCode(NOT_TENURED); | |
| 1118 } else { | |
| 1119 isolate_->stack_guard()->FullDeopt(); | 1116 isolate_->stack_guard()->FullDeopt(); |
| 1120 } | 1117 } |
| 1121 } | 1118 } |
| 1122 } else if (new_space_high_promotion_mode_active_ && | 1119 } else if (new_space_high_promotion_mode_active_ && |
| 1123 IsStableOrDecreasingSurvivalTrend() && | 1120 IsStableOrDecreasingSurvivalTrend() && |
| 1124 IsLowSurvivalRate()) { | 1121 IsLowSurvivalRate()) { |
| 1125 // Decreasing low survival rates might indicate that the above high | 1122 // Decreasing low survival rates might indicate that the above high |
| 1126 // promotion mode is over and we should allow the young generation | 1123 // promotion mode is over and we should allow the young generation |
| 1127 // to grow again. | 1124 // to grow again. |
| 1128 SetNewSpaceHighPromotionModeActive(false); | 1125 SetNewSpaceHighPromotionModeActive(false); |
| (...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 // } | 3060 // } |
| 3064 // { JSConstructEntryStub stub; | 3061 // { JSConstructEntryStub stub; |
| 3065 // js_construct_entry_code_ = *stub.GetCode(); | 3062 // js_construct_entry_code_ = *stub.GetCode(); |
| 3066 // } | 3063 // } |
| 3067 // To workaround the problem, make separate functions without inlining. | 3064 // To workaround the problem, make separate functions without inlining. |
| 3068 Heap::CreateJSEntryStub(); | 3065 Heap::CreateJSEntryStub(); |
| 3069 Heap::CreateJSConstructEntryStub(); | 3066 Heap::CreateJSConstructEntryStub(); |
| 3070 } | 3067 } |
| 3071 | 3068 |
| 3072 | 3069 |
| 3073 void Heap::CreateStubsRequiringBuiltins() { | |
| 3074 HandleScope scope(isolate()); | |
| 3075 CodeStub::GenerateStubsRequiringBuiltinsAheadOfTime(isolate()); | |
| 3076 } | |
| 3077 | |
| 3078 | |
| 3079 bool Heap::CreateInitialObjects() { | 3070 bool Heap::CreateInitialObjects() { |
| 3080 Object* obj; | 3071 Object* obj; |
| 3081 | 3072 |
| 3082 // The -0 value must be set before NumberFromDouble works. | 3073 // The -0 value must be set before NumberFromDouble works. |
| 3083 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED); | 3074 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED); |
| 3084 if (!maybe_obj->ToObject(&obj)) return false; | 3075 if (!maybe_obj->ToObject(&obj)) return false; |
| 3085 } | 3076 } |
| 3086 set_minus_zero_value(HeapNumber::cast(obj)); | 3077 set_minus_zero_value(HeapNumber::cast(obj)); |
| 3087 ASSERT(std::signbit(minus_zero_value()->Number()) != 0); | 3078 ASSERT(std::signbit(minus_zero_value()->Number()) != 0); |
| 3088 | 3079 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3291 } | 3282 } |
| 3292 SeededNumberDictionary::cast(obj)->set_requires_slow_elements(); | 3283 SeededNumberDictionary::cast(obj)->set_requires_slow_elements(); |
| 3293 set_empty_slow_element_dictionary(SeededNumberDictionary::cast(obj)); | 3284 set_empty_slow_element_dictionary(SeededNumberDictionary::cast(obj)); |
| 3294 | 3285 |
| 3295 { MaybeObject* maybe_obj = AllocateSymbol(); | 3286 { MaybeObject* maybe_obj = AllocateSymbol(); |
| 3296 if (!maybe_obj->ToObject(&obj)) return false; | 3287 if (!maybe_obj->ToObject(&obj)) return false; |
| 3297 } | 3288 } |
| 3298 Symbol::cast(obj)->set_is_private(true); | 3289 Symbol::cast(obj)->set_is_private(true); |
| 3299 set_observed_symbol(Symbol::cast(obj)); | 3290 set_observed_symbol(Symbol::cast(obj)); |
| 3300 | 3291 |
| 3292 { MaybeObject* maybe_obj = AllocateFixedArray(0, TENURED); |
| 3293 if (!maybe_obj->ToObject(&obj)) return false; |
| 3294 } |
| 3295 set_materialized_objects(FixedArray::cast(obj)); |
| 3296 |
| 3301 // Handling of script id generation is in Factory::NewScript. | 3297 // Handling of script id generation is in Factory::NewScript. |
| 3302 set_last_script_id(Smi::FromInt(v8::Script::kNoScriptId)); | 3298 set_last_script_id(Smi::FromInt(v8::Script::kNoScriptId)); |
| 3303 | 3299 |
| 3304 // Initialize keyed lookup cache. | 3300 // Initialize keyed lookup cache. |
| 3305 isolate_->keyed_lookup_cache()->Clear(); | 3301 isolate_->keyed_lookup_cache()->Clear(); |
| 3306 | 3302 |
| 3307 // Initialize context slot cache. | 3303 // Initialize context slot cache. |
| 3308 isolate_->context_slot_cache()->Clear(); | 3304 isolate_->context_slot_cache()->Clear(); |
| 3309 | 3305 |
| 3310 // Initialize descriptor cache. | 3306 // Initialize descriptor cache. |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 // Initialize the object | 3970 // Initialize the object |
| 3975 result->set_map_no_write_barrier(code_map()); | 3971 result->set_map_no_write_barrier(code_map()); |
| 3976 Code* code = Code::cast(result); | 3972 Code* code = Code::cast(result); |
| 3977 ASSERT(!isolate_->code_range()->exists() || | 3973 ASSERT(!isolate_->code_range()->exists() || |
| 3978 isolate_->code_range()->contains(code->address())); | 3974 isolate_->code_range()->contains(code->address())); |
| 3979 code->set_instruction_size(desc.instr_size); | 3975 code->set_instruction_size(desc.instr_size); |
| 3980 code->set_relocation_info(reloc_info); | 3976 code->set_relocation_info(reloc_info); |
| 3981 code->set_flags(flags); | 3977 code->set_flags(flags); |
| 3982 code->set_raw_kind_specific_flags1(0); | 3978 code->set_raw_kind_specific_flags1(0); |
| 3983 code->set_raw_kind_specific_flags2(0); | 3979 code->set_raw_kind_specific_flags2(0); |
| 3984 if (code->is_call_stub() || code->is_keyed_call_stub()) { | |
| 3985 code->set_check_type(RECEIVER_MAP_CHECK); | |
| 3986 } | |
| 3987 code->set_is_crankshafted(crankshafted); | 3980 code->set_is_crankshafted(crankshafted); |
| 3988 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3981 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 3989 code->set_raw_type_feedback_info(undefined_value()); | 3982 code->set_raw_type_feedback_info(undefined_value()); |
| 3990 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3983 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 3991 code->set_gc_metadata(Smi::FromInt(0)); | 3984 code->set_gc_metadata(Smi::FromInt(0)); |
| 3992 code->set_ic_age(global_ic_age_); | 3985 code->set_ic_age(global_ic_age_); |
| 3993 code->set_prologue_offset(prologue_offset); | 3986 code->set_prologue_offset(prologue_offset); |
| 3994 if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 3987 if (code->kind() == Code::OPTIMIZED_FUNCTION) { |
| 3995 code->set_marked_for_deoptimization(false); | 3988 code->set_marked_for_deoptimization(false); |
| 3996 } | 3989 } |
| (...skipping 3669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7666 static_cast<int>(object_sizes_last_time_[index])); | 7659 static_cast<int>(object_sizes_last_time_[index])); |
| 7667 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7660 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7668 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7661 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7669 | 7662 |
| 7670 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7663 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7671 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7664 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7672 ClearObjectStats(); | 7665 ClearObjectStats(); |
| 7673 } | 7666 } |
| 7674 | 7667 |
| 7675 } } // namespace v8::internal | 7668 } } // namespace v8::internal |
| OLD | NEW |