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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 11348316: Move the handling of operator[] into the new interceptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 15541)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -2620,13 +2620,20 @@
Operator op = node.selector;
if (const SourceString("[]") == op.source) {
- HStatic target = new HStatic(interceptors.getIndexInterceptor());
- add(target);
visit(node.receiver);
HInstruction receiver = pop();
visit(node.argumentsNode);
HInstruction index = pop();
- push(new HIndex(target, receiver, index));
+ Selector selector = elements.getSelector(node);
kasperl 2012/11/30 09:23:04 How about refactoring this? Maybe add a helper tha
ngeoffray 2012/11/30 13:18:14 Done.
+ Set<ClassElement> interceptedClasses =
+ getInterceptedClassesOn(node, selector);
+ List<HInstruction> inputs = <HInstruction>[];
+ if (interceptedClasses != null) {
+ inputs.add(invokeInterceptor(interceptedClasses, receiver, node));
+ }
+ inputs.add(receiver);
+ inputs.add(index);
+ push(new HInvokeDynamicMethod(selector, inputs));
} else if (const SourceString("&&") == op.source ||
const SourceString("||") == op.source) {
visitLogicalAndOr(node, op);
@@ -3513,9 +3520,16 @@
index = pop();
value = graph.addConstantInt(1, constantSystem);
}
- HStatic indexMethod = new HStatic(interceptors.getIndexInterceptor());
- add(indexMethod);
- HInstruction left = new HIndex(indexMethod, receiver, index);
+ Selector selector = new Selector.index();
+ Set<ClassElement> interceptedClasses =
+ getInterceptedClassesOn(node, selector);
+ List<HInstruction> inputs = <HInstruction>[];
+ if (interceptedClasses != null) {
+ inputs.add(invokeInterceptor(interceptedClasses, receiver, node));
+ }
+ inputs.add(receiver);
+ inputs.add(index);
+ HInstruction left = new HInvokeDynamicMethod( selector, inputs);
kasperl 2012/11/30 09:23:04 Remove space before selector.
ngeoffray 2012/11/30 13:18:14 Done.
add(left);
Element opElement = elements[op];
visitBinary(left, op, value);

Powered by Google App Engine
This is Rietveld 408576698