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

Issue 2840021: Fixes bug in Array.prototype.lastIndexOf when called with null or undefined a... (Closed)

Created:
10 years, 6 months ago by Rico
Modified:
9 years, 6 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Fixes bug in Array.prototype.lastIndexOf when called with null or undefined as fromIndex argument. (fixes issue 754). Committed: http://code.google.com/p/v8/source/detail?r=4950

Patch Set 1 #

Total comments: 4

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -2 lines) Patch
M src/array.js View 1 2 chunks +2 lines, -2 lines 0 comments Download
A test/mjsunit/regress/regress-754.js View 1 1 chunk +39 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Rico
10 years, 6 months ago (2010-06-25 08:45:52 UTC) #1
Lasse Reichstein
LGTM http://codereview.chromium.org/2840021/diff/1/2 File src/array.js (right): http://codereview.chromium.org/2840021/diff/1/2#newcode957 src/array.js:957: if (index == null) { Use if (IS_UNDEFINED(index)) ...
10 years, 6 months ago (2010-06-25 09:10:32 UTC) #2
Lasse Reichstein
LGTM http://codereview.chromium.org/2840021/diff/1/2 File src/array.js (right): http://codereview.chromium.org/2840021/diff/1/2#newcode957 src/array.js:957: if (index == null) { Use if (IS_UNDEFINED(index)) ...
10 years, 6 months ago (2010-06-25 09:10:32 UTC) #3
Rico
10 years, 6 months ago (2010-06-25 09:27:10 UTC) #4
http://codereview.chromium.org/2840021/diff/1/2
File src/array.js (right):

http://codereview.chromium.org/2840021/diff/1/2#newcode957
src/array.js:957: if (index == null) {
On 2010/06/25 09:10:32, Lasse Reichstein wrote:
> Use
>  if (IS_UNDEFINED(index)) {
> instead. It'll catch the case where there is only on argument  just as well,
but
> won't waste time comparing to null.

Done.

http://codereview.chromium.org/2840021/diff/1/3
File test/mjsunit/regress/regress-754.js (right):

http://codereview.chromium.org/2840021/diff/1/3#newcode37
test/mjsunit/regress/regress-754.js:37: assertEquals(a.lastIndexOf(2, null),
-1);
On 2010/06/25 09:10:32, Lasse Reichstein wrote:
> Add the cases with only one argument as well.
> Put expected value as first arguemtn to assertEquals, and actual as second.
> Always give a third argument to assertEquals, so you can see which test failed
> (if the expected values aren't unique in the file). They don't have to be
fancy
> or saying, just unique and searchable.
Single argument tests added.
With the new test script the actual line number of the failure for mjsunit tests
is provided (i.e., the unique dummy values are not needed anymore)

Powered by Google App Engine
This is Rietveld 408576698