[webkit-reviews] review granted: [Bug 212016] [bmalloc] Fix OOM errors on MIPS after r261667 : [Attachment 400068] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 22 13:41:21 PDT 2020


Yusuke Suzuki <ysuzuki at apple.com> has granted Caio Lima
<ticaiolima at gmail.com>'s request for review:
Bug 212016: [bmalloc] Fix OOM errors on MIPS after r261667
https://bugs.webkit.org/show_bug.cgi?id=212016

Attachment 400068: Patch

https://bugs.webkit.org/attachment.cgi?id=400068&action=review




--- Comment #5 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 400068
  --> https://bugs.webkit.org/attachment.cgi?id=400068
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400068&action=review

r=me with comments.

> Source/bmalloc/bmalloc/ObjectTypeTable.cpp:47
> +	       newBegin = index < ObjectTypeTable::Bits::bitCountPerWord * 4 ?
0 : std::min<unsigned>(index, index - ObjectTypeTable::Bits::bitCountPerWord *
4);

Can you wrtie it like,

constexpr unsigned offsetForInitialAllocation =
ObjectTypeTable::Bits::bitCountPerWord * 4;
if (index < offsetForInitialAllocation)
    newBegin = 0;
else
    newBegin = std::min<unsigned>(index, index - offsetForInitialAllocation);

> Source/bmalloc/bmalloc/ObjectTypeTable.cpp:56
> +	       newBegin =  bits->begin() < bits->count() ? 0 :
std::min<unsigned>(index, bits->begin() - bits->count());

Ditto like this, since it is hard to read.

if (bits->begin() < bits->count())
    newBegin = 0;
else
    newBegin = std::min<unsigned>(index, bits->begin() - bits->count());

> Source/bmalloc/bmalloc/ObjectTypeTable.cpp:66
> +	       newEnd = std::numeric_limits<unsigned>::max() - bits->count() <
bits->end() ? std::numeric_limits<unsigned>::max() : std::max<unsigned>(index +
1, bits->end() + bits->count());

Ditto.


More information about the webkit-reviews mailing list