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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 } | 507 } |
508 allocation_sites++; | 508 allocation_sites++; |
509 if (use_scratchpad) { | 509 if (use_scratchpad) { |
510 i++; | 510 i++; |
511 } else { | 511 } else { |
512 list_element = site->weak_next(); | 512 list_element = site->weak_next(); |
513 } | 513 } |
514 } | 514 } |
515 | 515 |
516 if (trigger_deoptimization) { | 516 if (trigger_deoptimization) { |
517 isolate_->stack_guard()->DeoptMarkedAllocationSites(); | 517 isolate_->stack_guard()->RequestDeoptMarkedAllocationSites(); |
518 } | 518 } |
519 | 519 |
520 FlushAllocationSitesScratchpad(); | 520 FlushAllocationSitesScratchpad(); |
521 | 521 |
522 if (FLAG_trace_pretenuring_statistics && | 522 if (FLAG_trace_pretenuring_statistics && |
523 (allocation_mementos_found > 0 || | 523 (allocation_mementos_found > 0 || |
524 tenure_decisions > 0 || | 524 tenure_decisions > 0 || |
525 dont_tenure_decisions > 0)) { | 525 dont_tenure_decisions > 0)) { |
526 PrintF("GC: (mode, #visited allocation sites, #active allocation sites, " | 526 PrintF("GC: (mode, #visited allocation sites, #active allocation sites, " |
527 "#mementos, #tenure decisions, #donttenure decisions) " | 527 "#mementos, #tenure decisions, #donttenure decisions) " |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 SetNewSpaceHighPromotionModeActive(true); | 1106 SetNewSpaceHighPromotionModeActive(true); |
1107 if (FLAG_trace_gc) { | 1107 if (FLAG_trace_gc) { |
1108 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", |
1109 new_space_.InitialCapacity() / MB); | 1109 new_space_.InitialCapacity() / MB); |
1110 } | 1110 } |
1111 // 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 |
1112 // to deoptimize all optimized code in global pretenuring mode and all | 1112 // to deoptimize all optimized code in global pretenuring mode and all |
1113 // code which should be tenured in local pretenuring mode. | 1113 // code which should be tenured in local pretenuring mode. |
1114 if (FLAG_pretenuring) { | 1114 if (FLAG_pretenuring) { |
1115 if (!FLAG_allocation_site_pretenuring) { | 1115 if (!FLAG_allocation_site_pretenuring) { |
1116 isolate_->stack_guard()->FullDeopt(); | 1116 isolate_->stack_guard()->RequestFullDeopt(); |
1117 } | 1117 } |
1118 } | 1118 } |
1119 } else if (new_space_high_promotion_mode_active_ && | 1119 } else if (new_space_high_promotion_mode_active_ && |
1120 IsStableOrDecreasingSurvivalTrend() && | 1120 IsStableOrDecreasingSurvivalTrend() && |
1121 IsLowSurvivalRate()) { | 1121 IsLowSurvivalRate()) { |
1122 // Decreasing low survival rates might indicate that the above high | 1122 // Decreasing low survival rates might indicate that the above high |
1123 // promotion mode is over and we should allow the young generation | 1123 // promotion mode is over and we should allow the young generation |
1124 // to grow again. | 1124 // to grow again. |
1125 SetNewSpaceHighPromotionModeActive(false); | 1125 SetNewSpaceHighPromotionModeActive(false); |
1126 if (FLAG_trace_gc) { | 1126 if (FLAG_trace_gc) { |
1127 PrintPID("Unlimited new space size due to low promotion rate: %d MB\n", | 1127 PrintPID("Unlimited new space size due to low promotion rate: %d MB\n", |
1128 new_space_.MaximumCapacity() / MB); | 1128 new_space_.MaximumCapacity() / MB); |
1129 } | 1129 } |
1130 // Trigger deoptimization here to turn off global pretenuring as soon as | 1130 // Trigger deoptimization here to turn off global pretenuring as soon as |
1131 // possible. | 1131 // possible. |
1132 if (FLAG_pretenuring && !FLAG_allocation_site_pretenuring) { | 1132 if (FLAG_pretenuring && !FLAG_allocation_site_pretenuring) { |
1133 isolate_->stack_guard()->FullDeopt(); | 1133 isolate_->stack_guard()->RequestFullDeopt(); |
1134 } | 1134 } |
1135 } | 1135 } |
1136 | 1136 |
1137 if (new_space_high_promotion_mode_active_ && | 1137 if (new_space_high_promotion_mode_active_ && |
1138 new_space_.Capacity() > new_space_.InitialCapacity()) { | 1138 new_space_.Capacity() > new_space_.InitialCapacity()) { |
1139 new_space_.Shrink(); | 1139 new_space_.Shrink(); |
1140 } | 1140 } |
1141 | 1141 |
1142 isolate_->counters()->objs_since_last_young()->Set(0); | 1142 isolate_->counters()->objs_since_last_young()->Set(0); |
1143 | 1143 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 bool marked = false; | 1745 bool marked = false; |
1746 while (cur->IsAllocationSite()) { | 1746 while (cur->IsAllocationSite()) { |
1747 AllocationSite* casted = AllocationSite::cast(cur); | 1747 AllocationSite* casted = AllocationSite::cast(cur); |
1748 if (casted->GetPretenureMode() == flag) { | 1748 if (casted->GetPretenureMode() == flag) { |
1749 casted->ResetPretenureDecision(); | 1749 casted->ResetPretenureDecision(); |
1750 casted->set_deopt_dependent_code(true); | 1750 casted->set_deopt_dependent_code(true); |
1751 marked = true; | 1751 marked = true; |
1752 } | 1752 } |
1753 cur = casted->weak_next(); | 1753 cur = casted->weak_next(); |
1754 } | 1754 } |
1755 if (marked) isolate_->stack_guard()->DeoptMarkedAllocationSites(); | 1755 if (marked) isolate_->stack_guard()->RequestDeoptMarkedAllocationSites(); |
1756 } | 1756 } |
1757 | 1757 |
1758 | 1758 |
1759 void Heap::EvaluateOldSpaceLocalPretenuring( | 1759 void Heap::EvaluateOldSpaceLocalPretenuring( |
1760 uint64_t size_of_objects_before_gc) { | 1760 uint64_t size_of_objects_before_gc) { |
1761 uint64_t size_of_objects_after_gc = SizeOfObjects(); | 1761 uint64_t size_of_objects_after_gc = SizeOfObjects(); |
1762 double old_generation_survival_rate = | 1762 double old_generation_survival_rate = |
1763 (static_cast<double>(size_of_objects_after_gc) * 100) / | 1763 (static_cast<double>(size_of_objects_after_gc) * 100) / |
1764 static_cast<double>(size_of_objects_before_gc); | 1764 static_cast<double>(size_of_objects_before_gc); |
1765 | 1765 |
(...skipping 4712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6478 static_cast<int>(object_sizes_last_time_[index])); | 6478 static_cast<int>(object_sizes_last_time_[index])); |
6479 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6479 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6480 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6480 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6481 | 6481 |
6482 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6482 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6483 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6483 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6484 ClearObjectStats(); | 6484 ClearObjectStats(); |
6485 } | 6485 } |
6486 | 6486 |
6487 } } // namespace v8::internal | 6487 } } // namespace v8::internal |
OLD | NEW |