Skip to content

Commit

Permalink
Merge r220566 - [JSC] Use @toNumber in builtins
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=172692

Reviewed by Sam Weinig.

Use @toNumber bytecode intrinsic. It emits op_to_number, which efficiently converts
a given argument to a number.

* Modules/streams/ReadableByteStreamInternals.js:
(privateInitializeReadableByteStreamController):
(readableByteStreamControllerRespond):
* Modules/streams/StreamInternals.js:
(validateAndNormalizeQueuingStrategy):
(enqueueValueWithSize):
  • Loading branch information
Constellation authored and carlosgcampos committed Aug 14, 2017
1 parent cbb7539 commit a7c7d06
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
17 changes: 17 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
2017-08-10 Yusuke Suzuki <utatane.tea@gmail.com>

[JSC] Use @toNumber in builtins
https://bugs.webkit.org/show_bug.cgi?id=172692

Reviewed by Sam Weinig.

Use @toNumber bytecode intrinsic. It emits op_to_number, which efficiently converts
a given argument to a number.

* Modules/streams/ReadableByteStreamInternals.js:
(privateInitializeReadableByteStreamController):
(readableByteStreamControllerRespond):
* Modules/streams/StreamInternals.js:
(validateAndNormalizeQueuingStrategy):
(enqueueValueWithSize):

2017-08-10 Nan Wang <n_wang@apple.com>

AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/Modules/streams/ReadableByteStreamInternals.js
Expand Up @@ -64,14 +64,14 @@ function privateInitializeReadableByteStreamController(stream, underlyingByteSou
this.@started = false;
this.@closeRequested = false;

let hwm = @Number(highWaterMark);
let hwm = @toNumber(highWaterMark);
if (@isNaN(hwm) || hwm < 0)
@throwRangeError("highWaterMark value is negative or not a number");
this.@strategyHWM = hwm;

let autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
if (autoAllocateChunkSize !== @undefined) {
autoAllocateChunkSize = @Number(autoAllocateChunkSize);
autoAllocateChunkSize = @toNumber(autoAllocateChunkSize);
if (autoAllocateChunkSize <= 0 || autoAllocateChunkSize === @Number.POSITIVE_INFINITY || autoAllocateChunkSize === @Number.NEGATIVE_INFINITY)
@throwRangeError("autoAllocateChunkSize value is negative or equal to positive or negative infinity");
}
Expand Down Expand Up @@ -393,7 +393,7 @@ function readableByteStreamControllerRespond(controller, bytesWritten)
{
"use strict";

bytesWritten = @Number(bytesWritten);
bytesWritten = @toNumber(bytesWritten);

if (@isNaN(bytesWritten) || bytesWritten === @Number.POSITIVE_INFINITY || bytesWritten < 0 )
@throwRangeError("bytesWritten has an incorrect value");
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/Modules/streams/StreamInternals.js
Expand Up @@ -84,7 +84,7 @@ function validateAndNormalizeQueuingStrategy(size, highWaterMark)
const normalizedStrategy = { };

normalizedStrategy.size = size;
normalizedStrategy.highWaterMark = @Number(highWaterMark);
normalizedStrategy.highWaterMark = @toNumber(highWaterMark);

if (@isNaN(normalizedStrategy.highWaterMark) || normalizedStrategy.highWaterMark < 0)
@throwRangeError("highWaterMark value is negative or not a number");
Expand Down Expand Up @@ -112,7 +112,7 @@ function enqueueValueWithSize(queue, value, size)
{
"use strict";

size = @Number(size);
size = @toNumber(size);
if (!@isFinite(size) || size < 0)
@throwRangeError("size has an incorrect value");
queue.content.@push({ value: value, size: size });
Expand Down

0 comments on commit a7c7d06

Please sign in to comment.