Commit 9cd54cd4 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[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/+/1817258Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63954}
parent 9cf9e82a
......@@ -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];
}
......
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