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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/loop_invariant_code_motion.dart

Issue 1305863010: dart2js cps: Store the TypeMask for each primitive in a field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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 4
5 library dart2js.cps_ir.loop_invariant_code_motion; 5 library dart2js.cps_ir.loop_invariant_code_motion;
6 6
7 import 'optimizers.dart'; 7 import 'optimizers.dart';
8 import 'cps_ir_nodes.dart'; 8 import 'cps_ir_nodes.dart';
9 import 'loop_hierarchy.dart'; 9 import 'loop_hierarchy.dart';
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (loop1 == null) return loop2; 119 if (loop1 == null) return loop2;
120 if (loop2 == null) return loop1; 120 if (loop2 == null) return loop1;
121 if (loopHierarchy.loopDepth[loop1] > loopHierarchy.loopDepth[loop2]) { 121 if (loopHierarchy.loopDepth[loop1] > loopHierarchy.loopDepth[loop2]) {
122 return loop1; 122 return loop1;
123 } else { 123 } else {
124 return loop2; 124 return loop2;
125 } 125 }
126 } 126 }
127 127
128 bool shouldLift(Primitive prim) { 128 bool shouldLift(Primitive prim) {
129 // Interceptors are safe and almost always profitable for lifting 129 // Interceptors are generally safe and almost always profitable for lifting
130 // out of loops. Several other primitive could be lifted too, but it's not 130 // out of loops. Several other primitive could be lifted too, but it's not
131 // always profitable to do so. 131 // always profitable to do so.
132
133 // Note that the type of the interceptor is technically not sound after
134 // lifting because its current type might have been computed based on a
135 // refinement node (which has since been removed). As a whole, it still
136 // works out because all uses of the interceptor must occur in a context
137 // where it indeed has the type it claims to have.
132 return prim is Interceptor; 138 return prim is Interceptor;
133 } 139 }
134 } 140 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/insert_refinements.dart ('k') | pkg/compiler/lib/src/cps_ir/mutable_ssa.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698