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

Side by Side Diff: test/mjsunit/compiler/shift-shr.js

Issue 2709423002: [compiler] Speculate a little more in SpeculativeShiftRightLogical. (Closed)
Patch Set: Address feedback. Created 3 years, 9 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
« no previous file with comments | « src/compiler/simplified-lowering.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
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --allow-natives-syntax 5 // Flags: --allow-natives-syntax
6 6
7 // Check the results of `left >>> right`. The result is always unsigned (and 7 // Check the results of `left >>> right`. The result is always unsigned (and
8 // therefore positive). 8 // therefore positive).
9 function test_shr(left) { 9 function test_shr(left) {
10 var errors = 0; 10 var errors = 0;
11 11
12 for (var i = 1; i < 1024; i++) { 12 for (var i = 1; i < 1024; i++) {
13 var temp = left >>> i; 13 var temp = left >>> i;
14 if (temp < 0) { 14 if (temp < 0) {
15 errors++; 15 errors++;
16 } 16 }
17 } 17 }
18 18
19 return errors; 19 return errors;
20 } 20 }
21 21
22 assertEquals(0, test_shr(1)); 22 assertEquals(0, test_shr(1));
23 %OptimizeFunctionOnNextCall(test_shr); 23 %OptimizeFunctionOnNextCall(test_shr);
24 for (var i = 5; i >= -5; i--) { 24 for (var i = 5; i >= -5; i--) {
25 assertEquals(0, test_shr(i)); 25 assertEquals(0, test_shr(i));
26 } 26 }
27
28
29 (function () {
30 function foo(x, b, array) {
31 var y;
32 x = x >>> 0;
33 b ? (y = x | 0) : (y = x);
34 return array[y];
35 }
36
37 foo(111, true, new Array(42));
38 foo(111, true, new Array(42));
39 %OptimizeFunctionOnNextCall(foo);
40 foo(-111, true, new Array(42));
41 })();
42
43 (function () {
44 function foo(x, b, array) {
45 var y;
46 x = x >>> 0;
47 b ? (y = x | 0) : (y = x);
48 return array[y];
49 }
50
51 foo(111, true, new Array(42));
52 foo(111, true, new Array(42));
53 %OptimizeFunctionOnNextCall(foo);
54 foo(111, true, new Array(42));
55 })();
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698