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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10861017: Fix performance regression introduced by new equality semantic: we do not collect ICData when compa… (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') | 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 10998)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -601,6 +601,16 @@
void FlowGraphOptimizer::VisitEqualityCompare(EqualityCompareComp* comp,
BindInstr* instr) {
+ // If one of the inputs is null, no ICdata will be collected.
+ if (comp->left()->BindsToConstantNull() ||
+ comp->right()->BindsToConstantNull()) {
+ Token::Kind strict_kind = (comp->kind() == Token::kEQ) ?
+ Token::kEQ_STRICT : Token::kNE_STRICT;
+ StrictCompareComp* strict_comp =
+ new StrictCompareComp(strict_kind, comp->left(), comp->right());
+ instr->set_computation(strict_comp);
+ return;
+ }
if (!comp->HasICData() || (comp->ic_data()->NumberOfChecks() == 0)) return;
if (comp->ic_data()->NumberOfChecks() == 1) {
ASSERT(comp->ic_data()->num_args_tested() == 2);
@@ -621,6 +631,21 @@
}
+void FlowGraphOptimizer::VisitBranch(BranchInstr* instr) {
+ if ((instr->kind() != Token::kEQ) &&
+ (instr->kind() != Token::kNE)) {
+ return;
+ }
+ if (!instr->left()->BindsToConstantNull() &&
+ !instr->right()->BindsToConstantNull()) {
+ return;
+ }
+ Token::Kind strict_kind = (instr->kind() == Token::kEQ) ?
+ Token::kEQ_STRICT : Token::kNE_STRICT;
+ instr->set_kind(strict_kind);
+}
+
+
void FlowGraphOptimizer::VisitBind(BindInstr* instr) {
instr->computation()->Accept(this, instr);
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698