Chromium Code Reviews| Index: runtime/vm/pages.cc |
| diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc |
| index afda7bb609034de169be4c345c4cee8e6d894b72..7f43a014d65458f251e288f90b131a293f226d52 100644 |
| --- a/runtime/vm/pages.cc |
| +++ b/runtime/vm/pages.cc |
| @@ -543,6 +543,7 @@ void PageSpace::AbandonBumpAllocation() { |
| } |
| void PageSpace::UpdateMaxCapacityLocked() { |
| +#if !defined(PRODUCT) |
| if (heap_ == NULL) { |
| // Some unit tests. |
| return; |
| @@ -552,9 +553,11 @@ void PageSpace::UpdateMaxCapacityLocked() { |
| Isolate* isolate = heap_->isolate(); |
| isolate->GetHeapOldCapacityMaxMetric()->SetValue( |
| static_cast<int64_t>(usage_.capacity_in_words) * kWordSize); |
| +#endif // !defined(PRODUCT) |
| } |
| void PageSpace::UpdateMaxUsed() { |
| +#if !defined(PRODUCT) |
| if (heap_ == NULL) { |
| // Some unit tests. |
| return; |
| @@ -563,6 +566,7 @@ void PageSpace::UpdateMaxUsed() { |
| ASSERT(heap_->isolate() != NULL); |
| Isolate* isolate = heap_->isolate(); |
| isolate->GetHeapOldUsedMaxMetric()->SetValue(UsedInWords() * kWordSize); |
| +#endif // !defined(PRODUCT) |
| } |
| bool PageSpace::Contains(uword addr) const { |
| @@ -864,8 +868,12 @@ void PageSpace::MarkSweep(bool invoke_api_callbacks) { |
| SpaceUsage usage_before = GetCurrentUsage(); |
| // Mark all reachable old-gen objects. |
| +#if defined(PRODUCT) |
| + bool collect_code = FLAG_collect_code && ShouldCollectCode(); |
| +#else |
| bool collect_code = FLAG_collect_code && ShouldCollectCode() && |
| !isolate->HasAttemptedReload(); |
| +#endif // !defined(PRODUCT) |
| GCMarker marker(heap_); |
| marker.MarkObjects(isolate, this, invoke_api_callbacks, collect_code); |
| usage_.used_in_words = marker.marked_words(); |
| @@ -1141,6 +1149,7 @@ bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const { |
| intptr_t capacity_increase_in_pages = |
| capacity_increase_in_words / PageSpace::kPageSizeInWords; |
| double multiplier = 1.0; |
| +#if !defined(PRODUCT) |
| // To avoid waste, the first GC should be triggered before too long. After |
|
zra
2017/07/24 16:56:25
Ryan, Dio, is it okay to skip this adjustment in a
rmacnak
2017/07/24 19:10:35
This has the effect of delaying the first GC for s
zra
2017/07/24 20:21:53
Acknowledged.
|
| // kInitialTimeoutSeconds, gradually lower the capacity limit. |
| static const double kInitialTimeoutSeconds = 1.00; |
| @@ -1151,6 +1160,7 @@ bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const { |
| multiplier *= seconds_since_init / kInitialTimeoutSeconds; |
| } |
| } |
| +#endif |
| bool needs_gc = capacity_increase_in_pages * multiplier > grow_heap_; |
| if (FLAG_log_growth) { |
| OS::PrintErr("%s: %" Pd " * %f %s %" Pd "\n", |