[mips32] Change architecture judgement functions to constexpr.

Architecture judgement functions like ‘IsMipsArchVariant’, ‘IsFpxxMode’
used to be macro functions, which may cause ‘unreachable-code’ error if
they are used as condition expressions for ‘if’ statements.
This CL change them to constexpr functions to avoid it.

Change-Id: Id3d8473920711a05abc39265c88e91cc1cb7d5e2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2115833
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66843}
This commit is contained in:
Zhao Jiazhong 2020-03-24 05:24:10 -04:00 committed by Commit Bot
parent 48c38718e8
commit bfdccd7edf

View File

@ -89,15 +89,18 @@ const uint32_t kHoleNanLower32Offset = 4;
#error Unknown endianness
#endif
#define IsFp64Mode() (kFpuMode == kFP64)
#define IsFp32Mode() (kFpuMode == kFP32)
#define IsFpxxMode() (kFpuMode == kFPXX)
constexpr bool IsFp64Mode() { return kFpuMode == kFP64; }
constexpr bool IsFp32Mode() { return kFpuMode == kFP32; }
constexpr bool IsFpxxMode() { return kFpuMode == kFPXX; }
#ifndef _MIPS_ARCH_MIPS32RX
#define IsMipsArchVariant(check) (kArchVariant == check)
constexpr bool IsMipsArchVariant(const ArchVariants check) {
return kArchVariant == check;
}
#else
#define IsMipsArchVariant(check) \
(CpuFeatures::IsSupported(static_cast<CpuFeature>(check)))
bool IsMipsArchVariant(const ArchVariants check) {
return CpuFeatures::IsSupported(static_cast<CpuFeature>(check));
}
#endif
#if defined(V8_TARGET_LITTLE_ENDIAN)