Changeset 262088 in webkit


Ignore:
Timestamp:
May 22, 2020 4:50:26 PM (4 years ago)
Author:
Alexey Shvayka
Message:

Array.prototype.splice doesn't set "length" of returned object
https://bugs.webkit.org/show_bug.cgi?id=212285

Reviewed by Darin Adler.

JSTests:

  • test262/expectations.yaml: Mark 2 test cases as passing.

Source/JavaScriptCore:

This change implements step 12 of Array.prototype.splice [1], which is observable
if result object is not JSArray, aligning JSC with V8 and SpiderMonkey.

Only slow path of splice() is affected by this patch; zero-argument case already
performs setLength(). Microbenchmarks are neutral.

[1]: https://tc39.es/ecma262/#sec-array.prototype.splice

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncSplice):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r262083 r262088  
     12020-05-22  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        Array.prototype.splice doesn't set "length" of returned object
     4        https://bugs.webkit.org/show_bug.cgi?id=212285
     5
     6        Reviewed by Darin Adler.
     7
     8        * test262/expectations.yaml: Mark 2 test cases as passing.
     9
    1102020-05-22  Saam Barati  <sbarati@apple.com>
    211
  • trunk/JSTests/test262/expectations.yaml

    r262017 r262088  
    637637  default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
    638638  strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
    639 test/built-ins/Array/prototype/splice/property-traps-order-with-species.js:
    640   default: 'Test262Error: Expected [defineProperty, defineProperty, set, getOwnPropertyDescriptor, defineProperty] and [defineProperty, defineProperty] to have the same contents. '
    641   strict mode: 'Test262Error: Expected [defineProperty, defineProperty, set, getOwnPropertyDescriptor, defineProperty] and [defineProperty, defineProperty] to have the same contents. '
    642639test/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js:
    643640  default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'
  • trunk/Source/JavaScriptCore/ChangeLog

    r262083 r262088  
     12020-05-22  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        Array.prototype.splice doesn't set "length" of returned object
     4        https://bugs.webkit.org/show_bug.cgi?id=212285
     5
     6        Reviewed by Darin Adler.
     7
     8        This change implements step 12 of Array.prototype.splice [1], which is observable
     9        if result object is not JSArray, aligning JSC with V8 and SpiderMonkey.
     10
     11        Only slow path of splice() is affected by this patch; zero-argument case already
     12        performs setLength(). Microbenchmarks are neutral.
     13
     14        [1]: https://tc39.es/ecma262/#sec-array.prototype.splice
     15
     16        * runtime/ArrayPrototype.cpp:
     17        (JSC::arrayProtoFuncSplice):
     18
    1192020-05-22  Saam Barati  <sbarati@apple.com>
    220
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r261755 r262088  
    12181218            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    12191219        }
     1220        setLength(globalObject, vm, result, actualDeleteCount);
     1221        RETURN_IF_EXCEPTION(scope, { });
    12201222    }
    12211223
Note: See TracChangeset for help on using the changeset viewer.