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

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

Issue 10982030: Revert "Fix invalid locations problem for inline super constructors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) { 1159 for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) {
1160 assert(link.head is Send); 1160 assert(link.head is Send);
1161 if (link.head is !SendSet) { 1161 if (link.head is !SendSet) {
1162 // A super initializer or constructor redirection. 1162 // A super initializer or constructor redirection.
1163 Send call = link.head; 1163 Send call = link.head;
1164 assert(Initializers.isSuperConstructorCall(call) || 1164 assert(Initializers.isSuperConstructorCall(call) ||
1165 Initializers.isConstructorRedirect(call)); 1165 Initializers.isConstructorRedirect(call));
1166 FunctionElement target = elements[call]; 1166 FunctionElement target = elements[call];
1167 Selector selector = elements.getSelector(call); 1167 Selector selector = elements.getSelector(call);
1168 Link<Node> arguments = call.arguments; 1168 Link<Node> arguments = call.arguments;
1169 sourceElementStack.add(target);
1170 inlineSuperOrRedirect(target, selector, arguments, constructors, 1169 inlineSuperOrRedirect(target, selector, arguments, constructors,
1171 fieldValues); 1170 fieldValues);
1172 sourceElementStack.removeLast();
1173 foundSuperOrRedirect = true; 1171 foundSuperOrRedirect = true;
1174 } else { 1172 } else {
1175 // A field initializer. 1173 // A field initializer.
1176 SendSet init = link.head; 1174 SendSet init = link.head;
1177 Link<Node> arguments = init.arguments; 1175 Link<Node> arguments = init.arguments;
1178 assert(!arguments.isEmpty() && arguments.tail.isEmpty()); 1176 assert(!arguments.isEmpty() && arguments.tail.isEmpty());
1179 sourceElementStack.add(constructor); 1177 sourceElementStack.add(constructor);
1180 visit(arguments.head); 1178 visit(arguments.head);
1181 sourceElementStack.removeLast(); 1179 sourceElementStack.removeLast();
1182 fieldValues[elements[init]] = pop(); 1180 fieldValues[elements[init]] = pop();
1183 } 1181 }
1184 } 1182 }
1185 } 1183 }
1186 1184
1187 if (!foundSuperOrRedirect) { 1185 if (!foundSuperOrRedirect) {
1188 // No super initializer found. Try to find the default constructor if 1186 // No super initializer found. Try to find the default constructor if
1189 // the class is not Object. 1187 // the class is not Object.
1190 ClassElement enclosingClass = constructor.getEnclosingClass(); 1188 ClassElement enclosingClass = constructor.getEnclosingClass();
1191 ClassElement superClass = enclosingClass.superclass; 1189 ClassElement superClass = enclosingClass.superclass;
1192 if (!enclosingClass.isObject(compiler)) { 1190 if (!enclosingClass.isObject(compiler)) {
1193 assert(superClass !== null); 1191 assert(superClass !== null);
1194 assert(superClass.resolutionState == STATE_DONE); 1192 assert(superClass.resolutionState == STATE_DONE);
1195 Selector selector = 1193 Selector selector =
1196 new Selector.call(superClass.name, enclosingClass.getLibrary(), 0); 1194 new Selector.call(superClass.name, enclosingClass.getLibrary(), 0);
1197 FunctionElement target = superClass.lookupConstructor(superClass.name); 1195 FunctionElement target = superClass.lookupConstructor(superClass.name);
1198 if (target === null) { 1196 if (target === null) {
1199 compiler.internalError("no default constructor available"); 1197 compiler.internalError("no default constructor available");
1200 } 1198 }
1201 sourceElementStack.add(target.implementation);
1202 inlineSuperOrRedirect(target.implementation, 1199 inlineSuperOrRedirect(target.implementation,
1203 selector, 1200 selector,
1204 const EmptyLink<Node>(), 1201 const EmptyLink<Node>(),
1205 constructors, 1202 constructors,
1206 fieldValues); 1203 fieldValues);
1207 sourceElementStack.removeLast();
1208 } 1204 }
1209 } 1205 }
1210 } 1206 }
1211 1207
1212 /** 1208 /**
1213 * Run through the fields of [cls] and add their potential 1209 * Run through the fields of [cls] and add their potential
1214 * initializers. 1210 * initializers.
1215 * 1211 *
1216 * Invariant: [classElement] must be a declaration element. 1212 * Invariant: [classElement] must be a declaration element.
1217 */ 1213 */
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 isNot = true; 2290 isNot = true;
2295 } 2291 }
2296 2292
2297 DartType type = elements.getType(typeAnnotation); 2293 DartType type = elements.getType(typeAnnotation);
2298 HInstruction typeInfo = null; 2294 HInstruction typeInfo = null;
2299 if (compiler.codegenWorld.rti.hasTypeArguments(type)) { 2295 if (compiler.codegenWorld.rti.hasTypeArguments(type)) {
2300 pushInvokeHelper1(interceptors.getGetRuntimeTypeInfo(), expression); 2296 pushInvokeHelper1(interceptors.getGetRuntimeTypeInfo(), expression);
2301 typeInfo = pop(); 2297 typeInfo = pop();
2302 } 2298 }
2303 if (type.element.isTypeVariable()) { 2299 if (type.element.isTypeVariable()) {
2304 // TODO(karlklose): We currently answer true to any is check 2300 // TODO(karlklose): We currently answer true to any is check
2305 // involving a type variable -- both is T and is !T -- until 2301 // involving a type variable -- both is T and is !T -- until
2306 // we have a proper implementation of reified generics. 2302 // we have a proper implementation of reified generics.
2307 stack.add(graph.addConstantBool(true, constantSystem)); 2303 stack.add(graph.addConstantBool(true, constantSystem));
2308 } else { 2304 } else {
2309 HInstruction instruction; 2305 HInstruction instruction;
2310 if (typeInfo !== null) { 2306 if (typeInfo !== null) {
2311 instruction = new HIs.withTypeInfoCall(type, expression, typeInfo); 2307 instruction = new HIs.withTypeInfoCall(type, expression, typeInfo);
2312 } else { 2308 } else {
2313 instruction = new HIs(type, expression); 2309 instruction = new HIs(type, expression);
2314 } 2310 }
2315 if (isNot) { 2311 if (isNot) {
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
4347 new HSubGraphBlockInformation(elseBranch.graph)); 4343 new HSubGraphBlockInformation(elseBranch.graph));
4348 4344
4349 HBasicBlock conditionStartBlock = conditionBranch.block; 4345 HBasicBlock conditionStartBlock = conditionBranch.block;
4350 conditionStartBlock.setBlockFlow(info, joinBlock); 4346 conditionStartBlock.setBlockFlow(info, joinBlock);
4351 SubGraph conditionGraph = conditionBranch.graph; 4347 SubGraph conditionGraph = conditionBranch.graph;
4352 HIf branch = conditionGraph.end.last; 4348 HIf branch = conditionGraph.end.last;
4353 assert(branch is HIf); 4349 assert(branch is HIf);
4354 branch.blockInformation = conditionStartBlock.blockFlow; 4350 branch.blockInformation = conditionStartBlock.blockFlow;
4355 } 4351 }
4356 } 4352 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698