@@ -235,7 +235,6 @@ class RegionPageMap {
235
235
PackingRatioLog;
236
236
BufferSize = SizePerRegion * sizeof (*Buffer) * Regions;
237
237
Buffer = Buffers.getBuffer (BufferSize);
238
- DCHECK_NE (Buffer, nullptr );
239
238
}
240
239
241
240
bool isAllocated () const { return !!Buffer; }
@@ -423,33 +422,35 @@ struct PageReleaseContext {
423
422
return PageMap.isAllocated ();
424
423
}
425
424
426
- void ensurePageMapAllocated () {
425
+ bool ensurePageMapAllocated () {
427
426
if (PageMap.isAllocated ())
428
- return ;
427
+ return true ;
429
428
PageMap.reset (NumberOfRegions, PagesCount, FullPagesBlockCountMax);
430
- DCHECK (PageMap.isAllocated ());
429
+ // TODO: Log some message when we fail on PageMap allocation.
430
+ return PageMap.isAllocated ();
431
431
}
432
432
433
433
// Mark all the blocks in the given range [From, to). Instead of visiting all
434
434
// the blocks, we will just mark the page as all counted. Note the `From` and
435
435
// `To` has to be page aligned but with one exception, if `To` is equal to the
436
436
// RegionSize, it's not necessary to be aligned with page size.
437
- void markRangeAsAllCounted (uptr From, uptr To, uptr Base,
437
+ bool markRangeAsAllCounted (uptr From, uptr To, uptr Base,
438
438
const uptr RegionIndex, const uptr RegionSize) {
439
439
DCHECK_LT (From, To);
440
440
DCHECK_LE (To, Base + RegionSize);
441
441
DCHECK_EQ (From % PageSize, 0U );
442
442
DCHECK_LE (To - From, RegionSize);
443
443
444
- ensurePageMapAllocated ();
444
+ if (!ensurePageMapAllocated ())
445
+ return false ;
445
446
446
447
uptr FromInRegion = From - Base;
447
448
uptr ToInRegion = To - Base;
448
449
uptr FirstBlockInRange = roundUpSlow (FromInRegion, BlockSize);
449
450
450
451
// The straddling block sits across entire range.
451
452
if (FirstBlockInRange >= ToInRegion)
452
- return ;
453
+ return true ;
453
454
454
455
// First block may not sit at the first pape in the range, move
455
456
// `FromInRegion` to the first block page.
@@ -516,14 +517,17 @@ struct PageReleaseContext {
516
517
PageMap.setAsAllCountedRange (RegionIndex, getPageIndex (FromInRegion),
517
518
getPageIndex (ToInRegion - 1 ));
518
519
}
520
+
521
+ return true ;
519
522
}
520
523
521
524
template <class TransferBatchT , typename DecompactPtrT>
522
- void markFreeBlocksInRegion (const IntrusiveList<TransferBatchT> &FreeList,
525
+ bool markFreeBlocksInRegion (const IntrusiveList<TransferBatchT> &FreeList,
523
526
DecompactPtrT DecompactPtr, const uptr Base,
524
527
const uptr RegionIndex, const uptr RegionSize,
525
528
bool MayContainLastBlockInRegion) {
526
- ensurePageMapAllocated ();
529
+ if (!ensurePageMapAllocated ())
530
+ return false ;
527
531
528
532
if (MayContainLastBlockInRegion) {
529
533
const uptr LastBlockInRegion =
@@ -582,6 +586,8 @@ struct PageReleaseContext {
582
586
}
583
587
}
584
588
}
589
+
590
+ return true ;
585
591
}
586
592
587
593
uptr getPageIndex (uptr P) { return (P >> PageSizeLog) - ReleasePageOffset; }
0 commit comments