Commit f52b4b3b authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Temporarily turn some DCHECKs into CHECKs.

This turns most DCHECKs in the register allocator code into CHECKs,
which hopefully will tell us more about the crashes in crbug 831822.

This CL will eventually be reverted again.

Bug: chromium:831822
Change-Id: I123ed507949ecab50bb0aaaf9e91978c9c2d8d65
Reviewed-on: https://chromium-review.googlesource.com/1016762
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52673}
parent 7560b33e
This diff is collapsed.
...@@ -59,7 +59,7 @@ class LifetimePosition final { ...@@ -59,7 +59,7 @@ class LifetimePosition final {
// Returns the index of the instruction to which this lifetime position // Returns the index of the instruction to which this lifetime position
// corresponds. // corresponds.
int ToInstructionIndex() const { int ToInstructionIndex() const {
DCHECK(IsValid()); CHECK(IsValid());
return value_ / kStep; return value_ / kStep;
} }
...@@ -75,38 +75,38 @@ class LifetimePosition final { ...@@ -75,38 +75,38 @@ class LifetimePosition final {
// Returns the lifetime position for the current START. // Returns the lifetime position for the current START.
LifetimePosition Start() const { LifetimePosition Start() const {
DCHECK(IsValid()); CHECK(IsValid());
return LifetimePosition(value_ & ~(kHalfStep - 1)); return LifetimePosition(value_ & ~(kHalfStep - 1));
} }
// Returns the lifetime position for the current gap START. // Returns the lifetime position for the current gap START.
LifetimePosition FullStart() const { LifetimePosition FullStart() const {
DCHECK(IsValid()); CHECK(IsValid());
return LifetimePosition(value_ & ~(kStep - 1)); return LifetimePosition(value_ & ~(kStep - 1));
} }
// Returns the lifetime position for the current END. // Returns the lifetime position for the current END.
LifetimePosition End() const { LifetimePosition End() const {
DCHECK(IsValid()); CHECK(IsValid());
return LifetimePosition(Start().value_ + kHalfStep / 2); return LifetimePosition(Start().value_ + kHalfStep / 2);
} }
// Returns the lifetime position for the beginning of the next START. // Returns the lifetime position for the beginning of the next START.
LifetimePosition NextStart() const { LifetimePosition NextStart() const {
DCHECK(IsValid()); CHECK(IsValid());
return LifetimePosition(Start().value_ + kHalfStep); return LifetimePosition(Start().value_ + kHalfStep);
} }
// Returns the lifetime position for the beginning of the next gap START. // Returns the lifetime position for the beginning of the next gap START.
LifetimePosition NextFullStart() const { LifetimePosition NextFullStart() const {
DCHECK(IsValid()); CHECK(IsValid());
return LifetimePosition(FullStart().value_ + kStep); return LifetimePosition(FullStart().value_ + kStep);
} }
// Returns the lifetime position for the beginning of the previous START. // Returns the lifetime position for the beginning of the previous START.
LifetimePosition PrevStart() const { LifetimePosition PrevStart() const {
DCHECK(IsValid()); CHECK(IsValid());
DCHECK_LE(kHalfStep, value_); CHECK_LE(kHalfStep, value_);
return LifetimePosition(Start().value_ - kHalfStep); return LifetimePosition(Start().value_ - kHalfStep);
} }
...@@ -177,7 +177,7 @@ class UseInterval final : public ZoneObject { ...@@ -177,7 +177,7 @@ class UseInterval final : public ZoneObject {
public: public:
UseInterval(LifetimePosition start, LifetimePosition end) UseInterval(LifetimePosition start, LifetimePosition end)
: start_(start), end_(end), next_(nullptr) { : start_(start), end_(end), next_(nullptr) {
DCHECK(start < end); CHECK(start < end);
} }
LifetimePosition start() const { return start_; } LifetimePosition start() const { return start_; }
...@@ -400,17 +400,17 @@ class V8_EXPORT_PRIVATE LiveRange : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -400,17 +400,17 @@ class V8_EXPORT_PRIVATE LiveRange : public NON_EXPORTED_BASE(ZoneObject) {
} }
UsePosition* current_hint_position() const { UsePosition* current_hint_position() const {
DCHECK(current_hint_position_ == FirstHintPosition()); CHECK(current_hint_position_ == FirstHintPosition());
return current_hint_position_; return current_hint_position_;
} }
LifetimePosition Start() const { LifetimePosition Start() const {
DCHECK(!IsEmpty()); CHECK(!IsEmpty());
return first_interval()->start(); return first_interval()->start();
} }
LifetimePosition End() const { LifetimePosition End() const {
DCHECK(!IsEmpty()); CHECK(!IsEmpty());
return last_interval_->end(); return last_interval_->end();
} }
...@@ -534,17 +534,17 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange { ...@@ -534,17 +534,17 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange {
} }
SpillType spill_type() const { return SpillTypeField::decode(bits_); } SpillType spill_type() const { return SpillTypeField::decode(bits_); }
InstructionOperand* GetSpillOperand() const { InstructionOperand* GetSpillOperand() const {
DCHECK_EQ(SpillType::kSpillOperand, spill_type()); CHECK_EQ(SpillType::kSpillOperand, spill_type());
return spill_operand_; return spill_operand_;
} }
SpillRange* GetAllocatedSpillRange() const { SpillRange* GetAllocatedSpillRange() const {
DCHECK_NE(SpillType::kSpillOperand, spill_type()); CHECK_NE(SpillType::kSpillOperand, spill_type());
return spill_range_; return spill_range_;
} }
SpillRange* GetSpillRange() const { SpillRange* GetSpillRange() const {
DCHECK_EQ(SpillType::kSpillRange, spill_type()); CHECK_EQ(SpillType::kSpillRange, spill_type());
return spill_range_; return spill_range_;
} }
bool HasNoSpillType() const { bool HasNoSpillType() const {
...@@ -590,7 +590,7 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange { ...@@ -590,7 +590,7 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange {
TopLevelLiveRange* splintered_from() const { return splintered_from_; } TopLevelLiveRange* splintered_from() const { return splintered_from_; }
bool IsSplinter() const { return splintered_from_ != nullptr; } bool IsSplinter() const { return splintered_from_ != nullptr; }
bool MayRequireSpillRange() const { bool MayRequireSpillRange() const {
DCHECK(!IsSplinter()); CHECK(!IsSplinter());
return !HasSpillOperand() && spill_range_ == nullptr; return !HasSpillOperand() && spill_range_ == nullptr;
} }
void UpdateSpillRangePostMerge(TopLevelLiveRange* merged); void UpdateSpillRangePostMerge(TopLevelLiveRange* merged);
...@@ -617,13 +617,13 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange { ...@@ -617,13 +617,13 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange {
struct SpillMoveInsertionList; struct SpillMoveInsertionList;
SpillMoveInsertionList* GetSpillMoveInsertionLocations() const { SpillMoveInsertionList* GetSpillMoveInsertionLocations() const {
DCHECK(!IsSpilledOnlyInDeferredBlocks()); CHECK(!IsSpilledOnlyInDeferredBlocks());
return spill_move_insertion_locations_; return spill_move_insertion_locations_;
} }
TopLevelLiveRange* splinter() const { return splinter_; } TopLevelLiveRange* splinter() const { return splinter_; }
void SetSplinter(TopLevelLiveRange* splinter) { void SetSplinter(TopLevelLiveRange* splinter) {
DCHECK_NULL(splinter_); CHECK_NULL(splinter_);
DCHECK_NOT_NULL(splinter); CHECK_NOT_NULL(splinter);
splinter_ = splinter; splinter_ = splinter;
splinter->relative_id_ = GetNextChildId(); splinter->relative_id_ = GetNextChildId();
...@@ -635,12 +635,12 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange { ...@@ -635,12 +635,12 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange {
bool has_preassigned_slot() const { return has_preassigned_slot_; } bool has_preassigned_slot() const { return has_preassigned_slot_; }
void AddBlockRequiringSpillOperand(RpoNumber block_id) { void AddBlockRequiringSpillOperand(RpoNumber block_id) {
DCHECK(IsSpilledOnlyInDeferredBlocks()); CHECK(IsSpilledOnlyInDeferredBlocks());
GetListOfBlocksRequiringSpillOperands()->Add(block_id.ToInt()); GetListOfBlocksRequiringSpillOperands()->Add(block_id.ToInt());
} }
BitVector* GetListOfBlocksRequiringSpillOperands() const { BitVector* GetListOfBlocksRequiringSpillOperands() const {
DCHECK(IsSpilledOnlyInDeferredBlocks()); CHECK(IsSpilledOnlyInDeferredBlocks());
return list_of_blocks_requiring_spill_operands_; return list_of_blocks_requiring_spill_operands_;
} }
...@@ -700,11 +700,11 @@ class SpillRange final : public ZoneObject { ...@@ -700,11 +700,11 @@ class SpillRange final : public ZoneObject {
bool HasSlot() const { return assigned_slot_ != kUnassignedSlot; } bool HasSlot() const { return assigned_slot_ != kUnassignedSlot; }
void set_assigned_slot(int index) { void set_assigned_slot(int index) {
DCHECK_EQ(kUnassignedSlot, assigned_slot_); CHECK_EQ(kUnassignedSlot, assigned_slot_);
assigned_slot_ = index; assigned_slot_ = index;
} }
int assigned_slot() { int assigned_slot() {
DCHECK_NE(kUnassignedSlot, assigned_slot_); CHECK_NE(kUnassignedSlot, assigned_slot_);
return assigned_slot_; return assigned_slot_;
} }
const ZoneVector<TopLevelLiveRange*>& live_ranges() const { const ZoneVector<TopLevelLiveRange*>& live_ranges() const {
...@@ -743,7 +743,7 @@ class RegisterAllocationData final : public ZoneObject { ...@@ -743,7 +743,7 @@ class RegisterAllocationData final : public ZoneObject {
// For hinting. // For hinting.
int assigned_register() const { return assigned_register_; } int assigned_register() const { return assigned_register_; }
void set_assigned_register(int register_code) { void set_assigned_register(int register_code) {
DCHECK_EQ(assigned_register_, kUnassignedRegister); CHECK_EQ(assigned_register_, kUnassignedRegister);
assigned_register_ = register_code; assigned_register_ = register_code;
} }
void UnsetAssignedRegister() { assigned_register_ = kUnassignedRegister; } void UnsetAssignedRegister() { assigned_register_ = kUnassignedRegister; }
...@@ -1110,9 +1110,7 @@ class LinearScanAllocator final : public RegisterAllocator { ...@@ -1110,9 +1110,7 @@ class LinearScanAllocator final : public RegisterAllocator {
ZoneVector<LiveRange*> active_live_ranges_; ZoneVector<LiveRange*> active_live_ranges_;
ZoneVector<LiveRange*> inactive_live_ranges_; ZoneVector<LiveRange*> inactive_live_ranges_;
#ifdef DEBUG
LifetimePosition allocation_finger_; LifetimePosition allocation_finger_;
#endif
DISALLOW_COPY_AND_ASSIGN(LinearScanAllocator); DISALLOW_COPY_AND_ASSIGN(LinearScanAllocator);
}; };
......
...@@ -71,7 +71,7 @@ TEST_F(LiveRangeUnitTest, InvalidConstruction) { ...@@ -71,7 +71,7 @@ TEST_F(LiveRangeUnitTest, InvalidConstruction) {
// Build a range manually, because the builder guards against empty cases. // Build a range manually, because the builder guards against empty cases.
TopLevelLiveRange* range = TopLevelLiveRange* range =
new (zone()) TopLevelLiveRange(1, MachineRepresentation::kTagged); new (zone()) TopLevelLiveRange(1, MachineRepresentation::kTagged);
V8_ASSERT_DEBUG_DEATH( ASSERT_DEATH_IF_SUPPORTED(
range->AddUseInterval(LifetimePosition::FromInt(0), range->AddUseInterval(LifetimePosition::FromInt(0),
LifetimePosition::FromInt(0), zone()), LifetimePosition::FromInt(0), zone()),
".*"); ".*");
...@@ -79,7 +79,7 @@ TEST_F(LiveRangeUnitTest, InvalidConstruction) { ...@@ -79,7 +79,7 @@ TEST_F(LiveRangeUnitTest, InvalidConstruction) {
TEST_F(LiveRangeUnitTest, SplitInvalidStart) { TEST_F(LiveRangeUnitTest, SplitInvalidStart) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1);
V8_ASSERT_DEBUG_DEATH(Split(range, 0), ".*"); ASSERT_DEATH_IF_SUPPORTED(Split(range, 0), ".*");
} }
TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(InvalidSplitEnd)) { TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(InvalidSplitEnd)) {
...@@ -308,7 +308,7 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsOutside) { ...@@ -308,7 +308,7 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsOutside) {
TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsInside) { TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsInside) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
V8_ASSERT_DEBUG_DEATH(Splinter(range, 3, 5), ".*"); ASSERT_DEATH_IF_SUPPORTED(Splinter(range, 3, 5), ".*");
} }
TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsLeft) { TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsLeft) {
......
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