diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 1db86e844a..336c9f7cec 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -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("]"); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index e558ac7ce2..26501d07fb 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -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_; diff --git a/src/hydrogen-range-analysis.cc b/src/hydrogen-range-analysis.cc index 9d58fc89f0..6924a076e7 100644 --- a/src/hydrogen-range-analysis.cc +++ b/src/hydrogen-range-analysis.cc @@ -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 } diff --git a/src/hydrogen-range-analysis.h b/src/hydrogen-range-analysis.h index e0cc3c5dad..b474f69862 100644 --- a/src/hydrogen-range-analysis.h +++ b/src/hydrogen-range-analysis.h @@ -57,6 +57,7 @@ class HRangeAnalysisPhase : public HPhase { worklist_.Add(value, zone()); } void PropagateMinusZeroChecks(HValue* value); + void PoisonRanges(); ZoneList changed_ranges_;