Commit 425f3fde authored by titzer@chromium.org's avatar titzer@chromium.org

Eliminate HCheckHeapObject instructions in check elimination.

BUG=
R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/95263005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18160 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e5eef90e
...@@ -97,6 +97,10 @@ class HCheckTable : public ZoneObject { ...@@ -97,6 +97,10 @@ class HCheckTable : public ZoneObject {
ReduceCheckMapValue(HCheckMapValue::cast(instr)); ReduceCheckMapValue(HCheckMapValue::cast(instr));
break; break;
} }
case HValue::kCheckHeapObject: {
ReduceCheckHeapObject(HCheckHeapObject::cast(instr));
break;
}
default: { default: {
// If the instruction changes maps uncontrollably, drop everything. // If the instruction changes maps uncontrollably, drop everything.
if (instr->CheckGVNFlag(kChangesMaps) || if (instr->CheckGVNFlag(kChangesMaps) ||
...@@ -105,7 +109,8 @@ class HCheckTable : public ZoneObject { ...@@ -105,7 +109,8 @@ class HCheckTable : public ZoneObject {
} }
} }
// Improvements possible: // Improvements possible:
// - eliminate HCheckSmi and HCheckHeapObject // - eliminate redundant HCheckSmi, HCheckInstanceType instructions
// - track which values have been HCheckHeapObject'd
} }
return this; return this;
...@@ -236,6 +241,14 @@ class HCheckTable : public ZoneObject { ...@@ -236,6 +241,14 @@ class HCheckTable : public ZoneObject {
} }
} }
void ReduceCheckHeapObject(HCheckHeapObject* instr) {
if (FindMaps(instr->value()->ActualValue()) != NULL) {
// If the object has known maps, it's definitely a heap object.
instr->DeleteAndReplaceWith(instr->value());
INC_STAT(removed_cho_);
}
}
void ReduceStoreNamedField(HStoreNamedField* instr) { void ReduceStoreNamedField(HStoreNamedField* instr) {
HValue* object = instr->object()->ActualValue(); HValue* object = instr->object()->ActualValue();
if (instr->has_transition()) { if (instr->has_transition()) {
...@@ -488,15 +501,19 @@ void HCheckEliminationPhase::Run() { ...@@ -488,15 +501,19 @@ void HCheckEliminationPhase::Run() {
// Are we eliminated yet? // Are we eliminated yet?
void HCheckEliminationPhase::PrintStats() { void HCheckEliminationPhase::PrintStats() {
#if DEBUG #if DEBUG
if (redundant_ > 0) PrintF(" redundant = %2d\n", redundant_); #define PRINT_STAT(x) if (x##_ > 0) PrintF(" %-16s = %2d\n", #x, x##_)
if (removed_ > 0) PrintF(" removed = %2d\n", removed_); #else
if (narrowed_ > 0) PrintF(" narrowed = %2d\n", narrowed_); #define PRINT_STAT(x)
if (loads_ > 0) PrintF(" loads = %2d\n", loads_);
if (empty_ > 0) PrintF(" empty = %2d\n", empty_);
if (compares_true_ > 0) PrintF(" cmp_true = %2d\n", compares_true_);
if (compares_false_ > 0) PrintF(" cmp_false = %2d\n", compares_false_);
if (transitions_ > 0) PrintF(" transitions = %2d\n", transitions_);
#endif #endif
PRINT_STAT(redundant);
PRINT_STAT(removed);
PRINT_STAT(removed_cho);
PRINT_STAT(narrowed);
PRINT_STAT(loads);
PRINT_STAT(empty);
PRINT_STAT(compares_true);
PRINT_STAT(compares_false);
PRINT_STAT(transitions);
} }
} } // namespace v8::internal } } // namespace v8::internal
...@@ -43,6 +43,7 @@ class HCheckEliminationPhase : public HPhase { ...@@ -43,6 +43,7 @@ class HCheckEliminationPhase : public HPhase {
aliasing_(), aliasing_(),
redundant_(0), redundant_(0),
removed_(0), removed_(0),
removed_cho_(0),
narrowed_(0), narrowed_(0),
loads_(0), loads_(0),
empty_(0), empty_(0),
...@@ -60,6 +61,7 @@ class HCheckEliminationPhase : public HPhase { ...@@ -60,6 +61,7 @@ class HCheckEliminationPhase : public HPhase {
HAliasAnalyzer* aliasing_; HAliasAnalyzer* aliasing_;
int redundant_; int redundant_;
int removed_; int removed_;
int removed_cho_;
int narrowed_; int narrowed_;
int loads_; int loads_;
int empty_; int empty_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment