Avoid a compile error with 32-bit MSVC.

In CodeStubAssembler::TryToIntptr(), code inside an Is64() block is
compiled on 32-bit, but |kMaxSafeIntegerUint64| cannot fit in an
intptr_t. To avoid this error, guard the Is64() block with
V8_TARGET_ARCH_64_BIT.

Change-Id: I5d82e4f649172e6054a767cc263a42bc02f89e58
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1960906
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65420}
This commit is contained in:
Jakob Kummerow 2019-12-11 16:36:00 +01:00 committed by Commit Bot
parent 5f8e95c1a1
commit 0958dac2bb

View File

@ -9665,13 +9665,18 @@ TNode<IntPtrT> CodeStubAssembler::TryToIntptr(
TNode<IntPtrT> int_value = ChangeFloat64ToIntPtr(value);
GotoIfNot(Float64Equal(value, RoundIntPtrToFloat64(int_value)),
if_not_intptr);
if (Is64()) {
#if V8_TARGET_ARCH_64_BIT
// We can't rely on Is64() alone because 32-bit compilers rightly complain
// about kMaxSafeIntegerUint64 not fitting into an intptr_t.
DCHECK(Is64());
// TODO(jkummerow): Investigate whether we can drop support for
// negative indices.
GotoIfNot(IsInRange(int_value, static_cast<intptr_t>(-kMaxSafeInteger),
static_cast<intptr_t>(kMaxSafeIntegerUint64)),
if_not_intptr);
}
#else
DCHECK(!Is64());
#endif
var_intptr_key = int_value;
Goto(&done);
}