Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 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 | function foo(a, b) { |
| 8 | var passed = a == 3; |
| 9 | if (passed) { |
| 10 | if (passed) { |
| 11 | passed = b == 4; |
| 12 | } |
| 13 | } |
| 14 | %DeoptimizeFunction(foo); |
| 15 | return passed; |
| 16 | } |
| 17 | |
| 18 | assertTrue(foo(3, 4)); |
| 19 | assertTrue(foo(3, 4)); |
| 20 | assertFalse(foo(3.1, 4)); |
| 21 | assertFalse(foo(3, 4.1)); |
| 22 | |
| 23 | %OptimizeFunctionOnNextCall(foo); |
| 24 | |
| 25 | assertTrue(foo(3, 4)); |
| 26 | assertTrue(foo(3, 4)); |
| 27 | assertFalse(foo(3.1, 4)); |
| 28 | assertFalse(foo(3, 4.1)); |