Reviewers: Toon Verwaest,
Description:
Check elimination: Learn from if(CompareMap(x)) on true branch.
BUG=
Please review this at https://codereview.chromium.org/99043002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+17, -0 lines):
M src/hydrogen-check-elimination.cc
Index: src/hydrogen-check-elimination.cc
diff --git a/src/hydrogen-check-elimination.cc
b/src/hydrogen-check-elimination.cc
index
bf8257c83d913e0ebc5f0f98081d7a8de99e546f..a847426a9f9924f0e547b9cf91660f9eaa4c8e43
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 = Find(object);
+ if (entry == NULL) {
+ 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;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.