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

Side by Side Diff: tests/compiler/dart2js_extra/17645_test.dart

Issue 206553002: Prevent hoisting of certain check nodes, including [HTypeKnown]. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: take selector of type conversion into account in GVN Created 6 years, 9 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 | « sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart ('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) 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
5 import "package:expect/expect.dart";
6
7 // Regression test for issue 17645.
8 get never => new DateTime.now().millisecondsSinceEpoch == 0;
9
10 class A {
11 var foo;
12 A(this.foo);
13 }
14
15 var log = [];
16
17 test1(a, xs) { // Called with a = [null|exact=A]
18 log.clear();
19 for (var x in xs) {
20 if (a != null) {
21 log.add('${a.foo}.$x'); // a.foo must not be hoisted
22 }
23 }
24 return '$log';
25 }
26
27 test2(a, xs) { // Called with a = [exact=A]
28 log.clear();
29 for (var x in xs) {
30 if (a != null) {
31 log.add('${a.foo}.$x'); // a.foo may be hoisted
32 }
33 }
34 return '$log';
35 }
36
37 test3(a, xs) { // Called with a = [null|exact=A]
38 log.clear();
39 for (var x in xs) {
40 if (a is A) {
41 log.add('${a.foo}.$x'); // a.foo must not be hoisted
42 }
43 }
44 return '$log';
45 }
46
47 test4(a, xs) { // Called with a = [exact=A]
48 log.clear();
49 for (var x in xs) {
50 if (a is A) {
51 log.add('${a.foo}.$x'); // a.foo may be hoisted
52 }
53 }
54 return '$log';
55 }
56
57
58 main() {
59 var a1 = new A('a1');
60 var a2 = new A('a2');
61
62 Expect.equals('[a1.11]', test1(a1, [11]));
63 Expect.equals('[]', test1(null, [11]));
64
65 Expect.equals('[a1.22]', test2(a1, [22]));
66 Expect.equals('[a2.22]', test2(a2, [22]));
67
68
69 Expect.equals('[a1.33]', test3(a1, [33]));
70 Expect.equals('[]', test3(null, [2]));
71
72 Expect.equals('[a1.44]', test4(a1, [44]));
73 Expect.equals('[a2.44]', test4(a2, [44]));
74 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698