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

Unified Diff: src/hydrogen-check-elimination.cc

Issue 99043002: Check elimination: Learn from if(CompareMap(x)) on true branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update the copy state, not the original. Created 7 years 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 | « no previous file | test/mjsunit/compiler/compare_map_elim.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-check-elimination.cc
diff --git a/src/hydrogen-check-elimination.cc b/src/hydrogen-check-elimination.cc
index bf8257c83d913e0ebc5f0f98081d7a8de99e546f..bbd3042fb7af6659f4107fffb7127e1298000593 100644
--- a/src/hydrogen-check-elimination.cc
+++ b/src/hydrogen-check-elimination.cc
@@ -127,6 +127,23 @@ class HCheckTable : public ZoneObject {
new_entry->check_ = NULL;
new_entry->maps_ = old_entry->maps_->Copy(phase_->zone());
}
+ if (succ->predecessors()->length() == 1) {
+ HControlInstruction* end = succ->predecessors()->at(0)->end();
+ if (end->IsCompareMap() && end->SuccessorAt(0) == succ) {
+ // Learn on the true branch of if(CompareMap(x)).
+ HCompareMap* cmp = HCompareMap::cast(end);
+ HValue* object = cmp->value()->ActualValue();
+ HCheckTableEntry* entry = copy->Find(object);
+ if (entry == NULL) {
+ copy->Insert(object, cmp->map());
+ } else {
+ MapSet list = new(phase_->zone()) UniqueSet<Map>();
+ list->Add(cmp->map(), phase_->zone());
+ entry->maps_ = list;
+ }
+ }
+ // TODO(titzer): is it worthwhile to learn on false branch too?
+ }
return copy;
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/compare_map_elim.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698