| 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 // Test lazy deoptimization from within an inlined function. | |
| 5 // VMOptions=--deoptimize_alot | |
| 6 | |
| 7 call_native(x) { | |
| 8 // Wrap in try to avoid inlining. | |
| 9 // Use a large int so the intrinsifier does not fire. | |
| 10 try { return x + 12342353257893275483274832; } finally { } | |
| 11 } | |
| 12 | |
| 13 bar(x) { | |
| 14 if (x < 0) call_native(x); | |
| 15 x = 42; | |
| 16 return x; | |
| 17 } | |
| 18 | |
| 19 foo(x) { | |
| 20 x = bar(x); | |
| 21 return x; | |
| 22 } | |
| 23 | |
| 24 main() { | |
| 25 Expect.equals(42, foo(1)); | |
| 26 for (var i = 0; i < 2000; i++) foo(7); | |
| 27 Expect.equals(42, foo(2)); | |
| 28 // Call the runtime to trigger lazy deopt with foo/bar on the stack. | |
| 29 Expect.equals(42, foo(-1)); | |
| 30 } | |
| OLD | NEW |