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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10831252: Revert r10475. (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_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | 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 10475)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -549,101 +549,27 @@
void FlowGraphTypePropagator::VisitAssertAssignable(AssertAssignableComp* comp,
BindInstr* instr) {
if (FLAG_eliminate_type_checks &&
- !comp->IsEliminated() &&
+ (comp->value() != NULL) &&
!comp->dst_type().IsMalformed() &&
- comp->value()->CompileTypeIsMoreSpecificThan(comp->dst_type())) {
- comp->Eliminate();
+ comp->value()->StaticTypeIsMoreSpecificThan(comp->dst_type())) {
+ // TODO(regis): Eliminate type check by removing comp node from graph.
if (FLAG_trace_type_check_elimination) {
FlowGraphPrinter::PrintTypeCheck(parsed_function(),
comp->token_pos(),
comp->value(),
comp->dst_type(),
comp->dst_name(),
- comp->IsEliminated());
+ /*eliminated*/ true);
}
}
}
-void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) {
- if (graph_entry->start_env() == NULL) {
- return;
- }
- // Visit incoming parameters.
- for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) {
- Value* val = graph_entry->start_env()->values()[i];
- if (val->IsUse()) {
- ParameterInstr* param = val->AsUse()->definition()->AsParameter();
- if (param != NULL) {
- VisitParameter(param);
- }
- }
- }
+void FlowGraphTypePropagator::VisitBind(BindInstr* instr) {
+ instr->computation()->Accept(this, instr);
}
-void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) {
- if (join_entry->phis() != NULL) {
- for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) {
- PhiInstr* phi = (*join_entry->phis())[i];
- if (phi != NULL) {
- VisitPhi(phi);
- }
- }
- }
-}
-
-
-void FlowGraphTypePropagator::VisitBind(BindInstr* bind) {
- // No need to propagate the input types of the bound computation, as long as
- // PhiInstr's are handled as part of JoinEntryInstr.
- // Visit computation and possibly eliminate type check.
- bind->computation()->Accept(this, bind);
- // Cache propagated computation type.
- AbstractType& type = AbstractType::Handle(bind->computation()->CompileType());
- bool changed = bind->SetPropagatedType(type);
- if (changed) {
- still_changing_ = true;
- }
-}
-
-
-void FlowGraphTypePropagator::VisitPhi(PhiInstr* phi) {
- // We could set the propagated type of the phi to the least upper bound of its
- // input propagated types. However, keeping all propagated types allows us to
- // optimize method dispatch.
- // TODO(regis): Support a set of propagated types. For now, we compute the
- // least specific of the input propagated types.
- AbstractType& type = AbstractType::Handle(phi->LeastSpecificInputType());
- bool changed = phi->SetPropagatedType(type);
- if (changed) {
- still_changing_ = true;
- }
-}
-
-
-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()));
- if (changed) {
- still_changing_ = true;
- }
-}
-
-
-void FlowGraphTypePropagator::PropagateTypes() {
- // TODO(regis): Is there a way to make this more efficient, e.g. by visiting
- // only blocks depending on blocks that have changed and not the whole graph.
- do {
- still_changing_ = false;
- VisitBlocks();
- } while (still_changing_);
-}
-
-
void FlowGraphAnalyzer::Analyze() {
is_leaf_ = true;
for (intptr_t i = 0; i < blocks_.length(); ++i) {
@@ -658,4 +584,9 @@
}
}
+
+void FlowGraphTypePropagator::PropagateTypes() {
+ VisitBlocks();
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698