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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10832277: Eliminate condition type check when possible. (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 10609)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -9,6 +9,7 @@
#include "vm/object_store.h"
#include "vm/parser.h"
#include "vm/scopes.h"
+#include "vm/symbols.h"
namespace dart {
@@ -575,22 +576,42 @@
void FlowGraphTypePropagator::VisitAssertAssignable(AssertAssignableComp* comp,
BindInstr* instr) {
if (FLAG_eliminate_type_checks &&
- !comp->IsEliminated() &&
+ !comp->is_eliminated() &&
!comp->dst_type().IsMalformed() &&
comp->value()->CompileTypeIsMoreSpecificThan(comp->dst_type())) {
- comp->Eliminate();
+ comp->eliminate();
if (FLAG_trace_type_check_elimination) {
FlowGraphPrinter::PrintTypeCheck(parsed_function(),
comp->token_pos(),
comp->value(),
comp->dst_type(),
comp->dst_name(),
- comp->IsEliminated());
+ comp->is_eliminated());
}
}
}
+void FlowGraphTypePropagator::VisitAssertBoolean(AssertBooleanComp* comp,
+ BindInstr* instr) {
+ if (FLAG_eliminate_type_checks &&
+ !comp->is_eliminated() &&
+ comp->value()->CompileTypeIsMoreSpecificThan(
+ Type::Handle(Type::BoolInterface()))) {
+ comp->eliminate();
+ if (FLAG_trace_type_check_elimination) {
+ const String& name = String::Handle(Symbols::New("boolean expression"));
+ FlowGraphPrinter::PrintTypeCheck(parsed_function(),
+ comp->token_pos(),
+ comp->value(),
+ Type::Handle(Type::BoolInterface()),
+ name,
+ comp->is_eliminated());
+ }
+ }
+}
+
+
void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) {
if (graph_entry->start_env() == NULL) {
return;
« 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