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

Side by Side Diff: test/mjsunit/regress/regress-crbug-381534.js

Issue 319343002: Bugfix in inlined versions of Array.indexOf() and Array.lastIndexOf() with a regression test. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 var obj = {};
8
9 function f(v) {
10 var v1 = -(4/3);
11 var v2 = 1;
12 var arr = new Array(+0, true, 0, -0, false, undefined, null, "0", obj, v1, -(4 /3), -1.3333333333333, "str", v2, 1, false);
13 assertEquals(10, arr.lastIndexOf(-(4/3)));
14 assertEquals(9, arr.indexOf(-(4/3)));
15
16 assertEquals(10, arr.lastIndexOf(v));
17 assertEquals(9, arr.indexOf(v));
18
19 assertEquals(8, arr.lastIndexOf(obj));
20 assertEquals(8, arr.indexOf(obj));
21 }
22
23 function g(v, x, index) {
24 var arr = new Array({}, x-1.1, x-2, x-3.1);
25 assertEquals(index, arr.indexOf(0));
26 assertEquals(index, arr.lastIndexOf(0));
27
28 assertEquals(index, arr.indexOf(v));
29 assertEquals(index, arr.lastIndexOf(v));
30 }
31
32 f(-(4/3));
33 f(-(4/3));
34 %OptimizeFunctionOnNextCall(f);
35 f(-(4/3));
36
37 g(0, 2, 2);
38 g(0, 3.1, 3);
39 %OptimizeFunctionOnNextCall(g);
40 g(0, 1.1, 1);
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698