Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: tests/language/deopt_inlined_function_lazy_test.dart

Issue 10967007: Inlining functions with control flow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | tests/language/deopt_inlined_function_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // Test deoptimization caused by running code that did not collect type 4 // Test lazy deoptimization from within an inlined function.
5 // feedback before. 5 // VMOptions=--deoptimize_alot
6 6
7 class A { 7 call_native(x) {
8 deopt_here() => 1; 8 // Wrap in try to avoid inlining.
9 // Use a large int so the intrinsifier does not fire.
10 try { return x + 12342353257893275483274832; } finally { }
9 } 11 }
10 12
11 class B {
12 deopt_here() => 2;
13 }
14
15 var obj = new A();
16
17 bar(x) { 13 bar(x) {
14 if (x < 0) call_native(x);
18 x = 42; 15 x = 42;
19 obj.deopt_here();
20 return x; 16 return x;
21 } 17 }
22 18
23 foo(x) { 19 foo(x) {
24 x = bar(x); 20 x = bar(x);
25 return x; 21 return x;
26 } 22 }
27 23
28 main() { 24 main() {
29 Expect.equals(42, foo(1)); 25 Expect.equals(42, foo(1));
30 for (var i = 0; i < 2000; i++) foo(7); 26 for (var i = 0; i < 2000; i++) foo(7);
31 Expect.equals(42, foo(2)); 27 Expect.equals(42, foo(2));
32 obj = new B(); 28 // Call the runtime to trigger lazy deopt with foo/bar on the stack.
33 Expect.equals(42, foo(3)); 29 Expect.equals(42, foo(-1));
34 } 30 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | tests/language/deopt_inlined_function_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698