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

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

Issue 1491373005: VM: Fix bug in type propagation at conditionals. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 // VMOptions=--optimization-counter-threshold=1000 --max-polymorphic-checks=1
5
6 // Test correct loop invariant code motion and type propagation from is-checks
7 // and null-comparisons.
8
9 class B {
10 var b;
11 B(this.b);
12 }
13
14 class C {
15 final f0;
16
17 final a;
18 C() : a = new B(0);
19 }
20
21 foo(x) {
22 for (var i = 0; i < 10; i++) {
23 i + i;
24 i + i;
25 if (x is C) {
26 x.a.b < 0;
27 }
28 }
29 }
30
31 class Y { var f = null; }
32
33 bar(y) {
34 var x = y.f;
35 for (var i = 0; i < 10; i++) {
36 if (x != null) {
37 x.a.b < 0;
38 }
39 }
40 }
41
42
43 main () {
44 var o = new Y();
45 o.f = new C();
46 bar(o);
47 o.f = null;
48 bar(o);
49
50 for (var i = 0; i < 1000; i++) bar(o);
51
52 foo(new C());
53 foo(0);
54
55 for (var i = 0; i < 1000; i++) foo(0);
56 }
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698