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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10533128: Reapply "Simplify generated code for trivial bailout methods". (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/ssa/bailout.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/builder.dart
===================================================================
--- lib/compiler/implementation/ssa/builder.dart (revision 8641)
+++ lib/compiler/implementation/ssa/builder.dart (working copy)
@@ -319,7 +319,7 @@
params.forEachParameter((Element element) {
HInstruction parameter = new HParameterValue(element);
builder.add(parameter);
- builder.potentiallyCheckType(parameter, element);
+ builder.parameters[element] = parameter;
directLocals[element] = parameter;
});
@@ -447,9 +447,9 @@
// If the element is a parameter, we already have a
// HParameterValue for it. We cannot create another one because
// it could then have another name than the real parameter. And
- // the other one would not not it is just a copy of the real
+ // the other one would not know it is just a copy of the real
// parameter.
- if (element.isParameter()) return directLocals[element];
+ if (element.isParameter()) return builder.parameters[element];
return builder.activationVariables.putIfAbsent(element, () {
HParameterValue parameter = new HParameterValue(element);
@@ -793,6 +793,7 @@
HGraph graph;
LocalsHandler localsHandler;
HInstruction rethrowableException;
+ Map<Element, HParameterValue> parameters;
Map<TargetElement, JumpHandler> jumpTargets;
@@ -827,6 +828,7 @@
stack = new List<HInstruction>(),
activationVariables = new Map<Element, HParameterValue>(),
jumpTargets = new Map<TargetElement, JumpHandler>(),
+ parameters = new Map<Element, HParameterValue>(),
super(work.resolutionTree) {
localsHandler = new LocalsHandler(this);
}
@@ -1076,6 +1078,17 @@
close(new HGoto()).addSuccessor(block);
open(block);
+
+ // Put the type checks in the first successor of the entry,
+ // because that is where the type guards will also be inserted.
+ // This way we ensure that a type guard will dominate the type
+ // check.
+ FunctionSignature params = functionElement.computeSignature(compiler);
+ params.forEachParameter((Element element) {
+ HInstruction newParameter = potentiallyCheckType(
+ localsHandler.directLocals[element], element);
+ localsHandler.directLocals[element] = newParameter;
+ });
}
HInstruction potentiallyCheckType(HInstruction original,
« no previous file with comments | « lib/compiler/implementation/ssa/bailout.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698