[cleanup] use DCHECK_LT where applicable

This gives nicer error messages.

Was
  Fatal error in ../../src/compiler/backend/instruction.h, line 778
  Debug check failed: i < InputCount().

Now
  Fatal error in ../../src/compiler/backend/instruction.h, line 778
  Debug check failed: i < InputCount() (5 vs. 3).

Bug: v8:9396
Change-Id: Iab2aea49245a42397bf07f4abf9e3de501c758b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1817258
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63954}
This commit is contained in:
Ng Zhi An 2019-09-20 15:27:12 -07:00 committed by Commit Bot
parent 9cf9e82a2a
commit 9cd54cd4f5

View File

@ -757,11 +757,11 @@ class V8_EXPORT_PRIVATE Instruction final {
public:
size_t OutputCount() const { return OutputCountField::decode(bit_field_); }
const InstructionOperand* OutputAt(size_t i) const {
DCHECK(i < OutputCount());
DCHECK_LT(i, OutputCount());
return &operands_[i];
}
InstructionOperand* OutputAt(size_t i) {
DCHECK(i < OutputCount());
DCHECK_LT(i, OutputCount());
return &operands_[i];
}
@ -771,21 +771,21 @@ class V8_EXPORT_PRIVATE Instruction final {
size_t InputCount() const { return InputCountField::decode(bit_field_); }
const InstructionOperand* InputAt(size_t i) const {
DCHECK(i < InputCount());
DCHECK_LT(i, InputCount());
return &operands_[OutputCount() + i];
}
InstructionOperand* InputAt(size_t i) {
DCHECK(i < InputCount());
DCHECK_LT(i, InputCount());
return &operands_[OutputCount() + i];
}
size_t TempCount() const { return TempCountField::decode(bit_field_); }
const InstructionOperand* TempAt(size_t i) const {
DCHECK(i < TempCount());
DCHECK_LT(i, TempCount());
return &operands_[OutputCount() + InputCount() + i];
}
InstructionOperand* TempAt(size_t i) {
DCHECK(i < TempCount());
DCHECK_LT(i, TempCount());
return &operands_[OutputCount() + InputCount() + i];
}