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

Issue 2664173002: Throw when a holey property is set in Array.sort (Closed)

Created:
3 years, 10 months ago by Choongwoo Han
Modified:
3 years, 10 months ago
Reviewers:
adamk
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Throw when a holey property is set in Array.sort Do not allow that holey properties are defined in Array sort. Throw a type error if the array is not extensible and there are holey properties in the middle of the array. BUG=v8:4888 Review-Url: https://codereview.chromium.org/2664173002 Cr-Commit-Position: refs/heads/master@{#43126} Committed: https://chromium.googlesource.com/v8/v8/+/48dff523f7348af657d610f789d326d85f84ecec

Patch Set 1 #

Patch Set 2 : Throw when a holey property is set in Array.sort #

Patch Set 3 : Use hasOwnProperties for checking holes #

Patch Set 4 : Use preventExtensions for test #

Total comments: 2

Patch Set 5 : Patch PrepareSlowElementsForSort directly #

Total comments: 7

Patch Set 6 : Handling undefs #

Patch Set 7 : Not allow adding propertes in non-extensible array #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -2 lines) Patch
M AUTHORS View 1 2 3 4 5 6 2 chunks +1 line, -1 line 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M test/mjsunit/array-sort.js View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (11 generated)
Choongwoo Han
We need to prevent modification of properties in array sort for non-extensible arrays. Thus, I ...
3 years, 10 months ago (2017-01-31 16:51:36 UTC) #3
Choongwoo Han
We need to prevent modification of properties in array sort for non-extensible arrays. Thus, I ...
3 years, 10 months ago (2017-01-31 16:51:36 UTC) #4
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/2664173002/60001
3 years, 10 months ago (2017-02-01 05:00:05 UTC) #6
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started by full ...
3 years, 10 months ago (2017-02-01 05:00:06 UTC) #8
adamk
Thanks for the patch, but this approach looks like it's not attacking the real source ...
3 years, 10 months ago (2017-02-01 16:39:13 UTC) #9
Choongwoo Han
On 2017/02/01 16:39:13, adamk wrote: > Thanks for the patch, but this approach looks like ...
3 years, 10 months ago (2017-02-01 18:20:27 UTC) #10
Choongwoo Han
https://codereview.chromium.org/2664173002/diff/60001/test/mjsunit/array-sort.js File test/mjsunit/array-sort.js (right): https://codereview.chromium.org/2664173002/diff/60001/test/mjsunit/array-sort.js#newcode502 test/mjsunit/array-sort.js:502: assertEquals(arr, [1,2,undefined]); On 2017/02/01 16:39:13, adamk wrote: > Shouldn't ...
3 years, 10 months ago (2017-02-01 18:21:07 UTC) #11
Choongwoo Han
Hi, I pushed a new patch. As you said, returning -1 throws TypeError. I still ...
3 years, 10 months ago (2017-02-02 05:11:10 UTC) #12
adamk
Apologies for the review delay. The reason for the TypeError is that the Array builtins ...
3 years, 10 months ago (2017-02-07 00:23:47 UTC) #13
Choongwoo Han
Thank you for the feedback! https://codereview.chromium.org/2664173002/diff/80001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/2664173002/diff/80001/src/objects.cc#newcode16802 src/objects.cc:16802: bool is_extensible = JSObject::IsExtensible(object); ...
3 years, 10 months ago (2017-02-07 09:45:49 UTC) #14
Choongwoo Han
I added one more test case for undef cases. bail out in three different locations ...
3 years, 10 months ago (2017-02-07 10:45:12 UTC) #15
adamk
https://codereview.chromium.org/2664173002/diff/80001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/2664173002/diff/80001/src/objects.cc#newcode16817 src/objects.cc:16817: Handle<Object> value(dict->ValueAt(i), isolate); On 2017/02/07 09:45:49, tunz wrote: > ...
3 years, 10 months ago (2017-02-08 01:14:07 UTC) #16
Choongwoo Han
On 2017/02/08 01:14:07, adamk wrote: > https://codereview.chromium.org/2664173002/diff/80001/src/objects.cc > File src/objects.cc (right): > > https://codereview.chromium.org/2664173002/diff/80001/src/objects.cc#newcode16817 > ...
3 years, 10 months ago (2017-02-08 06:31:12 UTC) #17
adamk
lgtm Thanks for working through the back-and-forth, I think this simpler approach makes sense at ...
3 years, 10 months ago (2017-02-10 19:04:32 UTC) #18
Choongwoo Han
On 2017/02/10 19:04:32, adamk wrote: > lgtm > > Thanks for working through the back-and-forth, ...
3 years, 10 months ago (2017-02-11 12:45:59 UTC) #23
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/2664173002/120001
3 years, 10 months ago (2017-02-11 12:59:23 UTC) #25
commit-bot: I haz the power
3 years, 10 months ago (2017-02-11 13:00:46 UTC) #28
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as
https://chromium.googlesource.com/v8/v8/+/48dff523f7348af657d610f789d326d85f8...

Powered by Google App Engine
This is Rietveld 408576698