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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/unsugar.dart

Issue 1385423002: dart2js cps_ir: Use interceptors for is-checks (version 2) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: fix analyzer warnings 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 library dart2js.unsugar_cps; 1 library dart2js.unsugar_cps;
2 2
3 import '../../cps_ir/cps_ir_nodes.dart'; 3 import '../../cps_ir/cps_ir_nodes.dart';
4 4
5 import '../../cps_ir/optimizers.dart' show ParentVisitor, Pass; 5 import '../../cps_ir/optimizers.dart' show ParentVisitor, Pass;
6 import '../../constants/values.dart'; 6 import '../../constants/values.dart';
7 import '../../elements/elements.dart'; 7 import '../../elements/elements.dart';
8 import '../../io/source_information.dart'; 8 import '../../io/source_information.dart';
9 import '../../js_backend/codegen/glue.dart'; 9 import '../../js_backend/codegen/glue.dart';
10 import '../../universe/selector.dart' show Selector; 10 import '../../universe/selector.dart' show Selector;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // Rethrow can only appear in a catch block. It throws that block's 222 // Rethrow can only appear in a catch block. It throws that block's
223 // (wrapped) caught exception. 223 // (wrapped) caught exception.
224 Throw replacement = new Throw(_exceptionParameter); 224 Throw replacement = new Throw(_exceptionParameter);
225 InteriorNode parent = node.parent; 225 InteriorNode parent = node.parent;
226 parent.body = replacement; 226 parent.body = replacement;
227 replacement.parent = parent; 227 replacement.parent = parent;
228 // The original rethrow does not have any references that we need to 228 // The original rethrow does not have any references that we need to
229 // worry about unlinking. 229 // worry about unlinking.
230 } 230 }
231 231
232 // TODO(24523): Insert interceptor on demand when we discover we want to use
233 // one rather than on every check.
234 processTypeTest(TypeTest node) {
235 assert(node.interceptor == null);
236 Primitive receiver = node.value.definition;
237 Primitive interceptor = new Interceptor(receiver, node.sourceInformation)
238 ..interceptedClasses.addAll(_glue.interceptedClasses);
239 insertLetPrim(interceptor, node.parent);
240 node.interceptor = new Reference<Primitive>(interceptor);
241 node.interceptor.parent = node;
242 }
243
232 processInvokeMethod(InvokeMethod node) { 244 processInvokeMethod(InvokeMethod node) {
233 Selector selector = node.selector; 245 Selector selector = node.selector;
234 if (!_glue.isInterceptedSelector(selector)) return; 246 if (!_glue.isInterceptedSelector(selector)) return;
235 247
236 Primitive receiver = node.receiver.definition; 248 Primitive receiver = node.receiver.definition;
237 Primitive newReceiver; 249 Primitive newReceiver;
238 250
239 if (receiver == explicitReceiverParameter) { 251 if (receiver == explicitReceiverParameter) {
240 // If the receiver is the explicit receiver, we are calling a method in 252 // If the receiver is the explicit receiver, we are calling a method in
241 // the same interceptor: 253 // the same interceptor:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 insertLetPrim(newReceiver, contBinding); 289 insertLetPrim(newReceiver, contBinding);
278 } 290 }
279 node.arguments.insert(0, node.receiver); 291 node.arguments.insert(0, node.receiver);
280 node.receiver = new Reference<Primitive>(newReceiver); 292 node.receiver = new Reference<Primitive>(newReceiver);
281 } 293 }
282 294
283 processInterceptor(Interceptor node) { 295 processInterceptor(Interceptor node) {
284 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); 296 _glue.registerSpecializedGetInterceptor(node.interceptedClasses);
285 } 297 }
286 } 298 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/glue.dart ('k') | pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698