Commit Graph

16 Commits

Author SHA1 Message Date
Mike Stanton
2222a9d67e [Builtins] Array.prototype.reduce missing length check
In the recent port of reduce() and reduceRight(), a check for a length
change during the loop (standard for iterating builtins) was omitted.

We did get array bounds check protection, however it didn't expose
the issue in our tests because the bounds check is against the
backing store length, not against the length in the referring JSArray.

Also added a test for reduceRight().

R=jgruber@chromium.org

Bug: chromium:937676
Change-Id: I76e22e0d71965bff84a0822b1df5dc818a00b50e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1503732
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60033}
2019-03-05 14:58:59 +00:00
Sigurd Schneider
d1df563059 [turbofan] Fix bug in Array.p.reduceRight
Bug: v8:7495
Change-Id: Id929804e0d0f78c17d81d07cd6a5c5e571449d35
Reviewed-on: https://chromium-review.googlesource.com/947974
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51720}
2018-03-05 10:52:32 +00:00
Sigurd Schneider
8d1526b6fb [turbofan] Fix bug in Array.p.reduce[Right]
Array.p.reduce[Right] did not correctly treat holey arrays
when dealing with mixed holey/non-holey receiver maps.

Bug: chromium:804956
Change-Id: Ic22f64a1beeb93005809948299cde1f1d21a0f19
Reviewed-on: https://chromium-review.googlesource.com/883241
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50864}
2018-01-25 10:06:38 +00:00
Sigurd Schneider
932dc50fbb [turbofan] Enable Array.p.reduce[Right] for holey arrays
Change-Id: If1a3d08c1fca73234d94db6b527f5d11d10aa6cc
Reviewed-on: https://chromium-review.googlesource.com/867032
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50722}
2018-01-19 13:55:56 +00:00
Sigurd Schneider
4a0800048c [turbofan] Fix inlining of A.p.reduce[Right] for packed case
Change-Id: Idae3ceb3f8de79ab94ccaa1961d025242a51714d
Reviewed-on: https://chromium-review.googlesource.com/866715
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50580}
2018-01-15 14:20:47 +00:00
Daniel Clifford
7bcd92650c Implement Array.prototype.reduceRight inlining in TF
Bug: v8:1956
Change-Id: I785986ed20e60e21966abe82a1567d239b22b416
Reviewed-on: https://chromium-review.googlesource.com/840026
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50283}
2017-12-21 20:05:13 +00:00
Daniel Clifford
14cd4b5455 Implement Array.prototype.reduce inlining in TF
Bug: v8:1956,v8:4869
Change-Id: Id5822319c14142be2dd984c922b2b65717b96dee
Reviewed-on: https://chromium-review.googlesource.com/803974
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50261}
2017-12-21 12:31:54 +00:00
Camillo Bruni
7742e534a8 [runtime] Remove unecessary ToString conversion for Array.prototype.forEach
Given that the index we use is checked to be in array index range there is no
need for a costly ToString conversion. All involved helpers for lookup up
properties directly support Smi/HeapNumber indices directly.

Cleanup: Rename GotoUnlessNumberLessThan => GotoIfNumberGreaterThanOrEqual

Change-Id: Iaddc4940f5d984572aa218d568ca71bf694cee74
Reviewed-on: https://chromium-review.googlesource.com/640388
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48039}
2017-09-15 12:39:56 +00:00
danno
176a43fb86 [builtins] Implement Array.prototype.reduce in the CSA
BUG=v8:1956

Review-Url: https://codereview.chromium.org/2752273003
Cr-Commit-Position: refs/heads/master@{#43987}
2017-03-21 15:57:38 +00:00
wingo@igalia.com
6c9bab5c74 Array.prototype.{reduce, reduceRight}: Wrong order of operations when determining initial value.
BUG=v8:3534
LOG=
R=svenpanne@chromium.org, wingo@igalia.com

Review URL: https://codereview.chromium.org/614733002

Patch from Diego Pino <dpino@igalia.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24807 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-22 13:13:19 +00:00
svenpanne@chromium.org
fe58e3d7b8 Removed 'executable' bits from mjsunit tests.
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/214413006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20299 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-27 12:32:27 +00:00
yangguo@chromium.org
4783d3c31b Remove 'type' and 'arguments' properties from Error object.
R=svenpanne@chromium.org
BUG=v8:2397

Review URL: https://chromiumcodereview.appspot.com/11358214

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12956 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-14 09:14:47 +00:00
ager@chromium.org
a01b45df58 Fix a number of tests that incorrectly used assertUnreachable.
Our testing infrastructure uses exceptions to indicate
errors. assertUnreachable therefore throws an exception to indicate
that it was reached. Therefore, it cannot be used to check that an
exception was thrown using the pattern:

try {
  shouldThrow();
  assertUnreachable();
} catch(e) {
}

Such a test will always pass because assertUnreachable will throw an
exception if shouldThrow does not.

R=ricow@chromium.org

Review URL: http://codereview.chromium.org/7053035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8117 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-31 08:08:42 +00:00
lrn@chromium.org
e3bb851efb X64: Fix bug in left-shift.
Also changed a few other places that looked suspicious in the same way.
Added more info to failing test case and rewrote incorrect uses of mjsunit "fail" function.

Review URL: http://codereview.chromium.org/155279


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2409 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-07-09 08:00:12 +00:00
lrn@chromium.org
123f671a17 Reduced size of Array.reduce test.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1750 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-04-21 11:25:51 +00:00
lrn@chromium.org
97427d86e0 Add ES5 Array methods reduce and reduceRight, with test.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1749 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-04-21 09:57:30 +00:00