Commit 7dccb798 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

Fix GCC 5.4 error on ubuntu 16.04

The stock GCC on Ubuntu 16.04 complains these constants
are unused (possibly gcc issue). This CL changes these
to constexpr to workaround gcc errors.

R=clemensh@chromium.org, joransiu@ca.ibm.com

Change-Id: I8c1772e91744bc46ace6bee576b90d40c0cdf41f
Reviewed-on: https://chromium-review.googlesource.com/881554Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#50936}
parent 2c5de06c
...@@ -98,7 +98,7 @@ namespace internal { ...@@ -98,7 +98,7 @@ namespace internal {
#endif #endif
// Minimum stack size in KB required by compilers. // Minimum stack size in KB required by compilers.
const int kStackSpaceRequiredForCompilation = 40; constexpr int kStackSpaceRequiredForCompilation = 40;
// Determine whether double field unboxing feature is enabled. // Determine whether double field unboxing feature is enabled.
#if V8_TARGET_ARCH_64_BIT #if V8_TARGET_ARCH_64_BIT
...@@ -131,106 +131,106 @@ typedef byte* Address; ...@@ -131,106 +131,106 @@ typedef byte* Address;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Constants // Constants
const int KB = 1024; constexpr int KB = 1024;
const int MB = KB * KB; constexpr int MB = KB * KB;
const int GB = KB * KB * KB; constexpr int GB = KB * KB * KB;
const int kMaxInt = 0x7FFFFFFF; constexpr int kMaxInt = 0x7FFFFFFF;
const int kMinInt = -kMaxInt - 1; constexpr int kMinInt = -kMaxInt - 1;
const int kMaxInt8 = (1 << 7) - 1; constexpr int kMaxInt8 = (1 << 7) - 1;
const int kMinInt8 = -(1 << 7); constexpr int kMinInt8 = -(1 << 7);
const int kMaxUInt8 = (1 << 8) - 1; constexpr int kMaxUInt8 = (1 << 8) - 1;
const int kMinUInt8 = 0; constexpr int kMinUInt8 = 0;
const int kMaxInt16 = (1 << 15) - 1; constexpr int kMaxInt16 = (1 << 15) - 1;
const int kMinInt16 = -(1 << 15); constexpr int kMinInt16 = -(1 << 15);
const int kMaxUInt16 = (1 << 16) - 1; constexpr int kMaxUInt16 = (1 << 16) - 1;
const int kMinUInt16 = 0; constexpr int kMinUInt16 = 0;
const uint32_t kMaxUInt32 = 0xFFFFFFFFu; constexpr uint32_t kMaxUInt32 = 0xFFFFFFFFu;
const int kMinUInt32 = 0; constexpr int kMinUInt32 = 0;
const int kUInt8Size = sizeof(uint8_t); constexpr int kUInt8Size = sizeof(uint8_t);
const int kCharSize = sizeof(char); constexpr int kCharSize = sizeof(char);
const int kShortSize = sizeof(short); // NOLINT constexpr int kShortSize = sizeof(short); // NOLINT
const int kUInt16Size = sizeof(uint16_t); constexpr int kUInt16Size = sizeof(uint16_t);
const int kIntSize = sizeof(int); constexpr int kIntSize = sizeof(int);
const int kInt32Size = sizeof(int32_t); constexpr int kInt32Size = sizeof(int32_t);
const int kInt64Size = sizeof(int64_t); constexpr int kInt64Size = sizeof(int64_t);
const int kUInt32Size = sizeof(uint32_t); constexpr int kUInt32Size = sizeof(uint32_t);
const int kSizetSize = sizeof(size_t); constexpr int kSizetSize = sizeof(size_t);
const int kFloatSize = sizeof(float); constexpr int kFloatSize = sizeof(float);
const int kDoubleSize = sizeof(double); constexpr int kDoubleSize = sizeof(double);
const int kIntptrSize = sizeof(intptr_t); constexpr int kIntptrSize = sizeof(intptr_t);
const int kUIntptrSize = sizeof(uintptr_t); constexpr int kUIntptrSize = sizeof(uintptr_t);
const int kPointerSize = sizeof(void*); constexpr int kPointerSize = sizeof(void*);
#if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT #if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
const int kRegisterSize = kPointerSize + kPointerSize; constexpr int kRegisterSize = kPointerSize + kPointerSize;
#else #else
const int kRegisterSize = kPointerSize; constexpr int kRegisterSize = kPointerSize;
#endif #endif
const int kPCOnStackSize = kRegisterSize; constexpr int kPCOnStackSize = kRegisterSize;
const int kFPOnStackSize = kRegisterSize; constexpr int kFPOnStackSize = kRegisterSize;
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 #if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
const int kElidedFrameSlots = kPCOnStackSize / kPointerSize; constexpr int kElidedFrameSlots = kPCOnStackSize / kPointerSize;
#else #else
const int kElidedFrameSlots = 0; constexpr int kElidedFrameSlots = 0;
#endif #endif
const int kDoubleSizeLog2 = 3; constexpr int kDoubleSizeLog2 = 3;
const size_t kMaxWasmCodeMemory = 256 * MB; constexpr size_t kMaxWasmCodeMemory = 256 * MB;
#if V8_HOST_ARCH_64_BIT #if V8_HOST_ARCH_64_BIT
const int kPointerSizeLog2 = 3; constexpr int kPointerSizeLog2 = 3;
const intptr_t kIntptrSignBit = constexpr intptr_t kIntptrSignBit =
static_cast<intptr_t>(uintptr_t{0x8000000000000000}); static_cast<intptr_t>(uintptr_t{0x8000000000000000});
const uintptr_t kUintptrAllBitsSet = uintptr_t{0xFFFFFFFFFFFFFFFF}; constexpr uintptr_t kUintptrAllBitsSet = uintptr_t{0xFFFFFFFFFFFFFFFF};
const bool kRequiresCodeRange = true; constexpr bool kRequiresCodeRange = true;
#if V8_TARGET_ARCH_MIPS64 #if V8_TARGET_ARCH_MIPS64
// To use pseudo-relative jumps such as j/jal instructions which have 28-bit // To use pseudo-relative jumps such as j/jal instructions which have 28-bit
// encoded immediate, the addresses have to be in range of 256MB aligned // encoded immediate, the addresses have to be in range of 256MB aligned
// region. Used only for large object space. // region. Used only for large object space.
const size_t kMaximalCodeRangeSize = 256 * MB; constexpr size_t kMaximalCodeRangeSize = 256 * MB;
const size_t kCodeRangeAreaAlignment = 256 * MB; constexpr size_t kCodeRangeAreaAlignment = 256 * MB;
#elif V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX #elif V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX
const size_t kMaximalCodeRangeSize = 512 * MB; constexpr size_t kMaximalCodeRangeSize = 512 * MB;
const size_t kCodeRangeAreaAlignment = 64 * KB; // OS page on PPC Linux constexpr size_t kCodeRangeAreaAlignment = 64 * KB; // OS page on PPC Linux
#else #else
const size_t kMaximalCodeRangeSize = 512 * MB; constexpr size_t kMaximalCodeRangeSize = 512 * MB;
const size_t kCodeRangeAreaAlignment = 4 * KB; // OS page. constexpr size_t kCodeRangeAreaAlignment = 4 * KB; // OS page.
#endif #endif
#if V8_OS_WIN #if V8_OS_WIN
const size_t kMinimumCodeRangeSize = 4 * MB; constexpr size_t kMinimumCodeRangeSize = 4 * MB;
const size_t kReservedCodeRangePages = 1; constexpr size_t kReservedCodeRangePages = 1;
#else #else
const size_t kMinimumCodeRangeSize = 3 * MB; constexpr size_t kMinimumCodeRangeSize = 3 * MB;
const size_t kReservedCodeRangePages = 0; constexpr size_t kReservedCodeRangePages = 0;
#endif #endif
#else #else
const int kPointerSizeLog2 = 2; constexpr int kPointerSizeLog2 = 2;
const intptr_t kIntptrSignBit = 0x80000000; constexpr intptr_t kIntptrSignBit = 0x80000000;
const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu; constexpr uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu;
#if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT #if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
// x32 port also requires code range. // x32 port also requires code range.
const bool kRequiresCodeRange = true; constexpr bool kRequiresCodeRange = true;
const size_t kMaximalCodeRangeSize = 256 * MB; constexpr size_t kMaximalCodeRangeSize = 256 * MB;
const size_t kMinimumCodeRangeSize = 3 * MB; constexpr size_t kMinimumCodeRangeSize = 3 * MB;
const size_t kCodeRangeAreaAlignment = 4 * KB; // OS page. constexpr size_t kCodeRangeAreaAlignment = 4 * KB; // OS page.
#elif V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX #elif V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX
const bool kRequiresCodeRange = false; constexpr bool kRequiresCodeRange = false;
const size_t kMaximalCodeRangeSize = 0 * MB; constexpr size_t kMaximalCodeRangeSize = 0 * MB;
const size_t kMinimumCodeRangeSize = 0 * MB; constexpr size_t kMinimumCodeRangeSize = 0 * MB;
const size_t kCodeRangeAreaAlignment = 64 * KB; // OS page on PPC Linux constexpr size_t kCodeRangeAreaAlignment = 64 * KB; // OS page on PPC Linux
#else #else
const bool kRequiresCodeRange = false; constexpr bool kRequiresCodeRange = false;
const size_t kMaximalCodeRangeSize = 0 * MB; constexpr size_t kMaximalCodeRangeSize = 0 * MB;
const size_t kMinimumCodeRangeSize = 0 * MB; constexpr size_t kMinimumCodeRangeSize = 0 * MB;
const size_t kCodeRangeAreaAlignment = 4 * KB; // OS page. constexpr size_t kCodeRangeAreaAlignment = 4 * KB; // OS page.
#endif #endif
const size_t kReservedCodeRangePages = 0; constexpr size_t kReservedCodeRangePages = 0;
#endif #endif
// Trigger an incremental GCs once the external memory reaches this limit. // Trigger an incremental GCs once the external memory reaches this limit.
const int kExternalAllocationSoftLimit = 64 * MB; constexpr int kExternalAllocationSoftLimit = 64 * MB;
// Maximum object size that gets allocated into regular pages. Objects larger // Maximum object size that gets allocated into regular pages. Objects larger
// than that size are allocated in large object space and are never moved in // than that size are allocated in large object space and are never moved in
...@@ -239,39 +239,39 @@ const int kExternalAllocationSoftLimit = 64 * MB; ...@@ -239,39 +239,39 @@ const int kExternalAllocationSoftLimit = 64 * MB;
// account. // account.
// //
// Current value: Page::kAllocatableMemory (on 32-bit arch) - 512 (slack). // Current value: Page::kAllocatableMemory (on 32-bit arch) - 512 (slack).
const int kMaxRegularHeapObjectSize = 507136; constexpr int kMaxRegularHeapObjectSize = 507136;
STATIC_ASSERT(kPointerSize == (1 << kPointerSizeLog2)); STATIC_ASSERT(kPointerSize == (1 << kPointerSizeLog2));
const int kBitsPerByte = 8; constexpr int kBitsPerByte = 8;
const int kBitsPerByteLog2 = 3; constexpr int kBitsPerByteLog2 = 3;
const int kBitsPerPointer = kPointerSize * kBitsPerByte; constexpr int kBitsPerPointer = kPointerSize * kBitsPerByte;
const int kBitsPerInt = kIntSize * kBitsPerByte; constexpr int kBitsPerInt = kIntSize * kBitsPerByte;
// IEEE 754 single precision floating point number bit layout. // IEEE 754 single precision floating point number bit layout.
const uint32_t kBinary32SignMask = 0x80000000u; constexpr uint32_t kBinary32SignMask = 0x80000000u;
const uint32_t kBinary32ExponentMask = 0x7f800000u; constexpr uint32_t kBinary32ExponentMask = 0x7f800000u;
const uint32_t kBinary32MantissaMask = 0x007fffffu; constexpr uint32_t kBinary32MantissaMask = 0x007fffffu;
const int kBinary32ExponentBias = 127; constexpr int kBinary32ExponentBias = 127;
const int kBinary32MaxExponent = 0xFE; constexpr int kBinary32MaxExponent = 0xFE;
const int kBinary32MinExponent = 0x01; constexpr int kBinary32MinExponent = 0x01;
const int kBinary32MantissaBits = 23; constexpr int kBinary32MantissaBits = 23;
const int kBinary32ExponentShift = 23; constexpr int kBinary32ExponentShift = 23;
// Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no // Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no
// other bits set. // other bits set.
const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51; constexpr uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51;
// Latin1/UTF-16 constants // Latin1/UTF-16 constants
// Code-point values in Unicode 4.0 are 21 bits wide. // Code-point values in Unicode 4.0 are 21 bits wide.
// Code units in UTF-16 are 16 bits wide. // Code units in UTF-16 are 16 bits wide.
typedef uint16_t uc16; typedef uint16_t uc16;
typedef int32_t uc32; typedef int32_t uc32;
const int kOneByteSize = kCharSize; constexpr int kOneByteSize = kCharSize;
const int kUC16Size = sizeof(uc16); // NOLINT constexpr int kUC16Size = sizeof(uc16); // NOLINT
// 128 bit SIMD value size. // 128 bit SIMD value size.
const int kSimd128Size = 16; constexpr int kSimd128Size = 16;
// Round up n to be a multiple of sz, where sz is a power of 2. // Round up n to be a multiple of sz, where sz is a power of 2.
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
...@@ -355,10 +355,10 @@ inline LanguageMode stricter_language_mode(LanguageMode mode1, ...@@ -355,10 +355,10 @@ inline LanguageMode stricter_language_mode(LanguageMode mode1,
enum TypeofMode : int { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; enum TypeofMode : int { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
// This constant is used as an undefined value when passing source positions. // This constant is used as an undefined value when passing source positions.
const int kNoSourcePosition = -1; constexpr int kNoSourcePosition = -1;
// This constant is used to indicate missing deoptimization information. // This constant is used to indicate missing deoptimization information.
const int kNoDeoptimizationId = -1; constexpr int kNoDeoptimizationId = -1;
// Deoptimize bailout kind. // Deoptimize bailout kind.
enum class DeoptimizeKind : uint8_t { kEager, kSoft, kLazy }; enum class DeoptimizeKind : uint8_t { kEager, kSoft, kLazy };
...@@ -393,57 +393,53 @@ inline std::ostream& operator<<(std::ostream& os, ...@@ -393,57 +393,53 @@ inline std::ostream& operator<<(std::ostream& os,
} }
// Mask for the sign bit in a smi. // Mask for the sign bit in a smi.
const intptr_t kSmiSignMask = kIntptrSignBit; constexpr intptr_t kSmiSignMask = kIntptrSignBit;
const int kObjectAlignmentBits = kPointerSizeLog2; constexpr int kObjectAlignmentBits = kPointerSizeLog2;
const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; constexpr intptr_t kObjectAlignment = 1 << kObjectAlignmentBits;
const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; constexpr intptr_t kObjectAlignmentMask = kObjectAlignment - 1;
// Desired alignment for pointers. // Desired alignment for pointers.
const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); constexpr intptr_t kPointerAlignment = (1 << kPointerSizeLog2);
const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; constexpr intptr_t kPointerAlignmentMask = kPointerAlignment - 1;
// Desired alignment for double values. // Desired alignment for double values.
const intptr_t kDoubleAlignment = 8; constexpr intptr_t kDoubleAlignment = 8;
const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1; constexpr intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1;
// Desired alignment for generated code is 32 bytes (to improve cache line // Desired alignment for generated code is 32 bytes (to improve cache line
// utilization). // utilization).
const int kCodeAlignmentBits = 5; constexpr int kCodeAlignmentBits = 5;
const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits; constexpr intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
const intptr_t kCodeAlignmentMask = kCodeAlignment - 1; constexpr intptr_t kCodeAlignmentMask = kCodeAlignment - 1;
// Weak references are tagged using the second bit in a pointer. // Weak references are tagged using the second bit in a pointer.
const int kWeakReferenceTag = 3; constexpr int kWeakReferenceTag = 3;
const int kWeakReferenceTagSize = 2; constexpr int kWeakReferenceTagSize = 2;
const intptr_t kWeakReferenceTagMask = (1 << kWeakReferenceTagSize) - 1; constexpr intptr_t kWeakReferenceTagMask = (1 << kWeakReferenceTagSize) - 1;
// Zap-value: The value used for zapping dead objects. // Zap-value: The value used for zapping dead objects.
// Should be a recognizable hex value tagged as a failure. // Should be a recognizable hex value tagged as a failure.
#ifdef V8_HOST_ARCH_64_BIT #ifdef V8_HOST_ARCH_64_BIT
const Address kZapValue = constexpr uint64_t kZapValue = uint64_t{0xdeadbeedbeadbeef};
reinterpret_cast<Address>(uint64_t{0xdeadbeedbeadbeef}); constexpr uint64_t kHandleZapValue = uint64_t{0x1baddead0baddeaf};
const Address kHandleZapValue = constexpr uint64_t kGlobalHandleZapValue = uint64_t{0x1baffed00baffedf};
reinterpret_cast<Address>(uint64_t{0x1baddead0baddeaf}); constexpr uint64_t kFromSpaceZapValue = uint64_t{0x1beefdad0beefdaf};
const Address kGlobalHandleZapValue = constexpr uint64_t kDebugZapValue = uint64_t{0xbadbaddbbadbaddb};
reinterpret_cast<Address>(uint64_t{0x1baffed00baffedf}); constexpr uint64_t kSlotsZapValue = uint64_t{0xbeefdeadbeefdeef};
const Address kFromSpaceZapValue = constexpr uint64_t kFreeListZapValue = 0xfeed1eaffeed1eaf;
reinterpret_cast<Address>(uint64_t{0x1beefdad0beefdaf});
const uint64_t kDebugZapValue = uint64_t{0xbadbaddbbadbaddb};
const uint64_t kSlotsZapValue = uint64_t{0xbeefdeadbeefdeef};
const uint64_t kFreeListZapValue = 0xfeed1eaffeed1eaf;
#else #else
const Address kZapValue = reinterpret_cast<Address>(0xdeadbeef); constexpr uint32_t kZapValue = 0xdeadbeef;
const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddeaf); constexpr uint32_t kHandleZapValue = 0xbaddeaf;
const Address kGlobalHandleZapValue = reinterpret_cast<Address>(0xbaffedf); constexpr uint32_t kGlobalHandleZapValue = 0xbaffedf;
const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdaf); constexpr uint32_t kFromSpaceZapValue = 0xbeefdaf;
const uint32_t kSlotsZapValue = 0xbeefdeef; constexpr uint32_t kSlotsZapValue = 0xbeefdeef;
const uint32_t kDebugZapValue = 0xbadbaddb; constexpr uint32_t kDebugZapValue = 0xbadbaddb;
const uint32_t kFreeListZapValue = 0xfeed1eaf; constexpr uint32_t kFreeListZapValue = 0xfeed1eaf;
#endif #endif
const int kCodeZapValue = 0xbadc0de; constexpr int kCodeZapValue = 0xbadc0de;
const uint32_t kPhantomReferenceZap = 0xca11bac; constexpr uint32_t kPhantomReferenceZap = 0xca11bac;
// On Intel architecture, cache line size is 64 bytes. // On Intel architecture, cache line size is 64 bytes.
// On ARM it may be less (32 bytes), but as far this constant is // On ARM it may be less (32 bytes), but as far this constant is
...@@ -452,8 +448,7 @@ const uint32_t kPhantomReferenceZap = 0xca11bac; ...@@ -452,8 +448,7 @@ const uint32_t kPhantomReferenceZap = 0xca11bac;
// Constants relevant to double precision floating point numbers. // Constants relevant to double precision floating point numbers.
// If looking only at the top 32 bits, the QNaN mask is bits 19 to 30. // If looking only at the top 32 bits, the QNaN mask is bits 19 to 30.
const uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32); constexpr uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Forward declarations for frequently used classes // Forward declarations for frequently used classes
...@@ -538,7 +533,7 @@ enum AllocationSpace { ...@@ -538,7 +533,7 @@ enum AllocationSpace {
FIRST_PAGED_SPACE = OLD_SPACE, FIRST_PAGED_SPACE = OLD_SPACE,
LAST_PAGED_SPACE = MAP_SPACE LAST_PAGED_SPACE = MAP_SPACE
}; };
const int kSpaceTagSize = 3; constexpr int kSpaceTagSize = 3;
enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned }; enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned };
...@@ -745,12 +740,12 @@ union IeeeDoubleBigEndianArchType { ...@@ -745,12 +740,12 @@ union IeeeDoubleBigEndianArchType {
#if V8_TARGET_LITTLE_ENDIAN #if V8_TARGET_LITTLE_ENDIAN
typedef IeeeDoubleLittleEndianArchType IeeeDoubleArchType; typedef IeeeDoubleLittleEndianArchType IeeeDoubleArchType;
const int kIeeeDoubleMantissaWordOffset = 0; constexpr int kIeeeDoubleMantissaWordOffset = 0;
const int kIeeeDoubleExponentWordOffset = 4; constexpr int kIeeeDoubleExponentWordOffset = 4;
#else #else
typedef IeeeDoubleBigEndianArchType IeeeDoubleArchType; typedef IeeeDoubleBigEndianArchType IeeeDoubleArchType;
const int kIeeeDoubleMantissaWordOffset = 4; constexpr int kIeeeDoubleMantissaWordOffset = 4;
const int kIeeeDoubleExponentWordOffset = 0; constexpr int kIeeeDoubleExponentWordOffset = 0;
#endif #endif
// AccessorCallback // AccessorCallback
...@@ -923,20 +918,18 @@ enum AllocationSiteMode { ...@@ -923,20 +918,18 @@ enum AllocationSiteMode {
(!defined(USE_SIMULATOR) || !defined(_MIPS_TARGET_SIMULATOR))) || \ (!defined(USE_SIMULATOR) || !defined(_MIPS_TARGET_SIMULATOR))) || \
(V8_TARGET_ARCH_MIPS64 && !defined(_MIPS_ARCH_MIPS64R6) && \ (V8_TARGET_ARCH_MIPS64 && !defined(_MIPS_ARCH_MIPS64R6) && \
(!defined(USE_SIMULATOR) || !defined(_MIPS_TARGET_SIMULATOR))) (!defined(USE_SIMULATOR) || !defined(_MIPS_TARGET_SIMULATOR)))
const uint32_t kHoleNanUpper32 = 0xFFFF7FFF; constexpr uint32_t kHoleNanUpper32 = 0xFFFF7FFF;
const uint32_t kHoleNanLower32 = 0xFFFF7FFF; constexpr uint32_t kHoleNanLower32 = 0xFFFF7FFF;
#else #else
const uint32_t kHoleNanUpper32 = 0xFFF7FFFF; constexpr uint32_t kHoleNanUpper32 = 0xFFF7FFFF;
const uint32_t kHoleNanLower32 = 0xFFF7FFFF; constexpr uint32_t kHoleNanLower32 = 0xFFF7FFFF;
#endif #endif
const uint64_t kHoleNanInt64 = constexpr uint64_t kHoleNanInt64 =
(static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32; (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32;
// ES6 section 20.1.2.6 Number.MAX_SAFE_INTEGER // ES6 section 20.1.2.6 Number.MAX_SAFE_INTEGER
const double kMaxSafeInteger = 9007199254740991.0; // 2^53-1 constexpr double kMaxSafeInteger = 9007199254740991.0; // 2^53-1
// The order of this enum has to be kept in sync with the predicates below. // The order of this enum has to be kept in sync with the predicates below.
enum VariableMode : uint8_t { enum VariableMode : uint8_t {
......
...@@ -110,7 +110,7 @@ void HandleScope::DeleteExtensions(Isolate* isolate) { ...@@ -110,7 +110,7 @@ void HandleScope::DeleteExtensions(Isolate* isolate) {
void HandleScope::ZapRange(Object** start, Object** end) { void HandleScope::ZapRange(Object** start, Object** end) {
DCHECK_LE(end - start, kHandleBlockSize); DCHECK_LE(end - start, kHandleBlockSize);
for (Object** p = start; p != end; p++) { for (Object** p = start; p != end; p++) {
*reinterpret_cast<Address*>(p) = kHandleZapValue; *reinterpret_cast<Address*>(p) = reinterpret_cast<Address>(kHandleZapValue);
} }
} }
#endif #endif
......
...@@ -4945,7 +4945,8 @@ void Heap::ZapFromSpace() { ...@@ -4945,7 +4945,8 @@ void Heap::ZapFromSpace() {
PageRange(new_space_->FromSpaceStart(), new_space_->FromSpaceEnd())) { PageRange(new_space_->FromSpaceStart(), new_space_->FromSpaceEnd())) {
for (Address cursor = page->area_start(), limit = page->area_end(); for (Address cursor = page->area_start(), limit = page->area_end();
cursor < limit; cursor += kPointerSize) { cursor < limit; cursor += kPointerSize) {
Memory::Address_at(cursor) = kFromSpaceZapValue; Memory::Address_at(cursor) =
reinterpret_cast<Address>(kFromSpaceZapValue);
} }
} }
} }
......
...@@ -1106,7 +1106,7 @@ bool MemoryAllocator::UncommitBlock(Address start, size_t size) { ...@@ -1106,7 +1106,7 @@ bool MemoryAllocator::UncommitBlock(Address start, size_t size) {
void MemoryAllocator::ZapBlock(Address start, size_t size) { void MemoryAllocator::ZapBlock(Address start, size_t size) {
for (size_t s = 0; s + kPointerSize <= size; s += kPointerSize) { for (size_t s = 0; s + kPointerSize <= size; s += kPointerSize) {
Memory::Address_at(start + s) = kZapValue; Memory::Address_at(start + s) = reinterpret_cast<Address>(kZapValue);
} }
} }
......
...@@ -186,7 +186,8 @@ void MacroAssembler::PushAddress(ExternalReference source) { ...@@ -186,7 +186,8 @@ void MacroAssembler::PushAddress(ExternalReference source) {
int64_t address = reinterpret_cast<int64_t>(source.address()); int64_t address = reinterpret_cast<int64_t>(source.address());
if (is_int32(address) && !serializer_enabled()) { if (is_int32(address) && !serializer_enabled()) {
if (emit_debug_code()) { if (emit_debug_code()) {
Move(kScratchRegister, kZapValue, RelocInfo::NONE); Move(kScratchRegister, reinterpret_cast<Address>(kZapValue),
RelocInfo::NONE);
} }
Push(Immediate(static_cast<int32_t>(address))); Push(Immediate(static_cast<int32_t>(address)));
return; return;
...@@ -255,8 +256,8 @@ void MacroAssembler::RecordWriteField(Register object, int offset, ...@@ -255,8 +256,8 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag // Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors. // turned on to provoke errors.
if (emit_debug_code()) { if (emit_debug_code()) {
Move(value, kZapValue, RelocInfo::NONE); Move(value, reinterpret_cast<Address>(kZapValue), RelocInfo::NONE);
Move(dst, kZapValue, RelocInfo::NONE); Move(dst, reinterpret_cast<Address>(kZapValue), RelocInfo::NONE);
} }
} }
...@@ -386,8 +387,8 @@ void MacroAssembler::RecordWrite(Register object, Register address, ...@@ -386,8 +387,8 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag // Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors. // turned on to provoke errors.
if (emit_debug_code()) { if (emit_debug_code()) {
Move(address, kZapValue, RelocInfo::NONE); Move(address, reinterpret_cast<Address>(kZapValue), RelocInfo::NONE);
Move(value, kZapValue, RelocInfo::NONE); Move(value, reinterpret_cast<Address>(kZapValue), RelocInfo::NONE);
} }
} }
......
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