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

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

Issue 1396663002: Revert "Use interceptors for is-checks (version 2)." (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 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
244 processInvokeMethod(InvokeMethod node) { 232 processInvokeMethod(InvokeMethod node) {
245 Selector selector = node.selector; 233 Selector selector = node.selector;
246 if (!_glue.isInterceptedSelector(selector)) return; 234 if (!_glue.isInterceptedSelector(selector)) return;
247 235
248 Primitive receiver = node.receiver.definition; 236 Primitive receiver = node.receiver.definition;
249 Primitive newReceiver; 237 Primitive newReceiver;
250 238
251 if (receiver == explicitReceiverParameter) { 239 if (receiver == explicitReceiverParameter) {
252 // If the receiver is the explicit receiver, we are calling a method in 240 // If the receiver is the explicit receiver, we are calling a method in
253 // the same interceptor: 241 // the same interceptor:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 insertLetPrim(newReceiver, contBinding); 277 insertLetPrim(newReceiver, contBinding);
290 } 278 }
291 node.arguments.insert(0, node.receiver); 279 node.arguments.insert(0, node.receiver);
292 node.receiver = new Reference<Primitive>(newReceiver); 280 node.receiver = new Reference<Primitive>(newReceiver);
293 } 281 }
294 282
295 processInterceptor(Interceptor node) { 283 processInterceptor(Interceptor node) {
296 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); 284 _glue.registerSpecializedGetInterceptor(node.interceptedClasses);
297 } 285 }
298 } 286 }
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