Commit 0e3b984e authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

[TurboFan] Add BigInt support to %VerifyType

This CL adds handling of the BigInt types to TurbofanType to allow
verification of BigInt values in %VerifyType.

Change-Id: I1fc6dea16cbff4d22cfbb5483c5dee50fa932f75
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3256687Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79169}
parent 89a21b68
......@@ -4,6 +4,11 @@
#include "src/objects/turbofan-types.h"
const kMaxIntPtr: constexpr IntegerLiteral
generates 'IntegerLiteral(ca_.Is64() ? 0x7FFFFFFFFFFFFFFF : 0x7FFFFFFF)';
const kMinIntPtr: constexpr IntegerLiteral
generates 'IntegerLiteral(ca_.Is64() ? 0x8000000000000000 : 0x80000000)';
@export
@abstract
class TurbofanType extends HeapObject {
......@@ -154,11 +159,37 @@ macro TestTurbofanBitsetType(
case (JSArray): {
return bitsetLow.array;
}
case (BigInt): {
// TODO (tebbi): Distinguish different BigInt types.
return bitsetLow.unsigned_big_int_63 |
bitsetLow.other_unsigned_big_int_64 | bitsetLow.negative_big_int_63 |
bitsetLow.other_big_int;
case (bi: BigInt): {
dcheck(!bitsetLow.other_big_int || bitsetLow.other_unsigned_big_int_64);
dcheck(!bitsetLow.other_big_int || bitsetLow.negative_big_int_63);
dcheck(
!bitsetLow.other_unsigned_big_int_64 ||
bitsetLow.unsigned_big_int_63);
dcheck(!bitsetLow.negative_big_int_63 || bitsetLow.unsigned_big_int_63);
// On 32 bit architectures, [Un]signedBigInt64 types are not used, yet.
if (!Is64()) {
return bitsetLow.other_big_int;
}
const length = bigint::ReadBigIntLength(bi);
if (length > 1) {
return bitsetLow.other_big_int;
} else if (length == 0) {
return bitsetLow.unsigned_big_int_63;
}
dcheck(length == 1);
const sign = bigint::ReadBigIntSign(bi);
const digit = bigint::LoadBigIntDigit(bi, 0);
if (sign == bigint::kPositiveSign) {
return bitsetLow.other_unsigned_big_int_64 ||
(digit <= Convert<uintptr>(kMaxIntPtr) &&
bitsetLow.unsigned_big_int_63);
} else {
return bitsetLow.other_big_int ||
(digit <= Convert<uintptr>(kMinIntPtr) &&
bitsetLow.negative_big_int_63);
}
}
case (object: JSObject): {
if (object.map.IsUndetectable()) {
......
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