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

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

Issue 2709093003: Fixup redefinitions before doing code motion (Closed)
Patch Set: Created 3 years, 10 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
« runtime/vm/flow_graph.cc ('K') | « runtime/vm/precompiler.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) 2017, 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 // VMOptions=--enable-inlining-annotations --optimization-counter-threshold=1000 --no-background-compilation
6
7 // Regression test for correct LICM and type propagation.
8
9 const AlwaysInline = "AlwaysInline";
10 const NeverInline = "NeverInline";
11
12 class Attribute {
13 final id = 123;
14 }
15
16 class Name {
17 Name(this.name);
18 final String name;
19 get attr;
20
21 @AlwaysInline
22 int compareTo(other) {
23 int nameCompare = name.compareTo(other.name);
24 if (nameCompare != 0) return nameCompare;
25 if (attr == null) return 0;
26 return attr.id - other.attr.id;
27 }
28 }
29
30 class AName extends Name {
31 AName() : super("abc");
32 final attr = new Attribute();
33 }
34
35 class BName extends Name {
36 BName(name) : super(name);
37 get attr => null;
38 }
39
40
41 class Member {
42 Member(this.name);
43 var name;
44 }
45
46
47 Member find(List<Member> members, Name name) {
48 int low = 0, high = members.length - 1;
49 while (low <= high) {
50 int mid = low + ((high - low) >> 1);
51 Member pivot = members[mid];
52 int comparison = name.compareTo(pivot.name);
53 if (comparison < 0) {
54 high = mid - 1;
55 } else if (comparison > 0) {
56 low = mid + 1;
57 } else {
58 return pivot;
59 }
60 }
61 return null;
62 }
63
64
65 main() {
66 var list = [new Member(new AName()),
67 new Member(new BName("a")),
68 new Member(new BName("b")),
69 new Member(new BName("c")),
70 new Member(new BName("d"))
71 ];
72
73 find(list, new AName());
74 find(list, new BName("e"));
75 find(list, new BName("b"));
76 for (var i = 0; i < 1000; ++i) {
77 find(list, new BName("b"));
78 find(list, new BName("e"));
79 }
80 }
OLDNEW
« runtime/vm/flow_graph.cc ('K') | « runtime/vm/precompiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698