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

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

Issue 24125005: Do not evaluate inlined field initializations twice in a redirecting constructor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « no previous file | tests/language/evaluation_redirecting_constructor_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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 // type variables. 1407 // type variables.
1408 assert(typeVariables.isEmpty 1408 assert(typeVariables.isEmpty
1409 || enclosingClass.typeVariables == typeVariables); 1409 || enclosingClass.typeVariables == typeVariables);
1410 while (!typeVariables.isEmpty) { 1410 while (!typeVariables.isEmpty) {
1411 localsHandler.updateLocal(typeVariables.head.element, 1411 localsHandler.updateLocal(typeVariables.head.element,
1412 graph.addConstantNull(compiler)); 1412 graph.addConstantNull(compiler));
1413 typeVariables = typeVariables.tail; 1413 typeVariables = typeVariables.tail;
1414 } 1414 }
1415 } 1415 }
1416 1416
1417 inlinedFrom(callee, () { 1417 // For redirecting constructors, the fields have already been
1418 buildFieldInitializers(callee.enclosingElement.implementation, 1418 // initialized by the caller.
1419 if (callee.getEnclosingClass() != caller.getEnclosingClass()) {
1420 inlinedFrom(callee, () {
1421 buildFieldInitializers(callee.enclosingElement.implementation,
1419 fieldValues); 1422 fieldValues);
1420 }); 1423 });
1424 }
1421 1425
1422 int index = 0; 1426 int index = 0;
1423 FunctionSignature params = callee.computeSignature(compiler); 1427 FunctionSignature params = callee.computeSignature(compiler);
1424 params.orderedForEachParameter((Element parameter) { 1428 params.orderedForEachParameter((Element parameter) {
1425 HInstruction argument = compiledArguments[index++]; 1429 HInstruction argument = compiledArguments[index++];
1426 // Because we are inlining the initializer, we must update 1430 // Because we are inlining the initializer, we must update
1427 // what was given as parameter. This will be used in case 1431 // what was given as parameter. This will be used in case
1428 // there is a parameter check expression in the initializer. 1432 // there is a parameter check expression in the initializer.
1429 parameters[parameter] = argument; 1433 parameters[parameter] = argument;
1430 localsHandler.updateLocal(parameter, argument); 1434 localsHandler.updateLocal(parameter, argument);
(...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after
5509 new HSubGraphBlockInformation(elseBranch.graph)); 5513 new HSubGraphBlockInformation(elseBranch.graph));
5510 5514
5511 HBasicBlock conditionStartBlock = conditionBranch.block; 5515 HBasicBlock conditionStartBlock = conditionBranch.block;
5512 conditionStartBlock.setBlockFlow(info, joinBlock); 5516 conditionStartBlock.setBlockFlow(info, joinBlock);
5513 SubGraph conditionGraph = conditionBranch.graph; 5517 SubGraph conditionGraph = conditionBranch.graph;
5514 HIf branch = conditionGraph.end.last; 5518 HIf branch = conditionGraph.end.last;
5515 assert(branch is HIf); 5519 assert(branch is HIf);
5516 branch.blockInformation = conditionStartBlock.blockFlow; 5520 branch.blockInformation = conditionStartBlock.blockFlow;
5517 } 5521 }
5518 } 5522 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/evaluation_redirecting_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698