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

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

Issue 1519513002: dart2js cps: Retain refinement nodes and update refinements after GVN. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge 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 | « pkg/compiler/lib/src/cps_ir/gvn.dart ('k') | pkg/compiler/lib/src/cps_ir/optimizers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.optimize_interceptors; 5 library dart2js.cps_ir.optimize_interceptors;
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 import 'cps_fragment.dart'; 10 import 'cps_fragment.dart';
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 interceptor..replaceUsesWith(constantPrim)..destroy(); 116 interceptor..replaceUsesWith(constantPrim)..destroy();
117 let.remove(); 117 let.remove();
118 } else if (interceptor.isAlwaysNullOrIntercepted) { 118 } else if (interceptor.isAlwaysNullOrIntercepted) {
119 Primitive input = interceptor.input.definition; 119 Primitive input = interceptor.input.definition;
120 Primitive constantPrim = makeConstantFor(constant, 120 Primitive constantPrim = makeConstantFor(constant,
121 useSite: let, 121 useSite: let,
122 type: interceptor.type.nonNullable(), 122 type: interceptor.type.nonNullable(),
123 sourceInformation: interceptor.sourceInformation); 123 sourceInformation: interceptor.sourceInformation);
124 CpsFragment cps = new CpsFragment(interceptor.sourceInformation); 124 CpsFragment cps = new CpsFragment(interceptor.sourceInformation);
125 Parameter param = new Parameter(interceptor.hint); 125 Parameter param = new Parameter(interceptor.hint);
126 param.type = interceptor.type;
126 Continuation cont = cps.letCont(<Parameter>[param]); 127 Continuation cont = cps.letCont(<Parameter>[param]);
127 if (interceptor.interceptedClasses.every(hasNoFalsyValues)) { 128 if (interceptor.interceptedClasses.every(hasNoFalsyValues)) {
128 // If null is the only falsy value, compile as "x && CONST". 129 // If null is the only falsy value, compile as "x && CONST".
129 cps.ifFalsy(input).invokeContinuation(cont, [input]); 130 cps.ifFalsy(input).invokeContinuation(cont, [input]);
130 } else { 131 } else {
131 // If there are other falsy values compile as "x == null ? x : CONST". 132 // If there are other falsy values compile as "x == null ? x : CONST".
132 Primitive condition = cps.applyBuiltin( 133 Primitive condition = cps.applyBuiltin(
133 BuiltinOperator.LooseEq, 134 BuiltinOperator.LooseEq,
134 [input, cps.makeNull()]); 135 [input, cps.makeNull()]);
135 cps.ifTruthy(condition).invokeContinuation(cont, [input]); 136 cps.ifTruthy(condition).invokeContinuation(cont, [input]);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 sharedConstantFor.remove(prim.value); 179 sharedConstantFor.remove(prim.value);
179 }); 180 });
180 } 181 }
181 return next; 182 return next;
182 } 183 }
183 184
184 bool shouldShareConstant(Constant constant) { 185 bool shouldShareConstant(Constant constant) {
185 return constant.value.isInterceptor; 186 return constant.value.isInterceptor;
186 } 187 }
187 } 188 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/gvn.dart ('k') | pkg/compiler/lib/src/cps_ir/optimizers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698