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

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

Issue 10855170: Track types for arguments passed to calls to static functions (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/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index 3b5cabcdcec72d21961e343d6e5d3846d39678c8..629550eda4e8e071b8fa1a3e3eed443a49a51f32 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -1471,6 +1471,18 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitInvokeStatic(HInvokeStatic node) {
+ if (Elements.isStaticOrTopLevelFunction(node.element) &&
+ node is !HInvokeSuper &&
+ node is !HInvokeInterceptor &&
+ node is !HInvokeBinary &&
+ node is !HInvokeUnary &&
+ node is !HIndex &&
+ node is !HIndexAssign) {
+ // Register this invocation to collect the types used at all call sites.
floitsch 2012/08/15 09:11:59 assert that the typeCode is the one you expect it
Søren Gjesse 2012/08/15 12:17:10 Done. We should look into giving named constants
+ if (Elements.isStaticOrTopLevelFunction(node.element)) {
floitsch 2012/08/15 09:11:59 redundant if.
Søren Gjesse 2012/08/15 12:17:10 Removed.
+ backend.registerStaticInvocation(node);
+ }
+ }
use(node.target);
push(new js.Call(pop(), visitArguments(node.inputs)), node);
}
@@ -1890,6 +1902,11 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
void visitStatic(HStatic node) {
+ node.usedBy.forEach((HInstruction instr) {
+ if (instr is !HInvokeStatic || instr.target !== node) {
floitsch 2012/08/15 09:11:59 not enough: foo(foo);
Søren Gjesse 2012/08/15 12:17:10 Good catch! Added check that the HStatic is also
+ backend.registerNonCallStaticUse(node);
+ }
+ });
world.registerStaticUse(node.element);
push(new js.VariableUse(compiler.namer.isolateAccess(node.element)));
}

Powered by Google App Engine
This is Rietveld 408576698