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

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

Issue 1761903002: dart2js cps: Keep interceptors in a separate field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 4 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library dart2js.cps_ir.path_based_optimizer; 4 library dart2js.cps_ir.path_based_optimizer;
5 5
6 import 'cps_ir_nodes.dart'; 6 import 'cps_ir_nodes.dart';
7 import 'optimizers.dart'; 7 import 'optimizers.dart';
8 import 'cps_fragment.dart'; 8 import 'cps_fragment.dart';
9 import '../js_backend/js_backend.dart'; 9 import '../js_backend/js_backend.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } else if (values & negativeValues == 0) { 150 } else if (values & negativeValues == 0) {
151 destroyAndReplace(node, new InvokeContinuation(trueCont, [])); 151 destroyAndReplace(node, new InvokeContinuation(trueCont, []));
152 valuesAt[trueCont] = valueOf; 152 valuesAt[trueCont] = valueOf;
153 } else { 153 } else {
154 valuesAt[trueCont] = copy(valueOf)..[condition] = values & positiveValues; 154 valuesAt[trueCont] = copy(valueOf)..[condition] = values & positiveValues;
155 valuesAt[falseCont] = valueOf..[condition] = values & negativeValues; 155 valuesAt[falseCont] = valueOf..[condition] = values & negativeValues;
156 } 156 }
157 } 157 }
158 158
159 void visitInvokeMethod(InvokeMethod node) { 159 void visitInvokeMethod(InvokeMethod node) {
160 int receiverValue = valueOf[node.dartReceiver] ?? ANY; 160 int receiverValue = valueOf[node.receiver] ?? ANY;
161 if (!backend.isInterceptedSelector(node.selector)) { 161 if (!backend.isInterceptedSelector(node.selector)) {
162 // Only self-interceptors can respond to a non-intercepted selector. 162 // Only self-interceptors can respond to a non-intercepted selector.
163 valueOf[node.dartReceiver] = receiverValue & SELF_INTERCEPTOR; 163 valueOf[node.receiver] = receiverValue & SELF_INTERCEPTOR;
164 } else if (receiverValue & ~SELF_INTERCEPTOR == 0 && 164 } else if (receiverValue & ~SELF_INTERCEPTOR == 0 &&
165 node.callingConvention == CallingConvention.Intercepted) { 165 node.callingConvention == CallingConvention.Intercepted) {
166 // This is an intercepted call whose receiver is definitely a 166 // This is an intercepted call whose receiver is definitely a
167 // self-interceptor. 167 // self-interceptor.
168 // TODO(25646): If TypeMasks could represent "any self-interceptor" this 168 // TODO(25646): If TypeMasks could represent "any self-interceptor" this
169 // optimization should be subsumed by type propagation. 169 // optimization should be subsumed by type propagation.
170 node.receiverRef.changeTo(node.dartReceiver); 170 node.interceptorRef.changeTo(node.receiver);
171 171
172 // Replace the extra receiver argument with a dummy value if the 172 // Replace the extra receiver argument with a dummy value if the
173 // target definitely does not use it. 173 // target definitely does not use it.
174 if (typeSystem.targetIgnoresReceiverArgument(node.dartReceiver.type, 174 if (typeSystem.targetIgnoresReceiverArgument(node.receiver.type,
175 node.selector)) { 175 node.selector)) {
176 Constant dummy = new Constant(new IntConstantValue(0)) 176 node.makeDummyIntercepted();
177 ..type = typeSystem.intType;
178 new LetPrim(dummy).insertAbove(node.parent);
179 node.argumentRefs[0].changeTo(dummy);
180 node.callingConvention = CallingConvention.DummyIntercepted;
181 } 177 }
182 } 178 }
183 } 179 }
184 } 180 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/optimize_interceptors.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698