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

Side by Side Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10969067: Attach positions to methods with interceptors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 4
5 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 SourceString getterName = selector.name; 2096 SourceString getterName = selector.name;
2097 Element staticInterceptor = null; 2097 Element staticInterceptor = null;
2098 if (methodInterceptionEnabled) { 2098 if (methodInterceptionEnabled) {
2099 staticInterceptor = interceptors.getStaticGetInterceptor(getterName); 2099 staticInterceptor = interceptors.getStaticGetInterceptor(getterName);
2100 } 2100 }
2101 bool hasGetter = compiler.world.hasAnyUserDefinedGetter(selector); 2101 bool hasGetter = compiler.world.hasAnyUserDefinedGetter(selector);
2102 if (staticInterceptor != null) { 2102 if (staticInterceptor != null) {
2103 HStatic target = new HStatic(staticInterceptor); 2103 HStatic target = new HStatic(staticInterceptor);
2104 add(target); 2104 add(target);
2105 List<HInstruction> inputs = <HInstruction>[target, receiver]; 2105 List<HInstruction> inputs = <HInstruction>[target, receiver];
2106 push(new HInvokeInterceptor(selector, inputs, !hasGetter)); 2106 pushWithPosition(new HInvokeInterceptor(selector, inputs, !hasGetter),
2107 send);
2107 } else { 2108 } else {
2108 push(new HInvokeDynamicGetter(selector, null, receiver, !hasGetter)); 2109 pushWithPosition(
2110 new HInvokeDynamicGetter(selector, null, receiver, !hasGetter), send);
2109 } 2111 }
2110 } 2112 }
2111 2113
2112 void generateGetter(Send send, Element element) { 2114 void generateGetter(Send send, Element element) {
2113 if (Elements.isStaticOrTopLevelField(element)) { 2115 if (Elements.isStaticOrTopLevelField(element)) {
2114 Constant value; 2116 Constant value;
2115 if (element.isField() && !element.isAssignable()) { 2117 if (element.isField() && !element.isAssignable()) {
2116 // A static final or const. Get its constant value and inline it if 2118 // A static final or const. Get its constant value and inline it if
2117 // the value can be compiled eagerly. 2119 // the value can be compiled eagerly.
2118 value = compiler.compileVariable(element); 2120 value = compiler.compileVariable(element);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 interceptor = interceptors.getStaticInterceptor(dartMethodName, 2421 interceptor = interceptors.getStaticInterceptor(dartMethodName,
2420 node.argumentCount()); 2422 node.argumentCount());
2421 } 2423 }
2422 if (interceptor != null) { 2424 if (interceptor != null) {
2423 HStatic target = new HStatic(interceptor); 2425 HStatic target = new HStatic(interceptor);
2424 add(target); 2426 add(target);
2425 inputs.add(target); 2427 inputs.add(target);
2426 visit(node.receiver); 2428 visit(node.receiver);
2427 inputs.add(pop()); 2429 inputs.add(pop());
2428 addGenericSendArgumentsToList(node.arguments, inputs); 2430 addGenericSendArgumentsToList(node.arguments, inputs);
2429 push(new HInvokeInterceptor(selector, inputs)); 2431 pushWithPosition(new HInvokeInterceptor(selector, inputs), node);
2430 return; 2432 return;
2431 } 2433 }
2432 2434
2433 if (node.receiver === null) { 2435 if (node.receiver === null) {
2434 inputs.add(localsHandler.readThis()); 2436 inputs.add(localsHandler.readThis());
2435 } else { 2437 } else {
2436 visit(node.receiver); 2438 visit(node.receiver);
2437 inputs.add(pop()); 2439 inputs.add(pop());
2438 } 2440 }
2439 2441
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 new HSubGraphBlockInformation(elseBranch.graph)); 4330 new HSubGraphBlockInformation(elseBranch.graph));
4329 4331
4330 HBasicBlock conditionStartBlock = conditionBranch.block; 4332 HBasicBlock conditionStartBlock = conditionBranch.block;
4331 conditionStartBlock.setBlockFlow(info, joinBlock); 4333 conditionStartBlock.setBlockFlow(info, joinBlock);
4332 SubGraph conditionGraph = conditionBranch.graph; 4334 SubGraph conditionGraph = conditionBranch.graph;
4333 HIf branch = conditionGraph.end.last; 4335 HIf branch = conditionGraph.end.last;
4334 assert(branch is HIf); 4336 assert(branch is HIf);
4335 branch.blockInformation = conditionStartBlock.blockFlow; 4337 branch.blockInformation = conditionStartBlock.blockFlow;
4336 } 4338 }
4337 } 4339 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/source_mapping_test.dart » ('j') | tests/compiler/dart2js/source_mapping_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698