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

Issue 88022: Add Array.prototype.reduce and .reduceRight. (Closed)

Created:
11 years, 8 months ago by Lasse Reichstein
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Add ES5 Array methods reduce and reduceRight, with test.

Patch Set 1 #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+556 lines, -2 lines) Patch
M src/array.js View 3 chunks +62 lines, -2 lines 8 comments Download
M src/messages.js View 1 chunk +1 line, -0 lines 0 comments Download
A test/mjsunit/array-reduce.js View 1 chunk +490 lines, -0 lines 1 comment Download
M test/mjsunit/mjsunit.js View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Lasse Reichstein
Review, please.
11 years, 8 months ago (2009-04-21 09:00:07 UTC) #1
Dean McNamee
http://codereview.chromium.org/88022/diff/1/2 File src/array.js (right): http://codereview.chromium.org/88022/diff/1/2#newcode891 Line 891: find_initial: if (%_ArgumentsLength() < 2) { I am ...
11 years, 8 months ago (2009-04-21 09:19:50 UTC) #2
Christian Plesner Hansen
Lgtm http://codereview.chromium.org/88022/diff/1/2 File src/array.js (right): http://codereview.chromium.org/88022/diff/1/2#newcode891 Line 891: find_initial: if (%_ArgumentsLength() < 2) { I ...
11 years, 8 months ago (2009-04-21 09:39:17 UTC) #3
Lasse Reichstein
11 years, 8 months ago (2009-04-21 09:53:50 UTC) #4
Thanks for the comments.

http://codereview.chromium.org/88022/diff/1/2
File src/array.js (right):

http://codereview.chromium.org/88022/diff/1/2#newcode891
Line 891: find_initial: if (%_ArgumentsLength() < 2) {
I use the label to have a location to break to, to avoid executing the throw if
we don't find an element.

I preferred adding the label to the existing statement instead of creating
another block statement inside the if.

http://codereview.chromium.org/88022/diff/1/2#newcode891
Line 891: find_initial: if (%_ArgumentsLength() < 2) {
On 2009/04/21 09:39:17, Christian Plesner Hansen wrote:
> I think the code style is
> 
>  find_initial:
>   if (%_...)
> 

Done.

http://codereview.chromium.org/88022/diff/1/2#newcode892
Line 892: for (;i < length; i++) {
On 2009/04/21 09:19:50, Dean McNamee wrote:
> space after ;

Done.

http://codereview.chromium.org/88022/diff/1/2#newcode913
Line 913: throw MakeTypeError('called_non_callable', [ callback ]);
On 2009/04/21 09:19:50, Dean McNamee wrote:
> no spaces around [ ] (consistency with [])

Done.

Powered by Google App Engine
This is Rietveld 408576698