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

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

Issue 104843002: Remove half of the checks for comparing two Obejcts (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: 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 | « src/hydrogen.cc ('k') | no next file » | 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 bbd3042fb7af6659f4107fffb7127e1298000593..fb0583af533ed48b368f39c5c3302fb5ac9e3177 100644
--- a/src/hydrogen-check-elimination.cc
+++ b/src/hydrogen-check-elimination.cc
@@ -101,6 +101,10 @@ class HCheckTable : public ZoneObject {
ReduceCheckHeapObject(HCheckHeapObject::cast(instr));
break;
}
+ case HValue::kCompareObjectEqAndBranch: {
+ ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch::cast(instr));
+ break;
+ }
default: {
// If the instruction changes maps uncontrollably, drop everything.
if (instr->CheckGVNFlag(kChangesMaps) ||
@@ -266,6 +270,30 @@ class HCheckTable : public ZoneObject {
}
}
+ void ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch* instr) {
+ HValue* left = instr->left();
+ HValue* right = instr->right();
+ if (left->IsCheckMaps() && right->IsCheckMaps()) {
+ // Check one operand is enough. After licm, remove the correct one.
+ HCheckMaps* removed = NULL;
+ if (left->block()->block_id() > right->block()->block_id()) {
+ removed = HCheckMaps::cast(left);
+ } else {
+ removed = HCheckMaps::cast(right);
+ }
+
+ if (removed->previous()->IsCheckHeapObject()) {
+ HCheckHeapObject* cho = HCheckHeapObject::cast(removed->previous());
+ if (cho->value() == removed->ActualValue()) {
+ cho->DeleteAndReplaceWith(cho->value());
+ INC_STAT(removed_cho_);
+ }
+ }
+ removed->DeleteAndReplaceWith(removed->ActualValue());
titzer 2013/12/04 16:32:00 This transformation is completely incorrect. First
+ INC_STAT(removed_);
+ }
+ }
+
void ReduceStoreNamedField(HStoreNamedField* instr) {
HValue* object = instr->object()->ActualValue();
if (instr->has_transition()) {
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698