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

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

Issue 1388473003: dart2js cps_ir: Use interceptors for is-checks. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 cps_ir.optimization.insert_refinements; 5 library cps_ir.optimization.insert_refinements;
6 6
7 import 'optimizers.dart' show Pass; 7 import 'optimizers.dart' show Pass;
8 import 'shrinking_reductions.dart' show ParentVisitor; 8 import 'shrinking_reductions.dart' show ParentVisitor;
9 import 'cps_ir_nodes.dart'; 9 import 'cps_ir_nodes.dart';
10 import '../types/constants.dart'; 10 import '../types/constants.dart';
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 // If the condition is an 'is' check, promote the checked value. 155 // If the condition is an 'is' check, promote the checked value.
156 if (condition is TypeTest) { 156 if (condition is TypeTest) {
157 Primitive value = condition.value.definition; 157 Primitive value = condition.value.definition;
158 TypeMask type = types.subtypesOf(condition.dartType); 158 TypeMask type = types.subtypesOf(condition.dartType);
159 Primitive refinedValue = new Refinement(value, type); 159 Primitive refinedValue = new Refinement(value, type);
160 pushRefinement(trueCont, refinedValue); 160 pushRefinement(trueCont, refinedValue);
161 push(falseCont); 161 push(falseCont);
162 return; 162 return;
163 } 163 }
164 if (condition is TypeTestRaw) {
165 Primitive value = condition.value.definition;
166 TypeMask type = types.subtypesOf(condition.dartType);
167 Primitive refinedValue = new Refinement(value, type);
168 pushRefinement(trueCont, refinedValue);
169 push(falseCont);
170 return;
171 }
164 172
165 // If the condition is comparison with a constant, promote the other value. 173 // If the condition is comparison with a constant, promote the other value.
166 // This can happen either for calls to `==` or `identical` calls, such 174 // This can happen either for calls to `==` or `identical` calls, such
167 // as the ones inserted by the unsugaring pass. 175 // as the ones inserted by the unsugaring pass.
168 176
169 void refineEquality(Primitive first, 177 void refineEquality(Primitive first,
170 Primitive second, 178 Primitive second,
171 Continuation trueCont, 179 Continuation trueCont,
172 Continuation falseCont) { 180 Continuation falseCont) {
173 if (second is Constant && second.value.isNull) { 181 if (second is Constant && second.value.isNull) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 cont.firstRef.parent is Branch)) { 223 cont.firstRef.parent is Branch)) {
216 // Do not push the continuation here. 224 // Do not push the continuation here.
217 // visitInvokeMethod and visitBranch will do that. 225 // visitInvokeMethod and visitBranch will do that.
218 } else { 226 } else {
219 push(cont); 227 push(cont);
220 } 228 }
221 } 229 }
222 return node.body; 230 return node.body;
223 } 231 }
224 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698