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

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

Issue 11412105: - Move length getter and setter interceptors to the new interceptor scheme. (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 15149)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -2454,13 +2454,6 @@
// interceptor.
instruction.inputs.add(receiver);
pushWithPosition(instruction, send);
- } else if (elements[send] == null && interceptor != null) {
- // Use the old, deprecated interceptor mechanism.
- HStatic target = new HStatic(interceptor);
- add(target);
- List<HInstruction> inputs = <HInstruction>[target, receiver];
- pushWithPosition(new HInvokeInterceptor(selector, inputs, !hasGetter),
- send);
} else {
pushWithPosition(
new HInvokeDynamicGetter(selector, null, receiver, !hasGetter), send);
@@ -2516,13 +2509,25 @@
Element interceptor = getInterceptor(send, selector);
bool hasSetter = compiler.world.hasAnyUserDefinedSetter(selector);
if (interceptor != null && interceptor == backend.getInterceptorMethod) {
- compiler.internalError(
- 'Unimplemented intercepted setter call with interceptor classes');
- } else if (interceptor != null && elements[send] == null) {
- HStatic target = new HStatic(interceptor);
- add(target);
- List<HInstruction> inputs = <HInstruction>[target, receiver, value];
- addWithPosition(new HInvokeInterceptor(selector, inputs), send);
+ // If we're using an interceptor class, emit a call to the
+ // interceptor method and then the actual dynamic call on the
+ // interceptor object.
+ HInstruction instruction;
+ if (backend.isInterceptorClass(currentElement.getEnclosingClass())
+ && send.receiver == null) {
+ instruction = thisInstruction;
+ } else {
+ HStatic target = new HStatic(interceptor);
+ add(target);
+ instruction = new HInvokeStatic(<HInstruction>[target, receiver]);
+ add(instruction);
+ }
+ instruction = new HInvokeDynamicSetter(
+ selector, null, instruction, receiver, !hasSetter);
+ // Add the value as an argument to the setter call on the
+ // interceptor.
+ instruction.inputs.add(value);
+ addWithPosition(instruction, send);
} else {
addWithPosition(
new HInvokeDynamicSetter(selector, null, receiver, value, !hasSetter),
@@ -2808,15 +2813,6 @@
HInstruction instruction = new HInvokeDynamicMethod(selector, inputs);
pushWithPosition(instruction, node);
return;
- } else if (elements[node] == null) {
- HStatic target = new HStatic(interceptor);
- add(target);
- inputs.add(target);
- visit(node.receiver);
- inputs.add(pop());
- addGenericSendArgumentsToList(node.arguments, inputs);
- pushWithPosition(new HInvokeInterceptor(selector, inputs), node);
- return;
}
}

Powered by Google App Engine
This is Rietveld 408576698