Make sure that ranges are not accessed after range analysis. Remove HValue::PrintRangeTo.

The ranges are simply wrong after range analysis, and we should only rely on computed flags.

R=bmeurer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20674 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 260ded82
......@@ -590,17 +590,6 @@ void HValue::PrintTypeTo(StringStream* stream) {
}
void HValue::PrintRangeTo(StringStream* stream) {
if (range() == NULL || range()->IsMostGeneric()) return;
// Note: The c1visualizer syntax for locals allows only a sequence of the
// following characters: A-Za-z0-9_-|:
stream->Add(" range:%d_%d%s",
range()->lower(),
range()->upper(),
range()->CanBeMinusZero() ? "_m0" : "");
}
void HValue::PrintChangesTo(StringStream* stream) {
GVNFlagSet changes_flags = ChangesFlags();
if (changes_flags.IsEmpty()) return;
......@@ -701,7 +690,6 @@ void HSourcePosition::PrintTo(FILE* out) {
void HInstruction::PrintTo(StringStream* stream) {
PrintMnemonicTo(stream);
PrintDataTo(stream);
PrintRangeTo(stream);
PrintChangesTo(stream);
PrintTypeTo(stream);
if (CheckFlag(HValue::kHasNoObservableSideEffects)) {
......@@ -2499,7 +2487,6 @@ void HPhi::PrintTo(StringStream* stream) {
int32_non_phi_uses() + int32_indirect_uses(),
double_non_phi_uses() + double_indirect_uses(),
tagged_non_phi_uses() + tagged_indirect_uses());
PrintRangeTo(stream);
PrintTypeTo(stream);
stream->Add("]");
}
......
......@@ -684,6 +684,9 @@ class HValue : public ZoneObject {
type_(type),
use_list_(NULL),
range_(NULL),
#ifdef DEBUG
range_poisoned_(false),
#endif
flags_(0) {}
virtual ~HValue() {}
......@@ -854,9 +857,17 @@ class HValue : public ZoneObject {
return result;
}
Range* range() const { return range_; }
// TODO(svenpanne) We should really use the null object pattern here.
bool HasRange() const { return range_ != NULL; }
Range* range() const {
ASSERT(!range_poisoned_);
return range_;
}
bool HasRange() const {
ASSERT(!range_poisoned_);
return range_ != NULL;
}
#ifdef DEBUG
void PoisonRange() { range_poisoned_ = true; }
#endif
void AddNewRange(Range* r, Zone* zone);
void RemoveLastAddedRange();
void ComputeInitialRange(Zone* zone);
......@@ -888,7 +899,6 @@ class HValue : public ZoneObject {
virtual void PrintTo(StringStream* stream) = 0;
void PrintNameTo(StringStream* stream);
void PrintTypeTo(StringStream* stream);
void PrintRangeTo(StringStream* stream);
void PrintChangesTo(StringStream* stream);
const char* Mnemonic() const;
......@@ -1028,6 +1038,9 @@ class HValue : public ZoneObject {
HType type_;
HUseListNode* use_list_;
Range* range_;
#ifdef DEBUG
bool range_poisoned_;
#endif
int flags_;
GVNFlagSet changes_flags_;
GVNFlagSet depends_on_flags_;
......
......@@ -123,6 +123,22 @@ void HRangeAnalysisPhase::Run() {
block = NULL;
}
}
// The ranges are not valid anymore due to SSI vs. SSA!
PoisonRanges();
}
void HRangeAnalysisPhase::PoisonRanges() {
#ifdef DEBUG
for (int i = 0; i < graph()->blocks()->length(); ++i) {
HBasicBlock* block = graph()->blocks()->at(i);
for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
if (instr->HasRange()) instr->PoisonRange();
}
}
#endif
}
......
......@@ -57,6 +57,7 @@ class HRangeAnalysisPhase : public HPhase {
worklist_.Add(value, zone());
}
void PropagateMinusZeroChecks(HValue* value);
void PoisonRanges();
ZoneList<HValue*> changed_ranges_;
......
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