OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 // This is used to force binary operations below to have tagged representation. |
| 8 var z = {valueOf: function() { return 3; }}; |
| 9 |
| 10 |
| 11 function f() { |
| 12 var y = -2; |
| 13 return (1 & z) - y++; |
| 14 } |
| 15 |
| 16 assertEquals(3, f()); |
| 17 assertEquals(3, f()); |
| 18 %OptimizeFunctionOnNextCall(f); |
| 19 assertEquals(3, f()); |
| 20 |
| 21 |
| 22 function g() { |
| 23 var y = 2; |
| 24 return (1 & z) | y++; |
| 25 } |
| 26 |
| 27 assertEquals(3, g()); |
| 28 assertEquals(3, g()); |
| 29 %OptimizeFunctionOnNextCall(g); |
| 30 assertEquals(3, g()); |
| 31 |
| 32 |
| 33 function h() { |
| 34 var y = 3; |
| 35 return (3 & z) & y++; |
| 36 } |
| 37 |
| 38 assertEquals(3, h()); |
| 39 assertEquals(3, h()); |
| 40 %OptimizeFunctionOnNextCall(h); |
| 41 assertEquals(3, h()); |
| 42 |
| 43 |
| 44 function i() { |
| 45 var y = 2; |
| 46 return (1 & z) ^ y++; |
| 47 } |
| 48 |
| 49 assertEquals(3, i()); |
| 50 assertEquals(3, i()); |
| 51 %OptimizeFunctionOnNextCall(i); |
| 52 assertEquals(3, i()); |
OLD | NEW |