⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267522 in webkit


Ignore:
Timestamp:
Sep 24, 2020, 12:35:30 AM (6 years ago)
Author:
Ross Kirsling
Message:

%TypedArray%.prototype.fill must only evaluate its argument once
https://bugs.webkit.org/show_bug.cgi?id=216912

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/typedarray-fill.js:

Fix test.

  • test262/expectations.yaml:

Mark two test cases as passing.

Source/JavaScriptCore:

Currently, we evaluate the argument in typedArray.fill({ valueOf() { ... } }) once per filled element,
but it should only be evaluated once in total.

  • builtins/TypedArrayPrototype.js:

(fill):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r267519 r267522  
     12020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        %TypedArray%.prototype.fill must only evaluate its argument once
     4        https://bugs.webkit.org/show_bug.cgi?id=216912
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * stress/typedarray-fill.js:
     9        Fix test.
     10
     11        * test262/expectations.yaml:
     12        Mark two test cases as passing.
     13
    1142020-09-23  Ross Kirsling  <ross.kirsling@sony.com>
    215
  • trunk/JSTests/stress/typedarray-fill.js

    r264304 r267522  
    4242    }});
    4343    new constructor(10).fill(p);
    44     shouldBeTrue("count === 40");
     44    shouldBeTrue("count === 4");
    4545}
    4646
  • trunk/JSTests/test262/expectations.yaml

    r267519 r267522  
    12461246test/built-ins/ThrowTypeError/unique-per-realm-non-simple.js:
    12471247  default: 'Test262Error: callee.get Expected SameValue(«function () {'
    1248 test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js:
    1249   default: 'Test262Error: additional unexpected ToNumber() calls Expected SameValue(«3», «2») to be true (Testing with Float64Array.)'
    1250   strict mode: 'Test262Error: additional unexpected ToNumber() calls Expected SameValue(«3», «2») to be true (Testing with Float64Array.)'
    12511248test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js:
    12521249  default: 'Test262Error: 42 Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'
  • trunk/Source/JavaScriptCore/ChangeLog

    r267519 r267522  
     12020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        %TypedArray%.prototype.fill must only evaluate its argument once
     4        https://bugs.webkit.org/show_bug.cgi?id=216912
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Currently, we evaluate the argument in `typedArray.fill({ valueOf() { ... } })` once per filled element,
     9        but it should only be evaluated once in total.
     10
     11        * builtins/TypedArrayPrototype.js:
     12        (fill):
     13
    1142020-09-23  Ross Kirsling  <ross.kirsling@sony.com>
    215
  • trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js

    r265907 r267522  
    9292    var length = @typedArrayLength(this);
    9393
    94     var start = @argument(1);
    95     var end = @argument(2);
    96 
    97     start = @typedArrayClampArgumentToStartOrEnd(start, length, 0);
    98     end = @typedArrayClampArgumentToStartOrEnd(end, length, length);
     94    var number = @toNumber(value);
     95
     96    var start = @typedArrayClampArgumentToStartOrEnd(@argument(1), length, 0);
     97    var end = @typedArrayClampArgumentToStartOrEnd(@argument(2), length, length);
    9998
    10099    for (var i = start; i < end; i++)
    101         this[i] = value;
     100        this[i] = number;
    102101    return this;
    103102}
Note: See TracChangeset for help on using the changeset viewer.