Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Issue 2697593002: Reland [typedarrays] move %TypedArray%.prototype.copyWithin to C++ (Closed)

Created:
3 years, 10 months ago by caitp
Modified:
3 years, 10 months ago
CC:
Benedikt Meurer, v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Reland [typedarrays] move %TypedArray%.prototype.copyWithin to C++ - Removes shared InnerArrayCopyWithin JS builtin from src/js/array.js - Implements %TypedArray%.prototype.copyWithin as a C++ builtin, which relies on std::memmove rather than accessing individual eleements. - Fixes the case where copyWithin is invoked on a TypedArray with a detached buffer. - Add tests to ensure that +/-Infinity (for all 3 parameters) is handled correctly by the algorithm The C++ version gets through the benchmark more than 25000 times as quickly as the JS implementation. BUG=v8:5925, v8:5929, v8:4648 R=cbruni@chromium.org, adamk@chromium.org, littledan@chromium.org Review-Url: https://codereview.chromium.org/2697593002 Cr-Commit-Position: refs/heads/master@{#43213} Committed: https://chromium.googlesource.com/v8/v8/+/dc302c74be4183db1b84347afab893825c887add

Patch Set 1 #

Patch Set 2 : with a fix #

Patch Set 3 : make compiler happy #

Total comments: 1

Patch Set 4 : version that throws instead of early return + fixes a typo #

Patch Set 5 : Back to an early return to match web reality #

Total comments: 6

Patch Set 6 : don't throw if detached in ValidateTypedArray() #

Patch Set 7 : don't change test262.status since it still doesn't throw #

Total comments: 8

Patch Set 8 : point to the bug where requested, + extra assertion... #

Total comments: 2

Patch Set 9 : last of it #

Total comments: 5

Patch Set 10 : Add bounds-checking DCHECKs #

Total comments: 3

Patch Set 11 : bigger fatter DCHECKs #

Total comments: 2

Patch Set 12 : update comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -28 lines) Patch
M src/bootstrapper.cc View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M src/builtins/builtins.h View 1 chunk +3 lines, -1 line 0 comments Download
M src/builtins/builtins-typedarray.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +99 lines, -0 lines 0 comments Download
M src/js/array.js View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +8 lines, -13 lines 0 comments Download
M src/js/typedarray.js View 4 chunks +0 lines, -14 lines 0 comments Download
A test/mjsunit/es6/regress/regress-5929-1.js View 1 4 1 chunk +14 lines, -0 lines 0 comments Download
M test/mjsunit/es6/typedarray-copywithin.js View 1 2 3 4 5 6 7 2 chunks +74 lines, -0 lines 0 comments Download

Messages

Total messages: 77 (44 generated)
caitp
PTAL, here's a fix for the copyWithin() form of this bug. Another one for A.p.includes ...
3 years, 10 months ago (2017-02-13 14:32:29 UTC) #3
caitp
https://codereview.chromium.org/2697593002/diff/40001/test/mjsunit/es6/regress/regress-5929-1.js File test/mjsunit/es6/regress/regress-5929-1.js (right): https://codereview.chromium.org/2697593002/diff/40001/test/mjsunit/es6/regress/regress-5929-1.js#newcode14 test/mjsunit/es6/regress/regress-5929-1.js:14: arr.copyWithin(tmp); So, the question is if this should throw ...
3 years, 10 months ago (2017-02-13 14:49:03 UTC) #8
Benedikt Meurer
LGTM from my side
3 years, 10 months ago (2017-02-13 17:44:19 UTC) #15
Dan Ehrenberg
Code seems fine, but semantically, could we start throwing on detached TypedArrays in a more ...
3 years, 10 months ago (2017-02-13 17:49:04 UTC) #16
Dan Ehrenberg
On 2017/02/13 17:49:04, Dan Ehrenberg wrote: > Code seems fine, but semantically, could we start ...
3 years, 10 months ago (2017-02-13 17:49:47 UTC) #17
caitp
On 2017/02/13 17:49:47, Dan Ehrenberg wrote: > On 2017/02/13 17:49:04, Dan Ehrenberg wrote: > > ...
3 years, 10 months ago (2017-02-13 17:57:15 UTC) #18
Dan Ehrenberg
On 2017/02/13 17:57:15, caitp wrote: > On 2017/02/13 17:49:47, Dan Ehrenberg wrote: > > On ...
3 years, 10 months ago (2017-02-13 18:21:51 UTC) #19
caitp
On 2017/02/13 18:21:51, Dan Ehrenberg wrote: > On 2017/02/13 17:57:15, caitp wrote: > > On ...
3 years, 10 months ago (2017-02-13 18:24:07 UTC) #20
Dan Ehrenberg
On 2017/02/13 18:24:07, caitp wrote: > On 2017/02/13 18:21:51, Dan Ehrenberg wrote: > > On ...
3 years, 10 months ago (2017-02-13 18:35:18 UTC) #21
caitp
On 2017/02/13 18:35:18, Dan Ehrenberg wrote: > On 2017/02/13 18:24:07, caitp wrote: > > On ...
3 years, 10 months ago (2017-02-13 18:44:44 UTC) #22
Dan Ehrenberg
https://codereview.chromium.org/2697593002/diff/80001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/80001/src/builtins/builtins-typedarray.cc#newcode185 src/builtins/builtins-typedarray.cc:185: THROW_NEW_ERROR(isolate, NewTypeError(message, operation), JSTypedArray); This is also a change ...
3 years, 10 months ago (2017-02-13 19:56:44 UTC) #27
caitp
On 2017/02/13 19:56:44, Dan Ehrenberg wrote: > https://codereview.chromium.org/2697593002/diff/80001/src/builtins/builtins-typedarray.cc > File src/builtins/builtins-typedarray.cc (right): > > https://codereview.chromium.org/2697593002/diff/80001/src/builtins/builtins-typedarray.cc#newcode185 ...
3 years, 10 months ago (2017-02-13 20:07:49 UTC) #28
Camillo Bruni
https://codereview.chromium.org/2697593002/diff/80001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/80001/src/builtins/builtins-typedarray.cc#newcode185 src/builtins/builtins-typedarray.cc:185: THROW_NEW_ERROR(isolate, NewTypeError(message, operation), JSTypedArray); On 2017/02/13 at 19:56:44, Dan ...
3 years, 10 months ago (2017-02-13 20:18:56 UTC) #29
caitp
https://codereview.chromium.org/2697593002/diff/80001/test/mjsunit/es6/regress/regress-5929-1.js File test/mjsunit/es6/regress/regress-5929-1.js (right): https://codereview.chromium.org/2697593002/diff/80001/test/mjsunit/es6/regress/regress-5929-1.js#newcode14 test/mjsunit/es6/regress/regress-5929-1.js:14: arr.copyWithin(tmp); On 2017/02/13 20:18:56, Camillo Bruni wrote: > On ...
3 years, 10 months ago (2017-02-13 20:21:55 UTC) #30
Camillo Bruni
Sorry, I didn't follow the complete conversation :). Given that I implemented throwing in another ...
3 years, 10 months ago (2017-02-13 20:22:32 UTC) #31
Camillo Bruni
ok, SGTM, will update my CL then accordingly.
3 years, 10 months ago (2017-02-13 20:23:17 UTC) #32
caitp
Ok, Adam does this work for you? I think Dan is happy with it
3 years, 10 months ago (2017-02-13 21:48:11 UTC) #41
adamk
Only looked at the bits regarding not-throwing. https://codereview.chromium.org/2697593002/diff/120001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/120001/src/builtins/builtins-typedarray.cc#newcode180 src/builtins/builtins-typedarray.cc:180: // TODO(caitp): ...
3 years, 10 months ago (2017-02-13 22:44:23 UTC) #42
caitp
https://codereview.chromium.org/2697593002/diff/120001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/120001/src/builtins/builtins-typedarray.cc#newcode180 src/builtins/builtins-typedarray.cc:180: // TODO(caitp): throw if array.[[ViewedArrayBuffer]] is neutered. On 2017/02/13 ...
3 years, 10 months ago (2017-02-14 00:34:46 UTC) #45
adamk
lgtm with this TODO fixes, assuming that bmeurer read the actual copyWithin implementation for his ...
3 years, 10 months ago (2017-02-14 00:57:18 UTC) #46
caitp
https://codereview.chromium.org/2697593002/diff/140001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/140001/src/builtins/builtins-typedarray.cc#newcode180 src/builtins/builtins-typedarray.cc:180: // TODO(caitp): throw if array.[[ViewedArrayBuffer]] is neutered. On 2017/02/14 ...
3 years, 10 months ago (2017-02-14 01:00:48 UTC) #47
Dan Ehrenberg
The code looks good to me, AFAICT this fixes the original issue and doesn't change ...
3 years, 10 months ago (2017-02-14 18:11:46 UTC) #52
caitp
https://codereview.chromium.org/2697593002/diff/160001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/160001/src/builtins/builtins-typedarray.cc#newcode212 src/builtins/builtins-typedarray.cc:212: if (V8_UNLIKELY(array->WasNeutered())) return *array; On 2017/02/14 18:11:45, Dan Ehrenberg ...
3 years, 10 months ago (2017-02-14 18:12:43 UTC) #53
caitp
https://codereview.chromium.org/2697593002/diff/160001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/160001/src/builtins/builtins-typedarray.cc#newcode212 src/builtins/builtins-typedarray.cc:212: if (V8_UNLIKELY(array->WasNeutered())) return *array; On 2017/02/14 18:12:43, caitp wrote: ...
3 years, 10 months ago (2017-02-14 18:20:39 UTC) #54
caitp
https://codereview.chromium.org/2697593002/diff/160001/test/mjsunit/es6/typedarray-copywithin.js File test/mjsunit/es6/typedarray-copywithin.js (right): https://codereview.chromium.org/2697593002/diff/160001/test/mjsunit/es6/typedarray-copywithin.js#newcode244 test/mjsunit/es6/typedarray-copywithin.js:244: // detached buffer (per v8:4648). Yeah, this test verifies ...
3 years, 10 months ago (2017-02-14 18:22:07 UTC) #55
Dan Ehrenberg
lgtm https://codereview.chromium.org/2697593002/diff/160001/test/mjsunit/es6/typedarray-copywithin.js File test/mjsunit/es6/typedarray-copywithin.js (right): https://codereview.chromium.org/2697593002/diff/160001/test/mjsunit/es6/typedarray-copywithin.js#newcode235 test/mjsunit/es6/typedarray-copywithin.js:235: "array.[[ViewedArrayBuffer]] is neutered."); Oh sorry, I missed this ...
3 years, 10 months ago (2017-02-14 18:26:02 UTC) #56
Dan Ehrenberg
https://codereview.chromium.org/2697593002/diff/180001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/180001/src/builtins/builtins-typedarray.cc#newcode251 src/builtins/builtins-typedarray.cc:251: DCHECK_GT(len - count, 0); Shouldn't this be DCHECK_GE, since ...
3 years, 10 months ago (2017-02-14 18:33:53 UTC) #59
caitp
https://codereview.chromium.org/2697593002/diff/180001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/180001/src/builtins/builtins-typedarray.cc#newcode251 src/builtins/builtins-typedarray.cc:251: DCHECK_GT(len - count, 0); On 2017/02/14 18:33:53, Dan Ehrenberg ...
3 years, 10 months ago (2017-02-14 18:36:14 UTC) #60
caitp
https://codereview.chromium.org/2697593002/diff/180001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2697593002/diff/180001/src/builtins/builtins-typedarray.cc#newcode251 src/builtins/builtins-typedarray.cc:251: DCHECK_GT(len - count, 0); On 2017/02/14 18:36:14, caitp wrote: ...
3 years, 10 months ago (2017-02-14 18:37:10 UTC) #61
Camillo Bruni
lgtm https://codereview.chromium.org/2697593002/diff/200001/src/js/array.js File src/js/array.js (right): https://codereview.chromium.org/2697593002/diff/200001/src/js/array.js#newcode1273 src/js/array.js:1273: // ES6 draft 03-17-15, section 22.1.3.3 nit: please ...
3 years, 10 months ago (2017-02-15 13:36:28 UTC) #66
caitp
Thanks, gonna reland shortly https://codereview.chromium.org/2697593002/diff/200001/src/js/array.js File src/js/array.js (right): https://codereview.chromium.org/2697593002/diff/200001/src/js/array.js#newcode1273 src/js/array.js:1273: // ES6 draft 03-17-15, section ...
3 years, 10 months ago (2017-02-15 13:51:27 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2697593002/220001
3 years, 10 months ago (2017-02-15 14:18:04 UTC) #74
commit-bot: I haz the power
3 years, 10 months ago (2017-02-15 14:21:29 UTC) #77
Message was sent while issue was closed.
Committed patchset #12 (id:220001) as
https://chromium.googlesource.com/v8/v8/+/dc302c74be4183db1b84347afab893825c8...

Powered by Google App Engine
This is Rietveld 408576698