[webkit-reviews] review granted: [Bug 214914] Update some JSArrayBufferView comments and add some assertions. : [Attachment 405444] proposed patch.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 29 09:39:44 PDT 2020


Darin Adler <darin at apple.com> has granted Mark Lam <mark.lam at apple.com>'s
request for review:
Bug 214914: Update some JSArrayBufferView comments and add some assertions.
https://bugs.webkit.org/show_bug.cgi?id=214914

Attachment 405444: proposed patch.

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




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 405444
  --> https://bugs.webkit.org/attachment.cgi?id=405444
proposed patch.

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

> Source/JavaScriptCore/runtime/ArrayBuffer.cpp:213
> +    ASSERT(!Gigacage::isEnabled() || (Gigacage::contains(data) &&
Gigacage::contains(bitwise_cast<const uint8_t*>(data) + byteLength - 1)));

Converting from const void* to const uint8_t* requires only a static_cast, not
a bitwise_cast. We should reserve bitwise_cast for the cases where it’s needed.

> Source/JavaScriptCore/runtime/JSArrayBufferView.cpp:51
> +    ASSERT(!Gigacage::isEnabled() || (Gigacage::contains(vector) &&
Gigacage::contains(bitwise_cast<const uint8_t*>(vector) + length - 1)));

Ditto. Also, I suggest casting to uint8_t* for brevity rather than adding
const. That can still be passed to a function that expects const uint8_t.


More information about the webkit-reviews mailing list