-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: IntegerIndexedElementSet should always indicate success #2210
Normative: IntegerIndexedElementSet should always indicate success #2210
Conversation
I note that this operation can no longer return any normal completion except Also, this probably merits a NOTE to the effect of "This operation always appears to succeed, although it does not have any effect when writing past the end of the TypedArray or to a TypedArray which is backed by a detached ArrayBuffer". |
@bakkot I definitely agree about the note, but I'm not certain that the return value refactor is clearer. I've added it here as a third commit, so we can discuss whether we want to keep it or not. |
https://bugs.webkit.org/show_bug.cgi?id=218776 Reviewed by Yusuke Suzuki. JSTests: * stress/reflect-set.js: * stress/typedarray-functions-with-neutered.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-join.js: Added. * stress/typedarray-lastIndexOf.js: Update tests. * test262/expectations.yaml: Mark a handful of test cases as temporarily failing. These will disappear in a future test262 update. Source/JavaScriptCore: The recent spec changes for typed arrays with detached buffers had certain ripple effects, namely the following two PRs which will be presented in next week's TC39 meeting. Since no controversy is expected, this patch addresses them now, though test262 adjustments are forthcoming. 1. tc39/ecma262#2210 It is correct that `ta[i] = n` doesn't throw when `ta` has a detached buffer or `i` is otherwise OOB, but by not throwing, Reflect.set(ta, i, n) is obliged to return true. 2. tc39/ecma262#2221 Until now, %TypedArray%.prototype.{includes, indexOf, join, lastIndexOf} lacked a rigorous specification; in particular, each has a parameter that may detach the buffer upon valueOf or toString, and the expected behavior was not made clear. It seems most sensible to do what the corresponding Array methods do upon `array.length = 0`: make use of the cached length but don't access indices, such that indexOf/lastIndexOf return -1 while includes/join act as if the elements were all `undefined`. * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::put): (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): (JSC::JSGenericTypedArrayView<Adaptor>::putByIndex): * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: (JSC::genericTypedArrayViewProtoFuncIncludes): (JSC::genericTypedArrayViewProtoFuncIndexOf): (JSC::genericTypedArrayViewProtoFuncJoin): (JSC::genericTypedArrayViewProtoFuncLastIndexOf): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@269670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
@rkirsling This got consensus, but I'm not sure if there's tests for it yet. Do you know? |
f5e7bb9
to
869005a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
869005a
to
ba09250
Compare
https://bugs.webkit.org/show_bug.cgi?id=218776 Reviewed by Yusuke Suzuki. JSTests: * stress/reflect-set.js: * stress/typedarray-functions-with-neutered.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-join.js: Added. * stress/typedarray-lastIndexOf.js: Update tests. * test262/expectations.yaml: Mark a handful of test cases as temporarily failing. These will disappear in a future test262 update. Source/JavaScriptCore: The recent spec changes for typed arrays with detached buffers had certain ripple effects, namely the following two PRs which will be presented in next week's TC39 meeting. Since no controversy is expected, this patch addresses them now, though test262 adjustments are forthcoming. 1. tc39/ecma262#2210 It is correct that `ta[i] = n` doesn't throw when `ta` has a detached buffer or `i` is otherwise OOB, but by not throwing, Reflect.set(ta, i, n) is obliged to return true. 2. tc39/ecma262#2221 Until now, %TypedArray%.prototype.{includes, indexOf, join, lastIndexOf} lacked a rigorous specification; in particular, each has a parameter that may detach the buffer upon valueOf or toString, and the expected behavior was not made clear. It seems most sensible to do what the corresponding Array methods do upon `array.length = 0`: make use of the cached length but don't access indices, such that indexOf/lastIndexOf return -1 while includes/join act as if the elements were all `undefined`. * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::put): (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): (JSC::JSGenericTypedArrayView<Adaptor>::putByIndex): * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: (JSC::genericTypedArrayViewProtoFuncIncludes): (JSC::genericTypedArrayViewProtoFuncIndexOf): (JSC::genericTypedArrayViewProtoFuncJoin): (JSC::genericTypedArrayViewProtoFuncLastIndexOf): Canonical link: https://commits.webkit.org/231449@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
…as configurable. r=tcampbell Implements the changes from <tc39/ecma262#2164> and <tc39/ecma262#2210> for [[GetOwnProperty]]. Part 3 will update [[DefineOwnProperty]] and part 5 updates [[Set]]. A side-effect of this change is that non-extensible, non-empty TypedArrays are no longer considered as sealed by `Object.isSealed()`. A later patch in this series will update test262 to enable more currently skipped TypedArray tests. Differential Revision: https://phabricator.services.mozilla.com/D99380
…as configurable. r=tcampbell Implements the changes from <tc39/ecma262#2164> and <tc39/ecma262#2210> for [[GetOwnProperty]]. Part 3 will update [[DefineOwnProperty]] and part 5 updates [[Set]]. A side-effect of this change is that non-extensible, non-empty TypedArrays are no longer considered as sealed by `Object.isSealed()`. A later patch in this series will update test262 to enable more currently skipped TypedArray tests. Differential Revision: https://phabricator.services.mozilla.com/D99380
…as configurable. r=tcampbell Implements the changes from <tc39/ecma262#2164> and <tc39/ecma262#2210> for [[GetOwnProperty]]. Part 3 will update [[DefineOwnProperty]] and part 5 updates [[Set]]. A side-effect of this change is that non-extensible, non-empty TypedArrays are no longer considered as sealed by `Object.isSealed()`. A later patch in this series will update test262 to enable more currently skipped TypedArray tests. Differential Revision: https://phabricator.services.mozilla.com/D99380 UltraBlame original commit: efd88e38955fc4722c6a882c175fdb48d6ff9e10
…as configurable. r=tcampbell Implements the changes from <tc39/ecma262#2164> and <tc39/ecma262#2210> for [[GetOwnProperty]]. Part 3 will update [[DefineOwnProperty]] and part 5 updates [[Set]]. A side-effect of this change is that non-extensible, non-empty TypedArrays are no longer considered as sealed by `Object.isSealed()`. A later patch in this series will update test262 to enable more currently skipped TypedArray tests. Differential Revision: https://phabricator.services.mozilla.com/D99380 UltraBlame original commit: efd88e38955fc4722c6a882c175fdb48d6ff9e10
…as configurable. r=tcampbell Implements the changes from <tc39/ecma262#2164> and <tc39/ecma262#2210> for [[GetOwnProperty]]. Part 3 will update [[DefineOwnProperty]] and part 5 updates [[Set]]. A side-effect of this change is that non-extensible, non-empty TypedArrays are no longer considered as sealed by `Object.isSealed()`. A later patch in this series will update test262 to enable more currently skipped TypedArray tests. Differential Revision: https://phabricator.services.mozilla.com/D99380 UltraBlame original commit: efd88e38955fc4722c6a882c175fdb48d6ff9e10
https://bugs.webkit.org/show_bug.cgi?id=218776 Reviewed by Yusuke Suzuki. JSTests: * stress/reflect-set.js: * stress/typedarray-functions-with-neutered.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-join.js: Added. * stress/typedarray-lastIndexOf.js: Update tests. * test262/expectations.yaml: Mark a handful of test cases as temporarily failing. These will disappear in a future test262 update. Source/JavaScriptCore: The recent spec changes for typed arrays with detached buffers had certain ripple effects, namely the following two PRs which will be presented in next week's TC39 meeting. Since no controversy is expected, this patch addresses them now, though test262 adjustments are forthcoming. 1. tc39/ecma262#2210 It is correct that `ta[i] = n` doesn't throw when `ta` has a detached buffer or `i` is otherwise OOB, but by not throwing, Reflect.set(ta, i, n) is obliged to return true. 2. tc39/ecma262#2221 Until now, %TypedArray%.prototype.{includes, indexOf, join, lastIndexOf} lacked a rigorous specification; in particular, each has a parameter that may detach the buffer upon valueOf or toString, and the expected behavior was not made clear. It seems most sensible to do what the corresponding Array methods do upon `array.length = 0`: make use of the cached length but don't access indices, such that indexOf/lastIndexOf return -1 while includes/join act as if the elements were all `undefined`. * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::put): (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): (JSC::JSGenericTypedArrayView<Adaptor>::putByIndex): * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: (JSC::genericTypedArrayViewProtoFuncIncludes): (JSC::genericTypedArrayViewProtoFuncIndexOf): (JSC::genericTypedArrayViewProtoFuncJoin): (JSC::genericTypedArrayViewProtoFuncLastIndexOf): Canonical link: https://commits.webkit.org/231449@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Resolves #2208.
This behavior is necessitated by web reality and tied to #2164 (although the OOB path is technically separate).
@syg and I chatted about whether the (non-normative) description of [[Set]] in Table 6 needs to be updated and concluded "no" for two reasons: