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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10855134: In checked mode, make sure the ssa compiler propagates the checked types of (Closed) Base URL: http://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
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 10604)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -7,6 +7,8 @@
#include "vm/flow_graph_builder.h"
#include "vm/il_printer.h"
#include "vm/object_store.h"
+#include "vm/parser.h"
+#include "vm/scopes.h"
namespace dart {
@@ -599,6 +601,7 @@
if (val->IsUse()) {
ParameterInstr* param = val->AsUse()->definition()->AsParameter();
if (param != NULL) {
+ ASSERT(param->index() == i);
VisitParameter(param);
}
}
@@ -649,9 +652,20 @@
void FlowGraphTypePropagator::VisitParameter(ParameterInstr* param) {
// TODO(regis): Once we inline functions, the propagated type of the formal
// parameter will reflect the compile type of the passed-in argument.
- // For now, we do not known anything about this type and therefore set it to
- // the DynamicType.
- bool changed = param->SetPropagatedType(Type::Handle(Type::DynamicType()));
+ // For now, we do not known anything about the argument type and therefore set
srdjan 2012/08/13 21:07:38 s/known/know/
regis 2012/08/13 21:09:38 Done.
+ // it to the DynamicType, unless the argument is a compiler generated value,
+ // i.e. the receiver argument or the constructor phase argument.
+ AbstractType& param_type = AbstractType::Handle(Type::DynamicType());
+ if (param->index() < 2) {
+ const Function& function = parsed_function().function();
+ if (((param->index() == 0) && function.IsDynamicFunction()) ||
+ ((param->index() == 1) && function.IsConstructor())) {
+ // Parameter is the receiver or the constructor phase.
+ LocalScope* scope = parsed_function().node_sequence()->scope();
+ param_type = scope->VariableAt(param->index())->type().raw();
+ }
+ }
+ bool changed = param->SetPropagatedType(param_type);
if (changed) {
still_changing_ = true;
}
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698