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

Issue 2735563002: Migrate %TypedArray%.prototype.fill to C++ (Closed)

Created:
3 years, 9 months ago by rongjie
Modified:
3 years, 9 months ago
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/heads/master
Project:
v8
Visibility:
Public.

Description

Migrate %TypedArray%.prototype.fill to C++ BUG=v8:5929 R=adamk@chromium.org,bmeurer@chromium.org Review-Url: https://codereview.chromium.org/2735563002 Cr-Commit-Position: refs/heads/master@{#43934} Committed: https://chromium.googlesource.com/v8/v8/+/cb903e317338798fec3a43fea2ec285d3626c333

Patch Set 1 #

Total comments: 6

Patch Set 2 : minor change #

Total comments: 1

Patch Set 3 : Use DataPtr #

Patch Set 4 : fast/slow path draft #

Total comments: 1

Patch Set 5 : Implement ElementAccessor #

Total comments: 12

Patch Set 6 : fix nits #

Patch Set 7 : typo #

Total comments: 7

Patch Set 8 : Makes compiler happy #

Total comments: 1

Patch Set 9 : typo #

Total comments: 6

Patch Set 10 : fix more nits #

Patch Set 11 : format 80 cols #

Total comments: 12

Patch Set 12 : rm template #

Patch Set 13 : rm template 2 #

Patch Set 14 : fix fp and no args bugs #

Total comments: 2

Patch Set 15 : Update test #

Total comments: 4

Patch Set 16 : Use existing helper #

Patch Set 17 : rm unused kMethodName #

Patch Set 18 : format #

Patch Set 19 : Add WasNeutered checks again #

Total comments: 8

Patch Set 20 : Use BackingStore::from_{int,double} #

Patch Set 21 : Use BackingStore::from_{int,double} #

Patch Set 22 : Merge branch 'master' into fill #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+178 lines, -42 lines) Patch
M src/bootstrapper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M src/builtins/builtins.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M src/builtins/builtins-typedarray.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +49 lines, -0 lines 0 comments Download
M src/elements.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +4 lines, -0 lines 0 comments Download
M src/elements.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +58 lines, -0 lines 2 comments Download
M src/js/array.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +6 lines, -13 lines 0 comments Download
M src/js/typedarray.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 4 chunks +0 lines, -14 lines 0 comments Download
M test/mjsunit/es6/typedarray-fill.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +57 lines, -15 lines 0 comments Download

Messages

Total messages: 76 (23 generated)
rongjie
PTAL https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc#newcode487 src/builtins/builtins-typedarray.cc:487: } Casting integer to and from double might ...
3 years, 9 months ago (2017-03-04 07:24:46 UTC) #1
rongjie
I made a mistake in previous benchmark. See updated benchmark and result at crbug.com/v8/5929#c15
3 years, 9 months ago (2017-03-05 02:10:18 UTC) #4
Benedikt Meurer
Thanks for the patch. I like the consistent, good performance :-) Maybe we should introduce ...
3 years, 9 months ago (2017-03-05 17:52:24 UTC) #8
rongjie
On 2017/03/05 17:52:24, Benedikt Meurer wrote: > Thanks for the patch. I like the consistent, ...
3 years, 9 months ago (2017-03-06 00:05:16 UTC) #9
Benedikt Meurer
On 2017/03/06 00:05:16, rongjie wrote: > On 2017/03/05 17:52:24, Benedikt Meurer wrote: > > Thanks ...
3 years, 9 months ago (2017-03-06 03:50:24 UTC) #10
Camillo Bruni
first round of comments. https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc#newcode467 src/builtins/builtins-typedarray.cc:467: if (V8_UNLIKELY(array->WasNeutered())) return *array; This ...
3 years, 9 months ago (2017-03-06 09:13:45 UTC) #11
Camillo Bruni
Also, I agree on implementing this in the ElementsAccessor might be cleaner. Feel free to ...
3 years, 9 months ago (2017-03-06 09:15:39 UTC) #12
rongjie
Quite confused here, please check my understanding: 1. Call builtin func that check isNumber(value). 2. ...
3 years, 9 months ago (2017-03-06 10:31:12 UTC) #13
rongjie
https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc#newcode467 src/builtins/builtins-typedarray.cc:467: if (V8_UNLIKELY(array->WasNeutered())) return *array; On 2017/03/06 09:13:44, Camillo Bruni ...
3 years, 9 months ago (2017-03-06 10:35:49 UTC) #14
Camillo Bruni
On 2017/03/06 at 10:31:12, loorongjie wrote: > Quite confused here, please check my understanding: > ...
3 years, 9 months ago (2017-03-06 13:52:45 UTC) #15
Choongwoo Han
https://codereview.chromium.org/2735563002/diff/20001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2735563002/diff/20001/src/builtins/builtins-typedarray.cc#newcode516 src/builtins/builtins-typedarray.cc:516: static_cast<ctype*>(array->GetBuffer()->backing_store()); \ You should consider byte_offset for backing_store.
3 years, 9 months ago (2017-03-08 08:18:30 UTC) #17
rongjie
On 2017/03/08 08:18:30, Choongwoo Han wrote: > https://codereview.chromium.org/2735563002/diff/20001/src/builtins/builtins-typedarray.cc > File src/builtins/builtins-typedarray.cc (right): > > https://codereview.chromium.org/2735563002/diff/20001/src/builtins/builtins-typedarray.cc#newcode516 ...
3 years, 9 months ago (2017-03-08 10:05:56 UTC) #18
rongjie
cbruni@ cwhan.tunz@ PTAL? For obj_value->IsNumber() == false case: Since I created k as C type ...
3 years, 9 months ago (2017-03-09 04:26:52 UTC) #20
Camillo Bruni
On 2017/03/09 at 04:26:52, loorongjie wrote: > cbruni@ cwhan.tunz@ PTAL? > > For obj_value->IsNumber() == ...
3 years, 9 months ago (2017-03-09 12:11:03 UTC) #21
Camillo Bruni
https://codereview.chromium.org/2735563002/diff/80001/src/builtins/builtins-typedarray.cc File src/builtins/builtins-typedarray.cc (right): https://codereview.chromium.org/2735563002/diff/80001/src/builtins/builtins-typedarray.cc#newcode593 src/builtins/builtins-typedarray.cc:593: Could you put the following code inside the ElementsAccessor? ...
3 years, 9 months ago (2017-03-09 12:11:08 UTC) #22
rongjie
3 years, 9 months ago (2017-03-10 13:23:31 UTC) #23
Camillo Bruni
next comment round. Looks good so far, some more nits, but we're almost done. https://codereview.chromium.org/2735563002/diff/100001/src/elements.cc ...
3 years, 9 months ago (2017-03-13 08:12:58 UTC) #24
rongjie
https://codereview.chromium.org/2735563002/diff/100001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/100001/src/elements.cc#newcode484 src/elements.cc:484: if (V8_UNLIKELY(array->WasNeutered())) { On 2017/03/13 08:12:58, Camillo Bruni wrote: ...
3 years, 9 months ago (2017-03-13 08:43:02 UTC) #25
Camillo Bruni
sorry, some more comments. https://codereview.chromium.org/2735563002/diff/140001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/140001/src/elements.cc#newcode483 src/elements.cc:483: // TODO(caitp,cbruni): throw on neutered ...
3 years, 9 months ago (2017-03-13 09:02:30 UTC) #26
rongjie
https://codereview.chromium.org/2735563002/diff/140001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/140001/src/elements.cc#newcode483 src/elements.cc:483: // TODO(caitp,cbruni): throw on neutered array and just return ...
3 years, 9 months ago (2017-03-13 10:46:40 UTC) #27
Camillo Bruni
more nits https://codereview.chromium.org/2735563002/diff/180001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/180001/src/elements.cc#newcode2881 src/elements.cc:2881: Handle<JSTypedArray> array = Handle<JSTypedArray>::cast(receiver); Another nit, please ...
3 years, 9 months ago (2017-03-13 15:58:14 UTC) #28
rongjie
https://codereview.chromium.org/2735563002/diff/180001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/180001/src/elements.cc#newcode2881 src/elements.cc:2881: Handle<JSTypedArray> array = Handle<JSTypedArray>::cast(receiver); On 2017/03/13 15:58:14, Camillo Bruni ...
3 years, 9 months ago (2017-03-14 00:18:08 UTC) #29
Camillo Bruni
https://codereview.chromium.org/2735563002/diff/220001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/220001/src/elements.cc#newcode2847 src/elements.cc:2847: static inline uint8_t MaybeClamp( ConvertNumberToUint8Clamped(Handle<Object> obj_value) { ... https://codereview.chromium.org/2735563002/diff/220001/src/elements.cc#newcode2852 ...
3 years, 9 months ago (2017-03-14 09:30:36 UTC) #30
Camillo Bruni
https://codereview.chromium.org/2735563002/diff/220001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/220001/src/elements.cc#newcode2862 src/elements.cc:2862: static inline T MaybeClamp( On 2017/03/14 at 09:30:36, Camillo ...
3 years, 9 months ago (2017-03-14 09:31:21 UTC) #31
rongjie
Floating point clamping tests mostly fail, not an expert in floating point precision. Need advice. ...
3 years, 9 months ago (2017-03-14 10:08:48 UTC) #32
rongjie
https://codereview.chromium.org/2735563002/diff/280001/test/mjsunit/es6/typedarray-fill.js File test/mjsunit/es6/typedarray-fill.js (right): https://codereview.chromium.org/2735563002/diff/280001/test/mjsunit/es6/typedarray-fill.js#newcode19 test/mjsunit/es6/typedarray-fill.js:19: assertArrayEquals(new constructor([0]).fill(), [0]); This line fails with "Failure (array ...
3 years, 9 months ago (2017-03-14 11:17:15 UTC) #33
rongjie
https://codereview.chromium.org/2735563002/diff/280001/test/mjsunit/es6/typedarray-fill.js File test/mjsunit/es6/typedarray-fill.js (right): https://codereview.chromium.org/2735563002/diff/280001/test/mjsunit/es6/typedarray-fill.js#newcode19 test/mjsunit/es6/typedarray-fill.js:19: assertArrayEquals(new constructor([0]).fill(), [0]); On 2017/03/14 11:17:15, rongjie wrote: > ...
3 years, 9 months ago (2017-03-14 12:54:01 UTC) #34
Camillo Bruni
https://codereview.chromium.org/2735563002/diff/300001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/300001/src/elements.cc#newcode2850 src/elements.cc:2850: return static_cast<uint8_t>(value); Could you use FixedTypedArray<Uint8ClampedArrayTraits>::from_int() ? https://codereview.chromium.org/2735563002/diff/300001/src/elements.cc#newcode2857 src/elements.cc:2857: ...
3 years, 9 months ago (2017-03-14 13:31:07 UTC) #35
rongjie
https://codereview.chromium.org/2735563002/diff/300001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/300001/src/elements.cc#newcode2850 src/elements.cc:2850: return static_cast<uint8_t>(value); On 2017/03/14 13:31:07, Camillo Bruni wrote: > ...
3 years, 9 months ago (2017-03-14 13:43:02 UTC) #36
rongjie
Forgot to actually send patch before commenting ^
3 years, 9 months ago (2017-03-14 13:54:39 UTC) #37
Camillo Bruni
lgtm
3 years, 9 months ago (2017-03-16 12:48:18 UTC) #38
rongjie
On 2017/03/16 12:48:18, Camillo Bruni wrote: > lgtm bmeurer@ caitp@ PTAL? cbruni@ asked me to ...
3 years, 9 months ago (2017-03-18 13:48:19 UTC) #39
Benedikt Meurer
On 2017/03/18 13:48:19, rongjie wrote: > On 2017/03/16 12:48:18, Camillo Bruni wrote: > > lgtm ...
3 years, 9 months ago (2017-03-18 16:15:46 UTC) #40
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/2735563002/320001
3 years, 9 months ago (2017-03-19 06:00:32 UTC) #42
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux64_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_rel_ng/builds/22849) v8_linux64_verify_csa_rel_ng on master.tryserver.v8 (JOB_FAILED, ...
3 years, 9 months ago (2017-03-19 06:03:14 UTC) #44
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/2735563002/360001
3 years, 9 months ago (2017-03-19 06:26:37 UTC) #47
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/builds/15065) v8_linux64_gyp_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, ...
3 years, 9 months ago (2017-03-19 06:41:38 UTC) #49
rongjie
On 2017/03/06 09:13:45, Camillo Bruni wrote: > first round of comments. > > https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typedarray.cc > ...
3 years, 9 months ago (2017-03-19 07:28:39 UTC) #50
Choongwoo Han
On 2017/03/19 07:28:39, rongjie wrote: > On 2017/03/06 09:13:45, Camillo Bruni wrote: > > first ...
3 years, 9 months ago (2017-03-19 09:12:46 UTC) #51
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/2735563002/380001
3 years, 9 months ago (2017-03-20 09:29:24 UTC) #54
commit-bot: I haz the power
Try jobs failed on following builders: v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/19349) v8_mac_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, ...
3 years, 9 months ago (2017-03-20 09:46:41 UTC) #56
Camillo Bruni
just found another simplification :) https://codereview.chromium.org/2735563002/diff/380001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/380001/src/elements.cc#newcode2846 src/elements.cc:2846: static inline uint8_t ConvertNumberToUint8Clamped(Handle<Object> ...
3 years, 9 months ago (2017-03-20 10:20:22 UTC) #57
rongjie
In test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations, there is a test to cast 4294967295 (0b11111111111111111111111111111111) to different number types. The ...
3 years, 9 months ago (2017-03-20 10:41:36 UTC) #58
rongjie
On 2017/03/20 10:41:36, rongjie wrote: > In > test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations, > there is a test to ...
3 years, 9 months ago (2017-03-20 10:46:05 UTC) #59
rongjie
https://codereview.chromium.org/2735563002/diff/380001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/380001/src/elements.cc#newcode2846 src/elements.cc:2846: static inline uint8_t ConvertNumberToUint8Clamped(Handle<Object> obj_value) { On 2017/03/20 10:20:22, ...
3 years, 9 months ago (2017-03-20 12:05:25 UTC) #60
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/2735563002/400001
3 years, 9 months ago (2017-03-20 12:06:49 UTC) #63
Camillo Bruni
comments....
3 years, 9 months ago (2017-03-20 12:38:17 UTC) #64
commit-bot: I haz the power
Failed to apply patch for src/bootstrapper.cc: While running git apply --index -p1; error: patch failed: ...
3 years, 9 months ago (2017-03-20 12:47:07 UTC) #66
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/2735563002/440001
3 years, 9 months ago (2017-03-20 12:56:38 UTC) #69
commit-bot: I haz the power
Committed patchset #22 (id:440001) as https://chromium.googlesource.com/v8/v8/+/cb903e317338798fec3a43fea2ec285d3626c333
3 years, 9 months ago (2017-03-20 13:33:05 UTC) #72
ulan
https://codereview.chromium.org/2735563002/diff/440001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/440001/src/elements.cc#newcode481 src/elements.cc:481: isolate, cast_value, Object::ToNumber(obj_value)); Shouldn't this be hoisted outside the ...
3 years, 9 months ago (2017-03-22 10:10:54 UTC) #74
rongjie
https://codereview.chromium.org/2735563002/diff/440001/src/elements.cc File src/elements.cc (right): https://codereview.chromium.org/2735563002/diff/440001/src/elements.cc#newcode481 src/elements.cc:481: isolate, cast_value, Object::ToNumber(obj_value)); On 2017/03/22 10:10:54, ulan wrote: > ...
3 years, 9 months ago (2017-03-22 10:15:02 UTC) #75
ulan
3 years, 9 months ago (2017-03-22 11:35:31 UTC) #76
Message was sent while issue was closed.
On 2017/03/22 10:15:02, rongjie wrote:
> https://codereview.chromium.org/2735563002/diff/440001/src/elements.cc
> File src/elements.cc (right):
> 
>
https://codereview.chromium.org/2735563002/diff/440001/src/elements.cc#newcod...
> src/elements.cc:481: isolate, cast_value, Object::ToNumber(obj_value));
> On 2017/03/22 10:10:54, ulan wrote:
> > Shouldn't this be hoisted outside the loop?
> > 
> > Otherwise, it allocates (end - start) heap numbers.
> 
> Please see cbruni@ explanation at
>
https://codereview.chromium.org/2735563002/diff/1/src/builtins/builtins-typed...
> 
> We only resort to FillNumberSlowPath if !obj_value->isNumber() (Symbol,Proxy
> etc.)

Thanks, that makes sense :)

Powered by Google App Engine
This is Rietveld 408576698