Commit bfdccd7e authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[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: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66843}
parent 48c38718
......@@ -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)
......
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