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

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

Issue 14178008: Fix crash reported in http://code.google.com/p/dart/issues/detail?id=9949. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | tests/language/issue9949_test.dart » ('j') | 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 * Invariant: [constructor] and [constructors] must all be implementation 1181 * Invariant: [constructor] and [constructors] must all be implementation
1182 * elements. 1182 * elements.
1183 */ 1183 */
1184 void inlineSuperOrRedirect(FunctionElement constructor, 1184 void inlineSuperOrRedirect(FunctionElement constructor,
1185 Selector selector, 1185 Selector selector,
1186 Link<Node> arguments, 1186 Link<Node> arguments,
1187 List<FunctionElement> constructors, 1187 List<FunctionElement> constructors,
1188 Map<Element, HInstruction> fieldValues, 1188 Map<Element, HInstruction> fieldValues,
1189 FunctionElement inlinedFromElement, 1189 FunctionElement inlinedFromElement,
1190 Node callNode) { 1190 Node callNode) {
1191 constructor = constructor.implementation;
1191 compiler.withCurrentElement(constructor, () { 1192 compiler.withCurrentElement(constructor, () {
1192 assert(invariant(constructor, constructor.isImplementation));
1193 constructors.add(constructor); 1193 constructors.add(constructor);
1194 1194
1195 List<HInstruction> compiledArguments = new List<HInstruction>(); 1195 List<HInstruction> compiledArguments = new List<HInstruction>();
1196 bool succeeded = 1196 bool succeeded =
1197 inlinedFrom(inlinedFromElement, 1197 inlinedFrom(inlinedFromElement,
1198 () => addStaticSendArgumentsToList(selector, 1198 () => addStaticSendArgumentsToList(selector,
1199 arguments, 1199 arguments,
1200 constructor, 1200 constructor,
1201 compiledArguments)); 1201 compiledArguments));
1202 if (!succeeded) { 1202 if (!succeeded) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) { 1305 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) {
1306 assert(link.head is Send); 1306 assert(link.head is Send);
1307 if (link.head is !SendSet) { 1307 if (link.head is !SendSet) {
1308 // A super initializer or constructor redirection. 1308 // A super initializer or constructor redirection.
1309 Send call = link.head; 1309 Send call = link.head;
1310 assert(Initializers.isSuperConstructorCall(call) || 1310 assert(Initializers.isSuperConstructorCall(call) ||
1311 Initializers.isConstructorRedirect(call)); 1311 Initializers.isConstructorRedirect(call));
1312 FunctionElement target = elements[call]; 1312 FunctionElement target = elements[call];
1313 Selector selector = elements.getSelector(call); 1313 Selector selector = elements.getSelector(call);
1314 Link<Node> arguments = call.arguments; 1314 Link<Node> arguments = call.arguments;
1315 inlineSuperOrRedirect(target, selector, arguments, constructors, 1315 inlineSuperOrRedirect(target,
1316 fieldValues, constructor, call); 1316 selector,
1317 arguments,
1318 constructors,
1319 fieldValues,
1320 constructor,
1321 call);
1317 foundSuperOrRedirect = true; 1322 foundSuperOrRedirect = true;
1318 } else { 1323 } else {
1319 // A field initializer. 1324 // A field initializer.
1320 SendSet init = link.head; 1325 SendSet init = link.head;
1321 Link<Node> arguments = init.arguments; 1326 Link<Node> arguments = init.arguments;
1322 assert(!arguments.isEmpty && arguments.tail.isEmpty); 1327 assert(!arguments.isEmpty && arguments.tail.isEmpty);
1323 inlinedFrom(constructor, () { 1328 inlinedFrom(constructor, () {
1324 visit(arguments.head); 1329 visit(arguments.head);
1325 }); 1330 });
1326 fieldValues[elements[init]] = pop(); 1331 fieldValues[elements[init]] = pop();
1327 } 1332 }
1328 } 1333 }
1329 } 1334 }
1330 1335
1331 if (!foundSuperOrRedirect) { 1336 if (!foundSuperOrRedirect) {
1332 // No super initializer found. Try to find the default constructor if 1337 // No super initializer found. Try to find the default constructor if
1333 // the class is not Object. 1338 // the class is not Object.
1334 ClassElement enclosingClass = constructor.getEnclosingClass(); 1339 ClassElement enclosingClass = constructor.getEnclosingClass();
1335 ClassElement superClass = enclosingClass.superclass; 1340 ClassElement superClass = enclosingClass.superclass;
1336 if (!enclosingClass.isObject(compiler)) { 1341 if (!enclosingClass.isObject(compiler)) {
1337 assert(superClass != null); 1342 assert(superClass != null);
1338 assert(superClass.resolutionState == STATE_DONE); 1343 assert(superClass.resolutionState == STATE_DONE);
1339 Selector selector = 1344 Selector selector =
1340 new Selector.callDefaultConstructor(enclosingClass.getLibrary()); 1345 new Selector.callDefaultConstructor(enclosingClass.getLibrary());
1341 // TODO(johnniwinther): Should we find injected constructors as well? 1346 // TODO(johnniwinther): Should we find injected constructors as well?
1342 FunctionElement target = superClass.lookupConstructor(selector); 1347 FunctionElement target = superClass.lookupConstructor(selector);
1343 if (target == null) { 1348 if (target == null) {
1344 compiler.internalError("no default constructor available"); 1349 compiler.internalError("no default constructor available");
1345 } 1350 }
1346 inlineSuperOrRedirect(target.implementation, 1351 inlineSuperOrRedirect(target,
1347 selector, 1352 selector,
1348 const Link<Node>(), 1353 const Link<Node>(),
1349 constructors, 1354 constructors,
1350 fieldValues, 1355 fieldValues,
1351 constructor, 1356 constructor,
1352 functionNode); 1357 functionNode);
1353 } 1358 }
1354 } 1359 }
1355 } 1360 }
1356 1361
(...skipping 3869 matching lines...) Expand 10 before | Expand all | Expand 10 after
5226 new HSubGraphBlockInformation(elseBranch.graph)); 5231 new HSubGraphBlockInformation(elseBranch.graph));
5227 5232
5228 HBasicBlock conditionStartBlock = conditionBranch.block; 5233 HBasicBlock conditionStartBlock = conditionBranch.block;
5229 conditionStartBlock.setBlockFlow(info, joinBlock); 5234 conditionStartBlock.setBlockFlow(info, joinBlock);
5230 SubGraph conditionGraph = conditionBranch.graph; 5235 SubGraph conditionGraph = conditionBranch.graph;
5231 HIf branch = conditionGraph.end.last; 5236 HIf branch = conditionGraph.end.last;
5232 assert(branch is HIf); 5237 assert(branch is HIf);
5233 branch.blockInformation = conditionStartBlock.blockFlow; 5238 branch.blockInformation = conditionStartBlock.blockFlow;
5234 } 5239 }
5235 } 5240 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/issue9949_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698