Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 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 f() { |
| 8 | var arguments_ = arguments; |
| 9 | if (undefined) { |
| 10 | while (true) { |
| 11 | arguments_[0]; |
| 12 | } |
| 13 | } else { |
| 14 | %DeoptimizeNow(); |
| 15 | return arguments_[0]; |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | f(0); |
| 20 | f(0); |
| 21 | %OptimizeFunctionOnNextCall(f); |
| 22 | assertEquals(1, f(1)); |
| 23 | |
| 24 | function g() { |
| 25 | var a = arguments; |
| 26 | %DeoptimizeNow(); |
| 27 | return a.length; |
| 28 | } |
| 29 | |
| 30 | g(1); |
| 31 | g(1); |
| 32 | %OptimizeFunctionOnNextCall(g); |
| 33 | assertEquals(1, g(1)); |