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

Side by Side Diff: tests/language/vm/load_elimination_has_loads_from_place_test.dart

Issue 184523002: Allocation sinking for contexts. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: added tests Created 6 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 correctness of side effects tracking used by load to load forwarding.
5
6 // VMOptions=--optimization-counter-threshold=10 --no-use-osr --enable-inlining- annotations
7
8 // Tests correct handling of redefinitions in aliasing computation.
9
10 import "package:expect/expect.dart";
11
12 const alwaysInline = "AlwaysInline";
13 const noInline = "NeverInline";
14
15 var H = true;
16
17 class A {
18 B bb;
19
20 @alwaysInline
21 poly(p) {
22 if (H) {
23 bb = p;
24 }
25 B t = bb;
26 t.bval = 123;
27 return t.bval;
Vyacheslav Egorov (Google) 2014/11/13 13:01:42 I would be also good to test the case when you sto
Florian Schneider 2014/11/13 13:38:53 Done. Added a new test with two polymorphic calls
28 }
29 }
30
31 class B {
32 int bval = -1;
33
34 @alwaysInline
35 poly(p) {
36 return bval;
37 }
38 }
39
40 @alwaysInline
41 foo(obj, p) => obj.poly(p);
42
43 @alwaysInline
44 foo2(obj, p) => obj.poly(p);
45
46 @noInline
47 test() {
48 A a = new A();
49 B b = new B();
50 foo(a, b);
51 return b.bval;
52 }
53
54 main() {
55 // Prime foo with polymorphic type feedback.
56 foo(new B(), new A());
57 foo(new A(), new B());
58 foo2(new B(), new A());
59 foo2(new A(), new B());
60
61 for (var i = 0; i < 100; i++) test();
62 Expect.equals(123, test());
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698