Title: [268760] trunk
Revision
268760
Author
ross.kirsl...@sony.com
Date
2020-10-20 14:23:53 -0700 (Tue, 20 Oct 2020)

Log Message

[JSC] Rename item() to at() and move it behind a flag
https://bugs.webkit.org/show_bug.cgi?id=217942

Reviewed by Yusuke Suzuki.

JSTests:

* stress/at-method.js: Renamed from JSTests/stress/item-method.js.
* test262/config.yaml: Add skips until the feature is renamed.

Source/_javascript_Core:

{Array, %TypedArray%}.prototype.item is official web-incompatible,
but it is expected to be renamed to `at` instead of being scrapped entirely:
https://github.com/tc39/proposal-item-method/issues/34

This patch performs the renaming, but does so behind a runtime flag since this has yet to achieve consensus.

* builtins/ArrayPrototype.js:
(at):
(item): Deleted.
* builtins/TypedArrayPrototype.js:
(at):
(item): Deleted.
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
* runtime/JSTypedArrayViewPrototype.cpp:
(JSC::JSTypedArrayViewPrototype::finishCreation):
* runtime/OptionsList.h:

LayoutTests:

* inspector/model/remote-object-get-properties-expected.txt:
* js/array-unscopables-properties-expected.txt:
* js/Object-getOwnPropertyNames-expected.txt:
* js/script-tests/Object-getOwnPropertyNames.js:
* js/script-tests/array-unscopables-properties.js:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/JSTests/ChangeLog (268759 => 268760)


--- trunk/JSTests/ChangeLog	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/JSTests/ChangeLog	2020-10-20 21:23:53 UTC (rev 268760)
@@ -1,3 +1,13 @@
+2020-10-20  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [JSC] Rename item() to at() and move it behind a flag
+        https://bugs.webkit.org/show_bug.cgi?id=217942
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/at-method.js: Renamed from JSTests/stress/item-method.js.
+        * test262/config.yaml: Add skips until the feature is renamed.
+
 2020-10-19  Alexey Shvayka  <shvaikal...@gmail.com>
 
         [WebIDL] %Interface%.prototype.constructor should be defined on [[Set]] receiver

Copied: trunk/JSTests/stress/at-method.js (from rev 268759, trunk/JSTests/stress/item-method.js) (0 => 268760)


--- trunk/JSTests/stress/at-method.js	                        (rev 0)
+++ trunk/JSTests/stress/at-method.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -0,0 +1,51 @@
+//@ requireOptions("--useAtMethod=1")
+
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error(`expected ${expected} but got ${actual}`);
+}
+
+function shouldThrowTypeError(func) {
+    let error;
+    try {
+        func();
+    } catch (e) {
+        error = e;
+    }
+
+    if (!(error instanceof TypeError))
+        throw new Error('Expected TypeError!');
+}
+
+shouldBe(Array.prototype.at.length, 1);
+shouldThrowTypeError(() => Array.prototype.at.call(undefined));
+shouldThrowTypeError(() => Array.prototype.at.call(null));
+
+const array = [42, 'b', true];
+// intentionally go one too far to ensure that we get undefined instead of wrapping
+for (let i = 0; i <= array.length; i++) {
+  shouldBe(array.at(i), array[i]);
+  shouldBe(array.at(-i - 1), array[array.length - i - 1]);
+}
+shouldBe(array.at(), array[0]);
+shouldBe(array.at(null), array[0]);
+shouldBe(array.at({ valueOf: () => -1 }), array[array.length - 1]);
+
+const weirdArrayLike = { length: 1, get '0'() { return 3; }, get '1'() { throw 'oops'; } };
+shouldBe(Array.prototype.at.call(weirdArrayLike, 0), 3);
+shouldBe(Array.prototype.at.call(weirdArrayLike, 1), undefined);
+
+for (const TA of [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]) {
+  shouldBe(TA.prototype.at.length, 1);
+  shouldThrowTypeError(() => TA.prototype.at.call([]));
+
+  const ta = [1, 2, 3];
+  // intentionally go one too far to ensure that we get undefined instead of wrapping
+  for (let i = 0; i <= ta.length; i++) {
+    shouldBe(ta.at(i), ta[i]);
+    shouldBe(ta.at(-i - 1), ta[ta.length - i - 1]);
+  }
+  shouldBe(ta.at(), ta[0]);
+  shouldBe(ta.at(null), ta[0]);
+  shouldBe(ta.at({ valueOf: () => -1 }), ta[ta.length - 1]);
+}

Deleted: trunk/JSTests/stress/item-method.js (268759 => 268760)


--- trunk/JSTests/stress/item-method.js	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/JSTests/stress/item-method.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -1,49 +0,0 @@
-function shouldBe(actual, expected) {
-    if (actual !== expected)
-        throw new Error(`expected ${expected} but got ${actual}`);
-}
-
-function shouldThrowTypeError(func) {
-    let error;
-    try {
-        func();
-    } catch (e) {
-        error = e;
-    }
-
-    if (!(error instanceof TypeError))
-        throw new Error('Expected TypeError!');
-}
-
-shouldBe(Array.prototype.item.length, 1);
-shouldThrowTypeError(() => Array.prototype.item.call(undefined));
-shouldThrowTypeError(() => Array.prototype.item.call(null));
-
-const array = [42, 'b', true];
-// intentionally go one too far to ensure that we get undefined instead of wrapping
-for (let i = 0; i <= array.length; i++) {
-  shouldBe(array.item(i), array[i]);
-  shouldBe(array.item(-i - 1), array[array.length - i - 1]);
-}
-shouldBe(array.item(), array[0]);
-shouldBe(array.item(null), array[0]);
-shouldBe(array.item({ valueOf: () => -1 }), array[array.length - 1]);
-
-const weirdArrayLike = { length: 1, get '0'() { return 3; }, get '1'() { throw 'oops'; } };
-shouldBe(Array.prototype.item.call(weirdArrayLike, 0), 3);
-shouldBe(Array.prototype.item.call(weirdArrayLike, 1), undefined);
-
-for (const TA of [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]) {
-  shouldBe(TA.prototype.item.length, 1);
-  shouldThrowTypeError(() => TA.prototype.item.call([]));
-
-  const ta = [1, 2, 3];
-  // intentionally go one too far to ensure that we get undefined instead of wrapping
-  for (let i = 0; i <= ta.length; i++) {
-    shouldBe(ta.item(i), ta[i]);
-    shouldBe(ta.item(-i - 1), ta[ta.length - i - 1]);
-  }
-  shouldBe(ta.item(), ta[0]);
-  shouldBe(ta.item(null), ta[0]);
-  shouldBe(ta.item({ valueOf: () => -1 }), ta[ta.length - 1]);
-}

Modified: trunk/JSTests/stress/unscopables.js (268759 => 268760)


--- trunk/JSTests/stress/unscopables.js	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/JSTests/stress/unscopables.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -1,3 +1,5 @@
+//@ requireOptions("--useAtMethod=1")
+
 function test(actual, expected) {
     if (actual !== expected)
         throw new Error('bad value: ' + actual);
@@ -9,7 +11,7 @@
 
     test(typeof unscopables, "object");
     test(unscopables.__proto__, undefined);
-    test(String(Object.keys(unscopables).sort()), "copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,item,keys,values");
+    test(String(Object.keys(unscopables).sort()), "at,copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,keys,values");
 }());
 
 (function () {

Modified: trunk/JSTests/test262/config.yaml (268759 => 268760)


--- trunk/JSTests/test262/config.yaml	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/JSTests/test262/config.yaml	2020-10-20 21:23:53 UTC (rev 268760)
@@ -27,6 +27,10 @@
     - top-level-await
     - Intl.ListFormat
 
+    # remove once it's been renamed in test262
+    - Array.prototype.item
+    - TypedArray.prototype.item
+
     # remove once it's no longer in test262
     - String.prototype.item
   paths:

Modified: trunk/LayoutTests/ChangeLog (268759 => 268760)


--- trunk/LayoutTests/ChangeLog	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/LayoutTests/ChangeLog	2020-10-20 21:23:53 UTC (rev 268760)
@@ -1,3 +1,16 @@
+2020-10-20  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [JSC] Rename item() to at() and move it behind a flag
+        https://bugs.webkit.org/show_bug.cgi?id=217942
+
+        Reviewed by Yusuke Suzuki.
+
+        * inspector/model/remote-object-get-properties-expected.txt:
+        * js/array-unscopables-properties-expected.txt:
+        * js/Object-getOwnPropertyNames-expected.txt:
+        * js/script-tests/Object-getOwnPropertyNames.js:
+        * js/script-tests/array-unscopables-properties.js:
+
 2020-10-20  Diego Pino Garcia  <dp...@igalia.com>
 
         [GLIB][GTK] Unreviewed test gardening. Gardened several flaky crash tests.

Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (268759 => 268760)


--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2020-10-20 21:23:53 UTC (rev 268760)
@@ -85,7 +85,6 @@
     findIndex
     includes
     copyWithin
-    item
     constructor
     Symbol(Symbol.iterator)
     Symbol(Symbol.unscopables)
@@ -139,7 +138,6 @@
     findIndex
     includes
     copyWithin
-    item
     constructor
     Symbol(Symbol.iterator)
     Symbol(Symbol.unscopables)
@@ -178,7 +176,6 @@
     findIndex
     includes
     copyWithin
-    item
     constructor
     Symbol(Symbol.iterator)
     Symbol(Symbol.unscopables)
@@ -217,7 +214,6 @@
     findIndex
     includes
     copyWithin
-    item
     constructor
     Symbol(Symbol.iterator)
     Symbol(Symbol.unscopables)

Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (268759 => 268760)


--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt	2020-10-20 21:23:53 UTC (rev 268760)
@@ -47,7 +47,7 @@
 PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
 PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']
 PASS getSortedOwnPropertyNames(Array) is ['from', 'isArray', 'length', 'name', 'of', 'prototype']
-PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'item', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']
+PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']
 PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']
 PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']
 PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype']

Modified: trunk/LayoutTests/js/array-unscopables-properties-expected.txt (268759 => 268760)


--- trunk/LayoutTests/js/array-unscopables-properties-expected.txt	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/LayoutTests/js/array-unscopables-properties-expected.txt	2020-10-20 21:23:53 UTC (rev 268760)
@@ -42,10 +42,6 @@
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").writable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").enumerable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").configurable is true
-PASS Array.prototype[Symbol.unscopables]["item"] is true
-PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").writable is true
-PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").enumerable is true
-PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").configurable is true
 PASS Array.prototype[Symbol.unscopables]["keys"] is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").writable is true
 PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").enumerable is true

Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (268759 => 268760)


--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -56,7 +56,7 @@
     "Function": "['length', 'name', 'prototype']",
     "Function.prototype": "['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']",
     "Array": "['from', 'isArray', 'length', 'name', 'of', 'prototype']",
-    "Array.prototype": "['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'item', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']",
+    "Array.prototype": "['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']",
     "String": "['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']",
     "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']",
     "Boolean": "['length', 'name', 'prototype']",

Modified: trunk/LayoutTests/js/script-tests/array-unscopables-properties.js (268759 => 268760)


--- trunk/LayoutTests/js/script-tests/array-unscopables-properties.js	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/LayoutTests/js/script-tests/array-unscopables-properties.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -15,7 +15,6 @@
     "flat",
     "flatMap",
     "includes",
-    "item",
     "keys",
     "values"
 ];

Modified: trunk/Source/_javascript_Core/ChangeLog (268759 => 268760)


--- trunk/Source/_javascript_Core/ChangeLog	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-10-20 21:23:53 UTC (rev 268760)
@@ -1,3 +1,28 @@
+2020-10-20  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [JSC] Rename item() to at() and move it behind a flag
+        https://bugs.webkit.org/show_bug.cgi?id=217942
+
+        Reviewed by Yusuke Suzuki.
+
+        {Array, %TypedArray%}.prototype.item is official web-incompatible,
+        but it is expected to be renamed to `at` instead of being scrapped entirely:
+        https://github.com/tc39/proposal-item-method/issues/34
+
+        This patch performs the renaming, but does so behind a runtime flag since this has yet to achieve consensus.
+
+        * builtins/ArrayPrototype.js:
+        (at):
+        (item): Deleted.
+        * builtins/TypedArrayPrototype.js:
+        (at):
+        (item): Deleted.
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation):
+        * runtime/JSTypedArrayViewPrototype.cpp:
+        (JSC::JSTypedArrayViewPrototype::finishCreation):
+        * runtime/OptionsList.h:
+
 2020-10-20  Philippe Normand  <pnorm...@igalia.com> and Pavel Feldman <pavel.feld...@gmail.com>
 
         Web Inspector: Add setScreenSizeOverride API to the Page agent

Modified: trunk/Source/_javascript_Core/builtins/ArrayPrototype.js (268759 => 268760)


--- trunk/Source/_javascript_Core/builtins/ArrayPrototype.js	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/Source/_javascript_Core/builtins/ArrayPrototype.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -687,11 +687,11 @@
     return @flatIntoArrayWithCallback(result, array, length, 0, callback, thisArg);
 }
 
-function item(index)
+function at(index)
 {
     "use strict";
 
-    var array = @toObject(this, "Array.prototype.item requires that |this| not be null or undefined");
+    var array = @toObject(this, "Array.prototype.at requires that |this| not be null or undefined");
     var length = @toLength(array.length);
 
     var k = @toInteger(index);

Modified: trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js (268759 => 268760)


--- trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js	2020-10-20 21:23:53 UTC (rev 268760)
@@ -385,7 +385,7 @@
     return string;
 }
 
-function item(index)
+function at(index)
 {
     "use strict";
 

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (268759 => 268760)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2020-10-20 21:23:53 UTC (rev 268760)
@@ -110,8 +110,10 @@
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
-    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().itemPublicName(), arrayPrototypeItemCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
 
+    if (Options::useAtMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().atPublicName(), arrayPrototypeAtCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+
     putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().entriesPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
     putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().forEachPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().forEachPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
     putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().keysPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().keysPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
@@ -128,10 +130,11 @@
         &vm.propertyNames->builtinNames().flatPublicName(),
         &vm.propertyNames->builtinNames().flatMapPublicName(),
         &vm.propertyNames->builtinNames().includesPublicName(),
-        &vm.propertyNames->builtinNames().itemPublicName(),
         &vm.propertyNames->builtinNames().keysPublicName(),
         &vm.propertyNames->builtinNames().valuesPublicName()
     };
+    if (Options::useAtMethod())
+        unscopables->putDirect(vm, vm.propertyNames->builtinNames().atPublicName(), jsBoolean(true));
     for (const auto* unscopableName : unscopableNames)
         unscopables->putDirect(vm, *unscopableName, jsBoolean(true));
     putDirectWithoutTransition(vm, vm.propertyNames->unscopablesSymbol, unscopables, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);

Modified: trunk/Source/_javascript_Core/runtime/JSTypedArrayViewPrototype.cpp (268759 => 268760)


--- trunk/Source/_javascript_Core/runtime/JSTypedArrayViewPrototype.cpp	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/Source/_javascript_Core/runtime/JSTypedArrayViewPrototype.cpp	2020-10-20 21:23:53 UTC (rev 268760)
@@ -375,8 +375,10 @@
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("some", typedArrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->subarray, typedArrayPrototypeSubarrayCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->toLocaleString, typedArrayPrototypeToLocaleStringCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
-    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().itemPublicName(), typedArrayPrototypeItemCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
 
+    if (Options::useAtMethod())
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().atPublicName(), typedArrayPrototypeAtCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+
     JSFunction* toStringTagFunction = JSFunction::create(vm, globalObject, 0, "get [Symbol.toStringTag]"_s, typedArrayViewProtoGetterFuncToStringTag, NoIntrinsic);
     GetterSetter* toStringTagAccessor = GetterSetter::create(vm, globalObject, toStringTagFunction, nullptr);
     putDirectNonIndexAccessorWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, toStringTagAccessor, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly | PropertyAttribute::Accessor);

Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (268759 => 268760)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-10-20 21:00:59 UTC (rev 268759)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-10-20 21:23:53 UTC (rev 268760)
@@ -491,6 +491,7 @@
     v(Bool, useWebAssemblyMultiValues, true, Normal, "Allow types from the wasm mulit-values spec.") \
     v(Bool, useWeakRefs, true, Normal, "Expose the WeakRef constructor.") \
     v(Bool, useIntlDateTimeFormatDayPeriod, true, Normal, "Expose the Intl.DateTimeFormat dayPeriod feature.") \
+    v(Bool, useAtMethod, false, Normal, "Expose the at() method on Array and %TypedArray%.") \
     v(Bool, useArrayAllocationProfiling, true, Normal, "If true, we will use our normal array allocation profiling. If false, the allocation profile will always claim to be undecided.") \
     v(Bool, forcePolyProto, false, Normal, "If true, create_this will always create an object with a poly proto structure.") \
     v(Bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.") \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to