| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 constants() { |
| 6 Expect.equals(0, 499 >> 33); |
| 7 Expect.equals(0, (499 << 33) & 0xFFFFFFFF); |
| 8 } |
| 9 |
| 10 foo(i) { |
| 11 if (i != 0) { |
| 12 y--; |
| 13 foo(i - 1); |
| 14 y++; |
| 15 } |
| 16 } |
| 17 |
| 18 var y; |
| 19 |
| 20 // id returns [x] in a way that should be difficult to predict statically. |
| 21 id(x) { |
| 22 y = x; |
| 23 foo(10); |
| 24 return y; |
| 25 } |
| 26 |
| 27 interceptors() { |
| 28 Expect.equals(0, id(499) >> 33); |
| 29 Expect.equals(0, (id(499) << 33) & 0xFFFFFFFF); |
| 30 } |
| 31 |
| 32 speculative() { |
| 33 var a = id(499); |
| 34 for (int i = 0; i < 1; i++) { |
| 35 Expect.equals(0, a >> 33); |
| 36 Expect.equals(0, (a << 33) & 0xFFFFFFFF); |
| 37 } |
| 38 } |
| 39 |
| 40 // JavaScript shifts by the amount modulo 32. That is x << y is equivalent to |
| 41 // x << (y & 0x1F). Dart does not. |
| 42 main() { |
| 43 constants(); |
| 44 interceptors(); |
| 45 speculative(); |
| 46 } |
| OLD | NEW |