Commit 3848a97e authored by Nico Hartmann's avatar Nico Hartmann Committed by Commit Bot

[TurboFan] Lower BigInt.asUintN to machine operations

Operations on BigInts, for which TurboFan statically knows that they
are no larger than 2^64, can be lowered to efficient machine code
in TurboFan. This is the first step in doing so by generating
efficient code for asUintN and the required checks and conversions.

Bug: v8:9407
Change-Id: I51f6505f6c4567434fa369fcf870a09871487f51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1680548
Commit-Queue: Nico Hartmann <nicohartmann@google.com>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62488}
parent b413ab64
......@@ -71,6 +71,15 @@ FieldAccess AccessBuilder::ForBigIntBitfield() {
return access;
}
// static
FieldAccess AccessBuilder::ForBigIntLeastSignificantDigit64() {
FieldAccess access = {
kTaggedBase, BigInt::kDigitsOffset, MaybeHandle<Name>(),
MaybeHandle<Map>(), TypeCache::Get()->kBigUint64, MachineType::Uint64(),
kNoWriteBarrier};
return access;
}
// static
FieldAccess AccessBuilder::ForJSObjectPropertiesOrHash() {
FieldAccess access = {
......
......@@ -42,6 +42,10 @@ class V8_EXPORT_PRIVATE AccessBuilder final
// Provides access to BigInt's bit field.
static FieldAccess ForBigIntBitfield();
// Provides access to BigInt's least significant digit on 64 bit
// architectures. Do not use this on 32 bit architectures.
static FieldAccess ForBigIntLeastSignificantDigit64();
// Provides access to JSObject::properties() field.
static FieldAccess ForJSObjectPropertiesOrHash();
......
......@@ -75,6 +75,7 @@ class EffectControlLinearizer {
Node* LowerCheckReceiver(Node* node, Node* frame_state);
Node* LowerCheckReceiverOrNullOrUndefined(Node* node, Node* frame_state);
Node* LowerCheckString(Node* node, Node* frame_state);
Node* LowerCheckBigInt(Node* node, Node* frame_state);
Node* LowerCheckSymbol(Node* node, Node* frame_state);
void LowerCheckIf(Node* node, Node* frame_state);
Node* LowerCheckedInt32Add(Node* node, Node* frame_state);
......@@ -101,7 +102,9 @@ class EffectControlLinearizer {
Node* LowerCheckedTaggedToFloat64(Node* node, Node* frame_state);
Node* LowerCheckedTaggedToTaggedSigned(Node* node, Node* frame_state);
Node* LowerCheckedTaggedToTaggedPointer(Node* node, Node* frame_state);
Node* LowerCheckedTaggedToBigInt(Node* node, Node* frame_state);
Node* LowerBigIntAsUintN(Node* node, Node* frame_state);
Node* LowerChangeUint64ToBigInt(Node* node);
Node* LowerTruncateBigIntToUint64(Node* node);
Node* LowerCheckedCompressedToTaggedSigned(Node* node, Node* frame_state);
Node* LowerCheckedCompressedToTaggedPointer(Node* node, Node* frame_state);
Node* LowerCheckedTaggedToCompressedSigned(Node* node, Node* frame_state);
......@@ -913,6 +916,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kCheckString:
result = LowerCheckString(node, frame_state);
break;
case IrOpcode::kCheckBigInt:
result = LowerCheckBigInt(node, frame_state);
break;
case IrOpcode::kCheckInternalizedString:
result = LowerCheckInternalizedString(node, frame_state);
break;
......@@ -995,8 +1001,14 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kCheckedTaggedToTaggedPointer:
result = LowerCheckedTaggedToTaggedPointer(node, frame_state);
break;
case IrOpcode::kCheckedTaggedToBigInt:
result = LowerCheckedTaggedToBigInt(node, frame_state);
case IrOpcode::kBigIntAsUintN:
result = LowerBigIntAsUintN(node, frame_state);
break;
case IrOpcode::kChangeUint64ToBigInt:
result = LowerChangeUint64ToBigInt(node);
break;
case IrOpcode::kTruncateBigIntToUint64:
result = LowerTruncateBigIntToUint64(node);
break;
case IrOpcode::kCheckedCompressedToTaggedSigned:
result = LowerCheckedCompressedToTaggedSigned(node, frame_state);
......@@ -2659,8 +2671,7 @@ Node* EffectControlLinearizer::LowerCheckedTaggedToTaggedPointer(
return value;
}
Node* EffectControlLinearizer::LowerCheckedTaggedToBigInt(Node* node,
Node* frame_state) {
Node* EffectControlLinearizer::LowerCheckBigInt(Node* node, Node* frame_state) {
Node* value = node->InputAt(0);
const CheckParameters& params = CheckParametersOf(node->op());
......@@ -2678,6 +2689,93 @@ Node* EffectControlLinearizer::LowerCheckedTaggedToBigInt(Node* node,
return value;
}
Node* EffectControlLinearizer::LowerBigIntAsUintN(Node* node,
Node* frame_state) {
DCHECK(machine()->Is64());
const int bits = OpParameter<int>(node->op());
DCHECK(0 <= bits && bits <= 64);
if (bits == 64) {
// Reduce to nop.
return node->InputAt(0);
} else {
const uint64_t msk = (1ULL << bits) - 1ULL;
return __ Word64And(node->InputAt(0), __ Int64Constant(msk));
}
}
Node* EffectControlLinearizer::LowerChangeUint64ToBigInt(Node* node) {
DCHECK(machine()->Is64());
Node* value = node->InputAt(0);
Node* map = jsgraph()->HeapConstant(factory()->bigint_map());
// BigInts with value 0 must be of size 0 (canonical form).
auto if_zerodigits = __ MakeLabel();
auto if_onedigit = __ MakeLabel();
auto done = __ MakeLabel(MachineRepresentation::kTagged);
__ GotoIf(__ Word64Equal(value, __ IntPtrConstant(0)), &if_zerodigits);
__ Goto(&if_onedigit);
__ Bind(&if_onedigit);
{
Node* result = __ Allocate(AllocationType::kYoung,
__ IntPtrConstant(BigInt::SizeFor(1)));
const auto bitfield = BigInt::LengthBits::update(0, 1);
__ StoreField(AccessBuilder::ForMap(), result, map);
__ StoreField(AccessBuilder::ForBigIntBitfield(), result,
__ IntPtrConstant(bitfield));
__ StoreField(AccessBuilder::ForBigIntLeastSignificantDigit64(), result,
value);
__ Goto(&done, result);
}
__ Bind(&if_zerodigits);
{
Node* result = __ Allocate(AllocationType::kYoung,
__ IntPtrConstant(BigInt::SizeFor(0)));
const auto bitfield = BigInt::LengthBits::update(0, 0);
__ StoreField(AccessBuilder::ForMap(), result, map);
__ StoreField(AccessBuilder::ForBigIntBitfield(), result,
__ IntPtrConstant(bitfield));
__ Goto(&done, result);
}
__ Bind(&done);
return done.PhiAt(0);
}
Node* EffectControlLinearizer::LowerTruncateBigIntToUint64(Node* node) {
DCHECK(machine()->Is64());
auto done = __ MakeLabel(MachineRepresentation::kWord64);
auto if_neg = __ MakeLabel();
auto if_not_zero = __ MakeLabel();
Node* value = node->InputAt(0);
Node* bitfield = __ LoadField(AccessBuilder::ForBigIntBitfield(), value);
__ GotoIfNot(__ Word32Equal(bitfield, __ Int32Constant(0)), &if_not_zero);
__ Goto(&done, __ Int64Constant(0));
__ Bind(&if_not_zero);
{
Node* lsd =
__ LoadField(AccessBuilder::ForBigIntLeastSignificantDigit64(), value);
Node* sign =
__ Word32And(bitfield, __ Int32Constant(BigInt::SignBits::kMask));
__ GotoIf(__ Word32Equal(sign, __ Int32Constant(1)), &if_neg);
__ Goto(&done, lsd);
__ Bind(&if_neg);
__ Goto(&done, __ Int64Sub(__ Int64Constant(0), lsd));
}
__ Bind(&done);
return done.PhiAt(0);
}
Node* EffectControlLinearizer::LowerCheckedCompressedToTaggedSigned(
Node* node, Node* frame_state) {
Node* value = node->InputAt(0);
......
......@@ -57,6 +57,7 @@ namespace compiler {
V(Word32Shr) \
V(Word32Shl) \
V(Word32Sar) \
V(Word64And) \
V(IntAdd) \
V(IntSub) \
V(IntMul) \
......@@ -71,6 +72,7 @@ namespace compiler {
V(Uint64LessThan) \
V(Uint64LessThanOrEqual) \
V(Int32LessThan) \
V(Int64Sub) \
V(Float64Add) \
V(Float64Sub) \
V(Float64Div) \
......
......@@ -3761,6 +3761,8 @@ Reduction JSCallReducer::ReduceJSCall(Node* node,
return ReduceDateNow(node);
case Builtins::kNumberConstructor:
return ReduceNumberConstructor(node);
case Builtins::kBigIntAsUintN:
return ReduceBigIntAsUintN(node);
default:
break;
}
......@@ -7225,6 +7227,37 @@ Reduction JSCallReducer::ReduceNumberConstructor(Node* node) {
return Changed(node);
}
Reduction JSCallReducer::ReduceBigIntAsUintN(Node* node) {
if (!jsgraph()->machine()->Is64()) {
return NoChange();
}
CallParameters const& p = CallParametersOf(node->op());
if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) {
return NoChange();
}
if (node->op()->ValueInputCount() < 3) {
return NoChange();
}
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* bits = NodeProperties::GetValueInput(node, 2);
Node* value = NodeProperties::GetValueInput(node, 3);
NumberMatcher matcher(bits);
if (matcher.IsInteger() && matcher.IsInRange(0, 64)) {
const int bits_value = static_cast<int>(matcher.Value());
value = effect = graph()->NewNode(simplified()->CheckBigInt(p.feedback()),
value, effect, control);
value = graph()->NewNode(simplified()->BigIntAsUintN(bits_value), value);
ReplaceWithValue(node, value, effect);
return Replace(value);
}
return NoChange();
}
Graph* JSCallReducer::graph() const { return jsgraph()->graph(); }
Isolate* JSCallReducer::isolate() const { return jsgraph()->isolate(); }
......
......@@ -192,6 +192,7 @@ class V8_EXPORT_PRIVATE JSCallReducer final : public AdvancedReducer {
Reduction ReduceNumberParseInt(Node* node);
Reduction ReduceNumberConstructor(Node* node);
Reduction ReduceBigIntAsUintN(Node* node);
// Helper to verify promise receiver maps are as expected.
// On bailout from a reduction, be sure to return inference.NoChange().
......
......@@ -250,6 +250,8 @@
V(ChangeFloat64ToTaggedPointer) \
V(ChangeTaggedToBit) \
V(ChangeBitToTagged) \
V(ChangeUint64ToBigInt) \
V(TruncateBigIntToUint64) \
V(TruncateTaggedToWord32) \
V(TruncateTaggedToFloat64) \
V(TruncateTaggedToBit) \
......@@ -281,7 +283,6 @@
V(CheckedTaggedToInt64) \
V(CheckedTaggedToTaggedSigned) \
V(CheckedTaggedToTaggedPointer) \
V(CheckedTaggedToBigInt) \
V(CheckedCompressedToTaggedSigned) \
V(CheckedCompressedToTaggedPointer) \
V(CheckedTaggedToCompressedSigned) \
......@@ -371,6 +372,10 @@
V(NumberToUint8Clamped) \
V(NumberSilenceNaN)
#define SIMPLIFIED_BIGINT_UNOP_LIST(V) \
V(BigIntAsUintN) \
V(CheckBigInt)
#define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) V(SpeculativeToNumber)
#define SIMPLIFIED_OTHER_OP_LIST(V) \
......@@ -474,6 +479,7 @@
SIMPLIFIED_NUMBER_BINOP_LIST(V) \
SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
SIMPLIFIED_NUMBER_UNOP_LIST(V) \
SIMPLIFIED_BIGINT_UNOP_LIST(V) \
SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) \
SIMPLIFIED_SPECULATIVE_BIGINT_BINOP_LIST(V) \
SIMPLIFIED_OTHER_OP_LIST(V)
......
......@@ -578,6 +578,13 @@ Type OperationTyper::NumberSilenceNaN(Type type) {
return type;
}
Type OperationTyper::BigIntAsUintN(Type type) {
DCHECK(type.Is(Type::BigInt()));
return Type::BigInt();
}
Type OperationTyper::CheckBigInt(Type type) { return Type::BigInt(); }
Type OperationTyper::NumberAdd(Type lhs, Type rhs) {
DCHECK(lhs.Is(Type::Number()));
DCHECK(rhs.Is(Type::Number()));
......
......@@ -43,6 +43,7 @@ class V8_EXPORT_PRIVATE OperationTyper {
// Unary operators.
#define DECLARE_METHOD(Name) Type Name(Type type);
SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD)
SIMPLIFIED_BIGINT_UNOP_LIST(DECLARE_METHOD)
SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_METHOD)
DECLARE_METHOD(ConvertReceiver)
#undef DECLARE_METHOD
......
......@@ -147,6 +147,7 @@ bool CheckSubsumes(Node const* a, Node const* b) {
case IrOpcode::kCheckSmi:
case IrOpcode::kCheckString:
case IrOpcode::kCheckNumber:
case IrOpcode::kCheckBigInt:
break;
case IrOpcode::kCheckedInt32ToTaggedSigned:
case IrOpcode::kCheckedInt64ToInt32:
......@@ -158,7 +159,6 @@ bool CheckSubsumes(Node const* a, Node const* b) {
case IrOpcode::kCheckedCompressedToTaggedSigned:
case IrOpcode::kCheckedTaggedToCompressedPointer:
case IrOpcode::kCheckedTaggedToCompressedSigned:
case IrOpcode::kCheckedTaggedToBigInt:
case IrOpcode::kCheckedUint32Bounds:
case IrOpcode::kCheckedUint32ToInt32:
case IrOpcode::kCheckedUint32ToTaggedSigned:
......
......@@ -25,6 +25,8 @@ const char* Truncation::description() const {
return "truncate-to-bool";
case TruncationKind::kWord32:
return "truncate-to-word32";
case TruncationKind::kWord64:
return "truncate-to-word64";
case TruncationKind::kOddballAndBigIntToNumber:
switch (identify_zeros()) {
case kIdentifyZeros:
......@@ -51,6 +53,9 @@ const char* Truncation::description() const {
// kOddballAndBigIntToNumber |
// ^ |
// / |
// kWord64 |
// ^ |
// | |
// kWord32 kBool
// ^ ^
// \ /
......@@ -101,6 +106,11 @@ bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) {
return rep2 == TruncationKind::kBool || rep2 == TruncationKind::kAny;
case TruncationKind::kWord32:
return rep2 == TruncationKind::kWord32 ||
rep2 == TruncationKind::kWord64 ||
rep2 == TruncationKind::kOddballAndBigIntToNumber ||
rep2 == TruncationKind::kAny;
case TruncationKind::kWord64:
return rep2 == TruncationKind::kWord64 ||
rep2 == TruncationKind::kOddballAndBigIntToNumber ||
rep2 == TruncationKind::kAny;
case TruncationKind::kOddballAndBigIntToNumber:
......@@ -210,7 +220,8 @@ Node* RepresentationChanger::GetRepresentationFor(
use_info);
case MachineRepresentation::kWord64:
DCHECK(use_info.type_check() == TypeCheckKind::kNone ||
use_info.type_check() == TypeCheckKind::kSigned64);
use_info.type_check() == TypeCheckKind::kSigned64 ||
use_info.type_check() == TypeCheckKind::kBigInt);
return GetWord64RepresentationFor(node, output_rep, output_type, use_node,
use_info);
case MachineRepresentation::kSimd128:
......@@ -455,7 +466,7 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor(
if (IsAnyCompressed(output_rep)) {
node = InsertChangeCompressedToTagged(node);
}
op = simplified()->CheckedTaggedToBigInt(use_info.feedback());
op = simplified()->CheckBigInt(use_info.feedback());
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
op = machine()->ChangeCompressedPointerToTaggedPointer();
} else if (CanBeCompressedSigned(output_rep) &&
......@@ -545,6 +556,9 @@ Node* RepresentationChanger::GetTaggedRepresentationFor(
} else if (output_type.Is(cache_->kSafeInteger)) {
// int64 -> tagged
op = simplified()->ChangeInt64ToTagged();
} else if (output_type.Is(Type::BigInt())) {
// uint64 -> BigInt
op = simplified()->ChangeUint64ToBigInt();
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kTagged);
......@@ -1341,6 +1355,12 @@ Node* RepresentationChanger::GetWord64RepresentationFor(
return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord64);
}
} else if ((IsAnyTagged(output_rep) || IsAnyCompressed(output_rep)) &&
output_type.Is(Type::BigInt())) {
if (IsAnyCompressed(output_rep)) {
node = InsertChangeCompressedToTagged(node);
}
op = simplified()->TruncateBigIntToUint64();
} else if (CanBeTaggedPointer(output_rep)) {
if (output_type.Is(cache_->kInt64)) {
op = simplified()->ChangeTaggedToInt64();
......
......@@ -29,6 +29,9 @@ class Truncation final {
static Truncation Word32() {
return Truncation(TruncationKind::kWord32, kIdentifyZeros);
}
static Truncation Word64() {
return Truncation(TruncationKind::kWord64, kIdentifyZeros);
}
static Truncation OddballAndBigIntToNumber(
IdentifyZeros identify_zeros = kDistinguishZeros) {
return Truncation(TruncationKind::kOddballAndBigIntToNumber,
......@@ -52,6 +55,9 @@ class Truncation final {
bool IsUsedAsWord32() const {
return LessGeneral(kind_, TruncationKind::kWord32);
}
bool IsUsedAsWord64() const {
return LessGeneral(kind_, TruncationKind::kWord64);
}
bool TruncatesOddballAndBigIntToNumber() const {
return LessGeneral(kind_, TruncationKind::kOddballAndBigIntToNumber);
}
......@@ -83,6 +89,7 @@ class Truncation final {
kNone,
kBool,
kWord32,
kWord64,
kOddballAndBigIntToNumber,
kAny
};
......@@ -166,6 +173,10 @@ class UseInfo {
static UseInfo TruncatingWord32() {
return UseInfo(MachineRepresentation::kWord32, Truncation::Word32());
}
static UseInfo TruncatedBigIntAsWord64() {
return UseInfo(MachineRepresentation::kWord64, Truncation::Word64(),
TypeCheckKind::kBigInt);
}
static UseInfo Word64() {
return UseInfo(MachineRepresentation::kWord64, Truncation::Any());
}
......
......@@ -970,6 +970,8 @@ class RepresentationSelector {
return MachineRepresentation::kTagged;
} else if (type.Is(Type::Number())) {
return MachineRepresentation::kFloat64;
} else if (type.Is(Type::BigInt()) && use.IsUsedAsWord64()) {
return MachineRepresentation::kWord64;
} else if (type.Is(Type::ExternalPointer())) {
return MachineType::PointerRepresentation();
}
......@@ -2465,6 +2467,20 @@ class RepresentationSelector {
}
return;
}
case IrOpcode::kCheckBigInt: {
if (InputIs(node, Type::BigInt())) {
VisitNoop(node, truncation);
} else {
VisitUnop(node, UseInfo::AnyTagged(),
MachineRepresentation::kTaggedPointer);
}
return;
}
case IrOpcode::kBigIntAsUintN: {
ProcessInput(node, 0, UseInfo::TruncatedBigIntAsWord64());
SetOutput(node, MachineRepresentation::kWord64, Type::BigInt());
return;
}
case IrOpcode::kNumberAcos:
case IrOpcode::kNumberAcosh:
case IrOpcode::kNumberAsin:
......
......@@ -761,6 +761,8 @@ bool operator==(CheckMinusZeroParameters const& lhs,
V(ChangeUint64ToTagged, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToBit, Operator::kNoProperties, 1, 0) \
V(ChangeBitToTagged, Operator::kNoProperties, 1, 0) \
V(TruncateBigIntToUint64, Operator::kNoProperties, 1, 0) \
V(ChangeUint64ToBigInt, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedToBit, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedPointerToBit, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedToWord32, Operator::kNoProperties, 1, 0) \
......@@ -832,6 +834,7 @@ bool operator==(CheckMinusZeroParameters const& lhs,
V(CheckNumber, 1, 1) \
V(CheckSmi, 1, 1) \
V(CheckString, 1, 1) \
V(CheckBigInt, 1, 1) \
V(CheckedInt32ToTaggedSigned, 1, 1) \
V(CheckedInt64ToInt32, 1, 1) \
V(CheckedInt64ToTaggedSigned, 1, 1) \
......@@ -840,7 +843,6 @@ bool operator==(CheckMinusZeroParameters const& lhs,
V(CheckedTaggedToTaggedSigned, 1, 1) \
V(CheckedCompressedToTaggedPointer, 1, 1) \
V(CheckedCompressedToTaggedSigned, 1, 1) \
V(CheckedTaggedToBigInt, 1, 1) \
V(CheckedTaggedToCompressedPointer, 1, 1) \
V(CheckedTaggedToCompressedSigned, 1, 1) \
V(CheckedUint32ToInt32, 1, 1) \
......@@ -1268,6 +1270,13 @@ const Operator* SimplifiedOperatorBuilder::RuntimeAbort(AbortReason reason) {
static_cast<int>(reason)); // parameter
}
const Operator* SimplifiedOperatorBuilder::BigIntAsUintN(int bits) {
CHECK(0 <= bits && bits <= 64);
return new (zone()) Operator1<int>(IrOpcode::kBigIntAsUintN, Operator::kPure,
"BigIntAsUintN", 1, 0, 0, 1, 0, 0, bits);
}
const Operator* SimplifiedOperatorBuilder::CheckIf(
DeoptimizeReason reason, const VectorSlotPair& feedback) {
if (!feedback.IsValid()) {
......
......@@ -682,6 +682,7 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* SpeculativeBigIntAdd(BigIntOperationHint hint,
const VectorSlotPair& feedback);
const Operator* BigIntAsUintN(int bits);
const Operator* ReferenceEqual();
const Operator* SameValue();
......@@ -734,6 +735,8 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* ChangeFloat64ToTaggedPointer();
const Operator* ChangeTaggedToBit();
const Operator* ChangeBitToTagged();
const Operator* TruncateBigIntToUint64();
const Operator* ChangeUint64ToBigInt();
const Operator* TruncateTaggedToWord32();
const Operator* TruncateTaggedToFloat64();
const Operator* TruncateTaggedToBit();
......@@ -782,7 +785,7 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const VectorSlotPair& feedback);
const Operator* CheckedTaggedToTaggedPointer(const VectorSlotPair& feedback);
const Operator* CheckedTaggedToTaggedSigned(const VectorSlotPair& feedback);
const Operator* CheckedTaggedToBigInt(const VectorSlotPair& feedback);
const Operator* CheckBigInt(const VectorSlotPair& feedback);
const Operator* CheckedCompressedToTaggedPointer(
const VectorSlotPair& feedback);
const Operator* CheckedCompressedToTaggedSigned(
......
......@@ -99,6 +99,7 @@ class Typer::Visitor : public Reducer {
case IrOpcode::k##x: \
return UpdateType(node, TypeUnaryOp(node, x));
SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE)
SIMPLIFIED_BIGINT_UNOP_LIST(DECLARE_CASE)
SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_CASE)
#undef DECLARE_CASE
......@@ -166,6 +167,7 @@ class Typer::Visitor : public Reducer {
case IrOpcode::k##x: \
return TypeUnaryOp(node, x);
SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE)
SIMPLIFIED_BIGINT_UNOP_LIST(DECLARE_CASE)
SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_CASE)
#undef DECLARE_CASE
......@@ -278,6 +280,7 @@ class Typer::Visitor : public Reducer {
return t->operation_typer_.Name(type); \
}
SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD)
SIMPLIFIED_BIGINT_UNOP_LIST(DECLARE_METHOD)
SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_METHOD)
#undef DECLARE_METHOD
#define DECLARE_METHOD(Name) \
......
......@@ -979,6 +979,10 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
case IrOpcode::kSpeculativeBigIntAdd:
CheckTypeIs(node, Type::BigInt());
break;
case IrOpcode::kBigIntAsUintN:
CheckValueInputIs(node, 0, Type::BigInt());
CheckTypeIs(node, Type::BigInt());
break;
case IrOpcode::kNumberAdd:
case IrOpcode::kNumberSubtract:
case IrOpcode::kNumberMultiply:
......@@ -1433,6 +1437,14 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
// CheckTypeIs(node, to));
break;
}
case IrOpcode::kTruncateBigIntToUint64:
CheckValueInputIs(node, 0, Type::BigInt());
CheckTypeIs(node, Type::BigInt());
break;
case IrOpcode::kChangeUint64ToBigInt:
CheckValueInputIs(node, 0, Type::BigInt());
CheckTypeIs(node, Type::BigInt());
break;
case IrOpcode::kTruncateTaggedToBit:
case IrOpcode::kTruncateTaggedPointerToBit:
break;
......@@ -1525,10 +1537,6 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
case IrOpcode::kCheckedTaggedToCompressedPointer:
case IrOpcode::kCheckedTruncateTaggedToWord32:
break;
case IrOpcode::kCheckedTaggedToBigInt:
CheckValueInputIs(node, 0, Type::Any());
CheckTypeIs(node, Type::BigInt());
break;
case IrOpcode::kCheckFloat64Hole:
CheckValueInputIs(node, 0, Type::NumberOrHole());
......@@ -1627,6 +1635,10 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CHECK_EQ(0, value_count);
CheckTypeIs(node, Type::Number());
break;
case IrOpcode::kCheckBigInt:
CheckValueInputIs(node, 0, Type::Any());
CheckTypeIs(node, Type::BigInt());
break;
// Machine operators
// -----------------------
......
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