Commit 29379945 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[cleanup] Rename {kLastErrorMessage} to {kNumberOfReasons}

The name {kLastErrorMessage} is misleading, as it's not actually the
index of the last message (or reason), but one more (i.e. number of
messages / reasons). Thus this renaming.

R=mstarzinger@chromium.org

Bug: v8:7754
Change-Id: Id21edcecac84c0e6068423c6124ef2881116dc7c
Reviewed-on: https://chromium-review.googlesource.com/1145305
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54593}
parent a462a785
......@@ -11,7 +11,7 @@ namespace internal {
#define ERROR_MESSAGES_TEXTS(C, T) T,
const char* GetBailoutReason(BailoutReason reason) {
DCHECK_LT(reason, BailoutReason::kLastErrorMessage);
DCHECK_LT(reason, BailoutReason::kNumberOfReasons);
DCHECK_GE(reason, BailoutReason::kNoReason);
static const char* error_messages_[] = {
BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)};
......@@ -19,7 +19,7 @@ const char* GetBailoutReason(BailoutReason reason) {
}
const char* GetAbortReason(AbortReason reason) {
DCHECK_LT(reason, AbortReason::kLastErrorMessage);
DCHECK_LT(reason, AbortReason::kNumberOfReasons);
DCHECK_GE(reason, AbortReason::kNoReason);
static const char* error_messages_[] = {
ABORT_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)};
......@@ -28,7 +28,7 @@ const char* GetAbortReason(AbortReason reason) {
bool IsValidAbortReason(int reason_id) {
return reason_id >= static_cast<int>(AbortReason::kNoReason) &&
reason_id < static_cast<int>(AbortReason::kLastErrorMessage);
reason_id < static_cast<int>(AbortReason::kNumberOfReasons);
}
#undef ERROR_MESSAGES_TEXTS
......
......@@ -115,11 +115,11 @@ namespace internal {
#define ERROR_MESSAGES_CONSTANTS(C, T) C,
enum class BailoutReason {
BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kNumberOfReasons
};
enum class AbortReason {
ABORT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
ABORT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kNumberOfReasons
};
#undef ERROR_MESSAGES_CONSTANTS
......
......@@ -1200,7 +1200,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ReThrow() {
}
BytecodeArrayBuilder& BytecodeArrayBuilder::Abort(AbortReason reason) {
DCHECK_LT(reason, AbortReason::kLastErrorMessage);
DCHECK_LT(reason, AbortReason::kNumberOfReasons);
DCHECK_GE(reason, AbortReason::kNoReason);
OutputAbort(static_cast<int>(reason));
return *this;
......
......@@ -655,7 +655,7 @@ class SharedFunctionInfo : public HeapObject, public NeverReadOnlySpaceObject {
#undef FLAGS_BIT_FIELDS
// Bailout reasons must fit in the DisabledOptimizationReason bitfield.
STATIC_ASSERT(BailoutReason::kLastErrorMessage <=
STATIC_ASSERT(BailoutReason::kNumberOfReasons <=
DisabledOptimizationReasonBits::kMax);
STATIC_ASSERT(kLastFunctionKind <= FunctionKindBits::kMax);
......
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