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

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

Issue 15697004: Add a proper HInvokeConstructorBody instead of mis-using HInvokeDynamicMethod. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 }); 1687 });
1688 } 1688 }
1689 1689
1690 // If there are locals that escape (ie mutated in closures), we 1690 // If there are locals that escape (ie mutated in closures), we
1691 // pass the box to the constructor. 1691 // pass the box to the constructor.
1692 ClosureScope scopeData = parameterClosureData.capturingScopes[node]; 1692 ClosureScope scopeData = parameterClosureData.capturingScopes[node];
1693 if (scopeData != null) { 1693 if (scopeData != null) {
1694 bodyCallInputs.add(localsHandler.readLocal(scopeData.boxElement)); 1694 bodyCallInputs.add(localsHandler.readLocal(scopeData.boxElement));
1695 } 1695 }
1696 1696
1697 // TODO(ahe): The constructor name is statically resolved. See 1697 HInvokeConstructorBody invoke =
1698 // SsaCodeGenerator.visitInvokeDynamicMethod. Is there a cleaner 1698 new HInvokeConstructorBody(body, bodyCallInputs);
1699 // way to do this? 1699 invoke.sideEffects = compiler.world.getSideEffectsOfElement(constructor);
1700 SourceString name =
1701 new SourceString(backend.namer.getName(body.declaration));
1702 // TODO(kasperl): This seems fishy. We shouldn't be inventing all
1703 // these selectors. Maybe the resolver can do more of the work
1704 // for us here?
1705 LibraryElement library = body.getLibrary();
1706 Selector selector = new Selector.call(
1707 name, library, bodyCallInputs.length - 1);
1708 HInvokeDynamic invoke =
1709 new HInvokeDynamicMethod(selector, bodyCallInputs);
1710 invoke.element = body;
1711 add(invoke); 1700 add(invoke);
1712 } 1701 }
1713 closeAndGotoExit(new HReturn(newObject)); 1702 closeAndGotoExit(new HReturn(newObject));
1714 return closeFunction(); 1703 return closeFunction();
1715 } 1704 }
1716 1705
1717 void addParameterCheckInstruction(Element element) { 1706 void addParameterCheckInstruction(Element element) {
1718 HInstruction check; 1707 HInstruction check;
1719 Element checkResultElement = 1708 Element checkResultElement =
1720 localsHandler.closureData.parametersWithSentinel[element]; 1709 localsHandler.closureData.parametersWithSentinel[element];
(...skipping 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 new HSubGraphBlockInformation(elseBranch.graph)); 5393 new HSubGraphBlockInformation(elseBranch.graph));
5405 5394
5406 HBasicBlock conditionStartBlock = conditionBranch.block; 5395 HBasicBlock conditionStartBlock = conditionBranch.block;
5407 conditionStartBlock.setBlockFlow(info, joinBlock); 5396 conditionStartBlock.setBlockFlow(info, joinBlock);
5408 SubGraph conditionGraph = conditionBranch.graph; 5397 SubGraph conditionGraph = conditionBranch.graph;
5409 HIf branch = conditionGraph.end.last; 5398 HIf branch = conditionGraph.end.last;
5410 assert(branch is HIf); 5399 assert(branch is HIf);
5411 branch.blockInformation = conditionStartBlock.blockFlow; 5400 branch.blockInformation = conditionStartBlock.blockFlow;
5412 } 5401 }
5413 } 5402 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698