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

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

Issue 14168003: Implement implicit constructors in mixin applications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix an assert. Created 7 years, 7 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 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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 // Don't forget to update the field, if the parameter is of the 1298 // Don't forget to update the field, if the parameter is of the
1299 // form [:this.x:]. 1299 // form [:this.x:].
1300 if (parameter.kind == ElementKind.FIELD_PARAMETER) { 1300 if (parameter.kind == ElementKind.FIELD_PARAMETER) {
1301 FieldParameterElement fieldParameterElement = parameter; 1301 FieldParameterElement fieldParameterElement = parameter;
1302 fieldValues[fieldParameterElement.fieldElement] = argument; 1302 fieldValues[fieldParameterElement.fieldElement] = argument;
1303 } 1303 }
1304 }); 1304 });
1305 1305
1306 // Build the initializers in the context of the new constructor. 1306 // Build the initializers in the context of the new constructor.
1307 TreeElements oldElements = elements; 1307 TreeElements oldElements = elements;
1308 if (constructor.isForwardingConstructor) {
1309 constructor = constructor.targetConstructor;
1310 }
1308 elements = 1311 elements =
1309 compiler.enqueuer.resolution.getCachedElements(constructor); 1312 compiler.enqueuer.resolution.getCachedElements(constructor);
1310
1311 ClosureClassMap oldClosureData = localsHandler.closureData; 1313 ClosureClassMap oldClosureData = localsHandler.closureData;
1312 Node node = constructor.parseNode(compiler); 1314 Node node = constructor.parseNode(compiler);
1313 ClosureClassMap newClosureData = 1315 ClosureClassMap newClosureData =
1314 compiler.closureToClassMapper.computeClosureToClassMapping( 1316 compiler.closureToClassMapper.computeClosureToClassMapping(
1315 constructor, node, elements); 1317 constructor, node, elements);
1316 // The [:this:] element now refers to the one in the new closure 1318 // The [:this:] element now refers to the one in the new closure
1317 // data, that is the [:this:] of the super constructor. We 1319 // data, that is the [:this:] of the super constructor. We
1318 // update the element to refer to the current [:this:]. 1320 // update the element to refer to the current [:this:].
1319 localsHandler.updateLocal(newClosureData.thisElement, 1321 localsHandler.updateLocal(newClosureData.thisElement,
1320 localsHandler.readThis()); 1322 localsHandler.readThis());
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 Link<Node> arguments, 2878 Link<Node> arguments,
2877 FunctionElement element, 2879 FunctionElement element,
2878 List<HInstruction> list) { 2880 List<HInstruction> list) {
2879 assert(invariant(element, element.isImplementation)); 2881 assert(invariant(element, element.isImplementation));
2880 2882
2881 HInstruction compileArgument(Node argument) { 2883 HInstruction compileArgument(Node argument) {
2882 visit(argument); 2884 visit(argument);
2883 return pop(); 2885 return pop();
2884 } 2886 }
2885 2887
2888 if (element.isForwardingConstructor) {
2889 element = element.targetConstructor;
2890 }
2891
2886 return selector.addArgumentsToList(arguments, 2892 return selector.addArgumentsToList(arguments,
2887 list, 2893 list,
2888 element, 2894 element,
2889 compileArgument, 2895 compileArgument,
2890 handleConstantForOptionalParameter, 2896 handleConstantForOptionalParameter,
2891 compiler); 2897 compiler);
2892 } 2898 }
2893 2899
2894 void addGenericSendArgumentsToList(Link<Node> link, List<HInstruction> list) { 2900 void addGenericSendArgumentsToList(Link<Node> link, List<HInstruction> list) {
2895 for (; !link.isEmpty; link = link.tail) { 2901 for (; !link.isEmpty; link = link.tail) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
3368 } else if (element.isGenerativeConstructor()) { 3374 } else if (element.isGenerativeConstructor()) {
3369 ClassElement cls = element.getEnclosingClass(); 3375 ClassElement cls = element.getEnclosingClass();
3370 return new HType.nonNullExact(cls.thisType, compiler); 3376 return new HType.nonNullExact(cls.thisType, compiler);
3371 } else { 3377 } else {
3372 return new HType.inferredTypeForElement(originalElement, compiler); 3378 return new HType.inferredTypeForElement(originalElement, compiler);
3373 } 3379 }
3374 } 3380 }
3375 3381
3376 Element constructor = elements[node]; 3382 Element constructor = elements[node];
3377 Selector selector = elements.getSelector(node); 3383 Selector selector = elements.getSelector(node);
3384 if (constructor.isForwardingConstructor) {
3385 compiler.unimplemented('forwarded constructor in named mixin application',
3386 element: constructor.getEnclosingClass());
3387 }
3378 if (compiler.enqueuer.resolution.getCachedElements(constructor) == null) { 3388 if (compiler.enqueuer.resolution.getCachedElements(constructor) == null) {
3379 compiler.internalError("Unresolved element: $constructor", node: node); 3389 compiler.internalError("Unresolved element: $constructor", node: node);
3380 } 3390 }
3381 FunctionElement functionElement = constructor; 3391 FunctionElement functionElement = constructor;
3382 constructor = functionElement.redirectionTarget; 3392 constructor = functionElement.redirectionTarget;
3383 final bool isSymbolConstructor = 3393 final bool isSymbolConstructor =
3384 functionElement == compiler.symbolConstructor; 3394 functionElement == compiler.symbolConstructor;
3385 3395
3386 if (isSymbolConstructor) { 3396 if (isSymbolConstructor) {
3387 constructor = compiler.symbolValidatedConstructor; 3397 constructor = compiler.symbolValidatedConstructor;
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
5269 new HSubGraphBlockInformation(elseBranch.graph)); 5279 new HSubGraphBlockInformation(elseBranch.graph));
5270 5280
5271 HBasicBlock conditionStartBlock = conditionBranch.block; 5281 HBasicBlock conditionStartBlock = conditionBranch.block;
5272 conditionStartBlock.setBlockFlow(info, joinBlock); 5282 conditionStartBlock.setBlockFlow(info, joinBlock);
5273 SubGraph conditionGraph = conditionBranch.graph; 5283 SubGraph conditionGraph = conditionBranch.graph;
5274 HIf branch = conditionGraph.end.last; 5284 HIf branch = conditionGraph.end.last;
5275 assert(branch is HIf); 5285 assert(branch is HIf);
5276 branch.blockInformation = conditionStartBlock.blockFlow; 5286 branch.blockInformation = conditionStartBlock.blockFlow;
5277 } 5287 }
5278 } 5288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698