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

Side by Side Diff: test/mjsunit/compiler/integral32-add-sub.js

Issue 2253293005: [turbofan] Unify Int32Add/Sub representation selection rules. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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 (function() {
8 function foo(x) {
9 x = x >>> 0;
10 var y = 0 - 2147483648;
11 return x + y;
12 }
13
14 assertEquals(-2147483648, foo(0));
15 assertEquals(0, foo(2147483648));
16 assertEquals(2147483647, foo(4294967295));
17 %OptimizeFunctionOnNextCall(foo);
18 assertEquals(-2147483648, foo(0));
19 assertEquals(0, foo(2147483648));
20 assertEquals(2147483647, foo(4294967295));
21 assertOptimized(foo);
22 })();
23
24 (function() {
25 function foo(x) {
26 x = x >>> 0;
27 var y = 2147483648;
28 return x - y;
29 }
30
31 assertEquals(-2147483648, foo(0));
32 assertEquals(0, foo(2147483648));
33 assertEquals(2147483647, foo(4294967295));
34 %OptimizeFunctionOnNextCall(foo);
35 assertEquals(-2147483648, foo(0));
36 assertEquals(0, foo(2147483648));
37 assertEquals(2147483647, foo(4294967295));
38 assertOptimized(foo);
39 })();
40
41 (function() {
42 function foo(x) {
43 x = x | 0;
44 var y = 2147483648;
45 return x + y;
46 }
47
48 assertEquals(2147483648, foo(0));
49 assertEquals(0, foo(-2147483648));
50 assertEquals(4294967295, foo(2147483647));
51 %OptimizeFunctionOnNextCall(foo);
52 assertEquals(2147483648, foo(0));
53 assertEquals(0, foo(-2147483648));
54 assertEquals(4294967295, foo(2147483647));
55 assertOptimized(foo);
56 })();
57
58 (function() {
59 function foo(x) {
60 x = x | 0;
61 var y = 0 - 2147483648;
62 return x - y;
63 }
64
65 assertEquals(2147483648, foo(0));
66 assertEquals(0, foo(-2147483648));
67 assertEquals(4294967295, foo(2147483647));
68 %OptimizeFunctionOnNextCall(foo);
69 assertEquals(2147483648, foo(0));
70 assertEquals(0, foo(-2147483648));
71 assertEquals(4294967295, foo(2147483647));
72 assertOptimized(foo);
73 })();
74
75 (function() {
76 function foo(x) {
77 x = x | 0;
78 var y = -0;
79 return x + y;
80 }
81
82 assertEquals(2147483647, foo(2147483647));
83 assertEquals(-2147483648, foo(-2147483648));
84 assertEquals(0, foo(0));
85 %OptimizeFunctionOnNextCall(foo);
86 assertEquals(2147483647, foo(2147483647));
87 assertEquals(-2147483648, foo(-2147483648));
88 assertEquals(0, foo(0));
89 assertOptimized(foo);
90 })();
OLDNEW
« src/compiler/simplified-lowering.cc ('K') | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698