@@ -1387,7 +1387,7 @@ bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const {
1387
1387
#else
1388
1388
intptr_t headroom = heap_->new_space ()->CapacityInWords ();
1389
1389
#endif
1390
- return after.CombinedCapacityInWords () > (gc_threshold_in_words_ + headroom);
1390
+ return after.CombinedUsedInWords () > (gc_threshold_in_words_ + headroom);
1391
1391
}
1392
1392
1393
1393
bool PageSpaceController::AlmostNeedsGarbageCollection (SpaceUsage after) const {
@@ -1397,7 +1397,7 @@ bool PageSpaceController::AlmostNeedsGarbageCollection(SpaceUsage after) const {
1397
1397
if (heap_growth_ratio_ == 100 ) {
1398
1398
return false ;
1399
1399
}
1400
- return after.CombinedCapacityInWords () > gc_threshold_in_words_;
1400
+ return after.CombinedUsedInWords () > gc_threshold_in_words_;
1401
1401
}
1402
1402
1403
1403
bool PageSpaceController::NeedsIdleGarbageCollection (SpaceUsage current) const {
@@ -1407,7 +1407,7 @@ bool PageSpaceController::NeedsIdleGarbageCollection(SpaceUsage current) const {
1407
1407
if (heap_growth_ratio_ == 100 ) {
1408
1408
return false ;
1409
1409
}
1410
- return current.CombinedCapacityInWords () > idle_gc_threshold_in_words_;
1410
+ return current.CombinedUsedInWords () > idle_gc_threshold_in_words_;
1411
1411
}
1412
1412
1413
1413
void PageSpaceController::EvaluateGarbageCollection (SpaceUsage before,
@@ -1446,9 +1446,9 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before,
1446
1446
// Number of pages we can allocate and still be within the desired growth
1447
1447
// ratio.
1448
1448
const intptr_t grow_pages =
1449
- (static_cast <intptr_t >(after.CombinedCapacityInWords () /
1449
+ (static_cast <intptr_t >(after.CombinedUsedInWords () /
1450
1450
desired_utilization_) -
1451
- (after.CombinedCapacityInWords ())) /
1451
+ (after.CombinedUsedInWords ())) /
1452
1452
kPageSizeInWords ;
1453
1453
if (garbage_ratio == 0 ) {
1454
1454
// No garbage in the previous cycle so it would be hard to compute a
@@ -1464,8 +1464,8 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before,
1464
1464
intptr_t local_grow_heap = 0 ;
1465
1465
while (min < max) {
1466
1466
local_grow_heap = (max + min) / 2 ;
1467
- const intptr_t limit = after. CombinedCapacityInWords () +
1468
- (local_grow_heap * kPageSizeInWords );
1467
+ const intptr_t limit =
1468
+ after. CombinedUsedInWords () + (local_grow_heap * kPageSizeInWords );
1469
1469
const intptr_t allocated_before_next_gc =
1470
1470
limit - (after.CombinedUsedInWords ());
1471
1471
const double estimated_garbage = k * allocated_before_next_gc;
@@ -1492,19 +1492,19 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before,
1492
1492
1493
1493
// Limit shrinkage: allow growth by at least half the pages freed by GC.
1494
1494
const intptr_t freed_pages =
1495
- (before.CombinedCapacityInWords () - after.CombinedCapacityInWords ()) /
1495
+ (before.CombinedUsedInWords () - after.CombinedUsedInWords ()) /
1496
1496
kPageSizeInWords ;
1497
1497
grow_heap = Utils::Maximum (grow_heap, freed_pages / 2 );
1498
1498
heap_->RecordData (PageSpace::kAllowedGrowth , grow_heap);
1499
1499
last_usage_ = after;
1500
1500
1501
1501
// Save final threshold compared before growing.
1502
1502
gc_threshold_in_words_ =
1503
- after.CombinedCapacityInWords () + (kPageSizeInWords * grow_heap);
1503
+ after.CombinedUsedInWords () + (kPageSizeInWords * grow_heap);
1504
1504
1505
1505
// Set a tight idle threshold.
1506
1506
idle_gc_threshold_in_words_ =
1507
- after.CombinedCapacityInWords () + 2 * kPageSizeInWords ;
1507
+ after.CombinedUsedInWords () + ( 2 * kPageSizeInWords ) ;
1508
1508
1509
1509
RecordUpdate (before, after, " gc" );
1510
1510
}
@@ -1513,9 +1513,9 @@ void PageSpaceController::EvaluateAfterLoading(SpaceUsage after) {
1513
1513
// Number of pages we can allocate and still be within the desired growth
1514
1514
// ratio.
1515
1515
intptr_t growth_in_pages =
1516
- (static_cast <intptr_t >(after.CombinedCapacityInWords () /
1516
+ (static_cast <intptr_t >(after.CombinedUsedInWords () /
1517
1517
desired_utilization_) -
1518
- (after.CombinedCapacityInWords ())) /
1518
+ (after.CombinedUsedInWords ())) /
1519
1519
kPageSizeInWords ;
1520
1520
1521
1521
// Apply growth cap.
@@ -1524,11 +1524,11 @@ void PageSpaceController::EvaluateAfterLoading(SpaceUsage after) {
1524
1524
1525
1525
// Save final threshold compared before growing.
1526
1526
gc_threshold_in_words_ =
1527
- after.CombinedCapacityInWords () + (kPageSizeInWords * growth_in_pages);
1527
+ after.CombinedUsedInWords () + (kPageSizeInWords * growth_in_pages);
1528
1528
1529
1529
// Set a tight idle threshold.
1530
1530
idle_gc_threshold_in_words_ =
1531
- after.CombinedCapacityInWords () + 2 * kPageSizeInWords ;
1531
+ after.CombinedUsedInWords () + ( 2 * kPageSizeInWords ) ;
1532
1532
1533
1533
RecordUpdate (after, after, " loaded" );
1534
1534
}
@@ -1540,10 +1540,10 @@ void PageSpaceController::RecordUpdate(SpaceUsage before,
1540
1540
TIMELINE_FUNCTION_GC_DURATION (Thread::Current (), " UpdateGrowthLimit" );
1541
1541
tbes.SetNumArguments (5 );
1542
1542
tbes.CopyArgument (0 , " Reason" , reason);
1543
- tbes.FormatArgument (1 , " Before.CombinedCapacity (kB)" , " %" Pd " " ,
1544
- RoundWordsToKB (before.CombinedCapacityInWords ()));
1545
- tbes.FormatArgument (2 , " After.CombinedCapacity (kB)" , " %" Pd " " ,
1546
- RoundWordsToKB (after.CombinedCapacityInWords ()));
1543
+ tbes.FormatArgument (1 , " Before.CombinedUsed (kB)" , " %" Pd " " ,
1544
+ RoundWordsToKB (before.CombinedUsedInWords ()));
1545
+ tbes.FormatArgument (2 , " After.CombinedUsed (kB)" , " %" Pd " " ,
1546
+ RoundWordsToKB (after.CombinedUsedInWords ()));
1547
1547
tbes.FormatArgument (3 , " Threshold (kB)" , " %" Pd " " ,
1548
1548
RoundWordsToKB (gc_threshold_in_words_));
1549
1549
tbes.FormatArgument (4 , " Idle Threshold (kB)" , " %" Pd " " ,
0 commit comments