OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 --turbo-type-feedback | 5 // Flags: --allow-natives-syntax --turbo-type-feedback |
6 | 6 |
7 (function AddSubtractSmis() { | 7 (function AddSubtractSmis() { |
8 function f0(a, b, c) { | 8 function f0(a, b, c) { |
9 return a + b - c; | 9 return a + b - c; |
10 } | 10 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 (function ShiftLeftNumbers() { | 71 (function ShiftLeftNumbers() { |
72 function f5(a, b) { | 72 function f5(a, b) { |
73 return a << b; | 73 return a << b; |
74 } | 74 } |
75 | 75 |
76 assertEquals(24, f5(3.3, 3.4)); | 76 assertEquals(24, f5(3.3, 3.4)); |
77 assertEquals(40, f5(5.1, 3.9)); | 77 assertEquals(40, f5(5.1, 3.9)); |
78 %OptimizeFunctionOnNextCall(f5); | 78 %OptimizeFunctionOnNextCall(f5); |
79 assertEquals(64, f5(4.9, 4.1)); | 79 assertEquals(64, f5(4.9, 4.1)); |
80 })(); | 80 })(); |
| 81 |
| 82 (function ShiftRightNumbers() { |
| 83 function f6(a, b) { |
| 84 return a >> b; |
| 85 } |
| 86 |
| 87 assertEquals(1, f6(8.3, 3.4)); |
| 88 assertEquals(-2, f6(-16.1, 3.9)); |
| 89 %OptimizeFunctionOnNextCall(f6); |
| 90 assertEquals(0, f6(16.2, 5.1)); |
| 91 })(); |
| 92 |
| 93 (function ShiftRightLogicalNumbers() { |
| 94 function f7(a, b) { |
| 95 return a >>> b; |
| 96 } |
| 97 |
| 98 assertEquals(1, f7(8.3, 3.4)); |
| 99 assertEquals(536870910, f7(-16.1, 3.9)); |
| 100 %OptimizeFunctionOnNextCall(f7); |
| 101 assertEquals(0, f7(16.2, 5.1)); |
| 102 })(); |
OLD | NEW |