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

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

Issue 10827181: Collect call site information and use that for estimating parameter types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
Index: lib/compiler/implementation/ssa/builder.dart
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index a66dbaf7c2a4c7ff9fa48ead04383232ebeafb22..c006fc54afb5783870867adb8eb67ede99a1c4cf 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -138,6 +138,7 @@ class SsaBuilderTask extends CompilerTask {
// Loop tracking information.
final Set<FunctionElement> functionsCalledInLoop;
final Map<SourceString, Selector> selectorsCalledInLoop;
+ final JavaScriptBackend backend;
String get name() => 'SSA builder';
@@ -147,6 +148,7 @@ class SsaBuilderTask extends CompilerTask {
emitter = backend.emitter,
functionsCalledInLoop = new Set<FunctionElement>(),
selectorsCalledInLoop = new Map<SourceString, Selector>(),
+ backend = backend,
super(backend.compiler);
HGraph build(WorkItem work) {
@@ -171,6 +173,18 @@ class SsaBuilderTask extends CompilerTask {
inLoop = selector !== null && selector.applies(element, compiler);
}
graph.calledInLoop = inLoop;
+
+ // If there is an estimate of the parameter types assume these types when
floitsch 2012/08/06 15:01:06 Optimistically use the parameter types that have b
Søren Gjesse 2012/08/07 09:06:03 Much better, thanks.
+ // compiling.
+ List<HType> parameterTypes = backend.optimisticParameterTypes(element);
+ if (parameterTypes != null) {
+ FunctionSignature signature = element.computeSignature(compiler);
+ int i = 0;
+ signature.forEachParameter((Element param) {
+ builder.parameters[param].guaranteedType = parameterTypes[i++];
+ });
+ }
+
if (compiler.tracer.enabled) {
String name;
if (element.enclosingElement !== null &&

Powered by Google App Engine
This is Rietveld 408576698