[webkit-changes] [WebKit/WebKit] ff30d6: [JSC] Add support for new Set.prototype methods

Keith Miller noreply at github.com
Wed Feb 8 13:36:30 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff30d6f8aba3d3638bd80f5ccea91d9e03535598
      https://github.com/WebKit/WebKit/commit/ff30d6f8aba3d3638bd80f5ccea91d9e03535598
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2023-02-08 (Wed, 08 Feb 2023)

  Changed paths:
    A JSTests/stress/set-prototype-intersection.js
    A JSTests/stress/set-prototype-isDisjointfrom.js
    A JSTests/stress/set-prototype-isSubsetOf.js
    A JSTests/stress/set-prototype-isSupersetOf.js
    A JSTests/stress/set-prototype-symmetricDifference.js
    A JSTests/stress/set-prototype-union.js
    M Source/JavaScriptCore/builtins/BuiltinNames.h
    M Source/JavaScriptCore/builtins/SetPrototype.js
    M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/runtime/SetConstructor.cpp
    M Source/JavaScriptCore/runtime/SetConstructor.h
    M Source/JavaScriptCore/runtime/SetPrototype.cpp

  Log Message:
  -----------
  [JSC] Add support for new Set.prototype methods
https://bugs.webkit.org/show_bug.cgi?id=251510

Reviewed by Yusuke Suzuki.

This patch adds support for the https://github.com/tc39/proposal-set-methods proposal, which is currently at stage 3.
In order to unobservably make a copy of a set this patch adds a new setClone intrisic, otherwise everything else is just
normal builtins code. There is one outstanding issue that intersection is supposed to return a Set with the same iteration
order as the this value. Given our implementation of iteration order being a linked list that's not efficient. Pending spec discussion
this implementation just skips that step. See: https://bugs.webkit.org/show_bug.cgi?id=251869

* JSTests/stress/set-prototype-intersection.js: Added.
(assert):
(assertArrayContent):
(catch):
(try.set1.intersection.has):
(try.set1.intersection.keys):
(assertArrayContent.Array.from.set1.intersection.has):
(assertArrayContent.Array.from.set1.intersection.keys):
(assertArrayContent.Array.from.set4.intersection.has):
(assertArrayContent.Array.from.set4.intersection.keys):
* JSTests/stress/set-prototype-isDisjointfrom.js: Added.
(assert):
(assertArrayContent):
(catch):
(try.set1.isDisjointFrom.has):
(try.set1.isDisjointFrom.keys):
(assert.set1.isDisjointFrom.has):
(assert.set1.isDisjointFrom.keys):
(assert.set4.isDisjointFrom.has):
(assert.set4.isDisjointFrom.keys):
(assert.set6.isDisjointFrom.has):
(assert.set6.isDisjointFrom.keys):
* JSTests/stress/set-prototype-isSubsetOf.js: Added.
(assert):
(assertArrayContent):
(catch):
(try.set1.isSubsetOf.has):
(try.set1.isSubsetOf.keys):
(assert.set1.isSubsetOf.has):
(assert.set1.isSubsetOf.keys):
(assert.set4.isSubsetOf.has):
(assert.set4.isSubsetOf.keys):
* JSTests/stress/set-prototype-isSupersetOf.js: Added.
(assert):
(assertArrayContent):
(catch):
(try.set1.isSupersetOf.has):
(try.set1.isSupersetOf.keys):
(assert.set1.isSupersetOf.has):
(assert.set1.isSupersetOf.keys):
(assert.set4.isSupersetOf.has):
(assert.set4.isSupersetOf.keys):
* JSTests/stress/set-prototype-symmetricDifference.js: Added.
(assert):
(assertArrayContent):
(catch):
(try.set1.symmetricDifference.has):
(try.set1.symmetricDifference.keys):
(assertArrayContent.Array.from.set1.symmetricDifference.has):
(assertArrayContent.Array.from.set1.symmetricDifference.keys):
(assertArrayContent.Array.from.set4.symmetricDifference.has):
(assertArrayContent.Array.from.set4.symmetricDifference.keys):
* JSTests/stress/set-prototype-union.js: Added.
(assert):
(assertArrayContent):
(catch):
(try.set1.union.has):
(try.set1.union.keys):
(assertArrayContent.Array.from.set1.union.has):
(assertArrayContent.Array.from.set1.union.keys):
(assertArrayContent.Array.from.set4.union.has):
(assertArrayContent.Array.from.set4.union.keys):
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/builtins/SetPrototype.js:
(union.wrapper.iterator):
(union):
(intersection.else.wrapper.iterator):
(intersection):
(symmetricDifference.wrapper.iterator):
(symmetricDifference):
(isSubsetOf):
(isSupersetOf.wrapper.iterator):
(isSupersetOf):
(isDisjointFrom.else.wrapper.iterator):
(isDisjointFrom):
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/runtime/SetConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/SetConstructor.h:
* Source/JavaScriptCore/runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):

Canonical link: https://commits.webkit.org/260033@main




More information about the webkit-changes mailing list