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

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
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 10606)
+++ 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 {
@@ -591,6 +592,26 @@
}
+void FlowGraphTypePropagator::VisitAssertBoolean(AssertBooleanComp* comp,
+ BindInstr* instr) {
+ if (FLAG_eliminate_type_checks &&
+ !comp->IsEliminated() &&
+ 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->IsEliminated());
+ }
+ }
+}
+
+
void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) {
if (graph_entry->start_env() == NULL) {
return;

Powered by Google App Engine
This is Rietveld 408576698