Lines Matching refs:BigInt
37 // accidental mutation of a BigInt after its construction. Step-by-step
38 // construction of a BigInt must happen in terms of MutableBigInt, the
43 // {BigInt} and {MutableBigInt} objects can be passed in.
47 static MaybeHandle<BigInt> MakeImmutable(MaybeHandle<MutableBigInt> maybe);
49 static Handle<BigInt> MakeImmutable(Handle<MutableBigInt> result);
58 static Handle<BigInt> NewFromInt(Isolate* isolate, int value);
59 static Handle<BigInt> NewFromDouble(Isolate* isolate, double value);
64 static Handle<BigInt> Zero(
66 // TODO(jkummerow): Consider caching a canonical zero-BigInt.
91 static MaybeHandle<BigInt> LeftShiftByAbsolute(Isolate* isolate,
94 static Handle<BigInt> RightShiftByAbsolute(Isolate* isolate,
97 static Handle<BigInt> RightShiftByMaximum(Isolate* isolate, bool sign);
139 "We must be able to call BigInt library functions");
174 // If the result of a BigInt computation is truncated to 64 bit, Turbofan
181 FATAL("Aborting on invalid BigInt length");
189 if (length > BigInt::kMaxLength) {
201 Handle<BigInt> MutableBigInt::NewFromInt(Isolate* isolate, int value) {
211 result->set_digit(0, static_cast<BigInt::digit_t>(kMaxInt) + 1);
219 Handle<BigInt> MutableBigInt::NewFromDouble(Isolate* isolate, double value) {
235 // We construct a BigInt from the double {value} by shifting its mantissa
290 // Allocating a BigInt of the same length as an existing BigInt cannot throw.
294 BigInt::SizeFor(length) - BigIntBase::kHeaderSize);
303 MaybeHandle<BigInt> MutableBigInt::MakeImmutable(
306 if (!maybe.ToHandle(&result)) return MaybeHandle<BigInt>();
311 Handle<BigInt> MutableBigInt::MakeImmutable(Handle<MutableBigInt> result) {
313 return Handle<BigInt>::cast(result);
324 Address new_end = result.address() + BigInt::SizeFor(new_length);
345 Handle<BigInt> BigInt::Zero(IsolateT* isolate, AllocationType allocation) {
348 template Handle<BigInt> BigInt::Zero(Isolate* isolate,
350 template Handle<BigInt> BigInt::Zero(LocalIsolate* isolate,
353 Handle<BigInt> BigInt::UnaryMinus(Isolate* isolate, Handle<BigInt> x) {
363 MaybeHandle<BigInt> BigInt::BitwiseNot(Isolate* isolate, Handle<BigInt> x) {
375 MaybeHandle<BigInt> BigInt::Exponentiate(Isolate* isolate, Handle<BigInt> base,
376 Handle<BigInt> exponent) {
381 BigInt);
387 // 3. Return a BigInt representing the mathematical value of base raised
402 return ThrowBigIntTooBig<BigInt>(isolate);
407 return ThrowBigIntTooBig<BigInt>(isolate);
416 return MaybeHandle<BigInt>();
426 Handle<BigInt> result;
427 Handle<BigInt> running_square = base;
432 MaybeHandle<BigInt> maybe_result =
447 MaybeHandle<BigInt> BigInt::Multiply(Isolate* isolate, Handle<BigInt> x,
448 Handle<BigInt> y) {
454 return MaybeHandle<BigInt>();
468 MaybeHandle<BigInt> BigInt::Divide(Isolate* isolate, Handle<BigInt> x,
469 Handle<BigInt> y) {
473 BigInt);
476 // 3. Return a BigInt representing quotient rounded towards 0 to the next
502 MaybeHandle<BigInt> BigInt::Remainder(Isolate* isolate, Handle<BigInt> x,
503 Handle<BigInt> y) {
507 BigInt);
509 // 2. Return the BigInt representing x modulo y.
530 MaybeHandle<BigInt> BigInt::Add(Isolate* isolate, Handle<BigInt> x,
531 Handle<BigInt> y) {
540 // Allocation fails when {result_length} exceeds the max BigInt size.
550 MaybeHandle<BigInt> BigInt::Subtract(Isolate* isolate, Handle<BigInt> x,
551 Handle<BigInt> y) {
560 // Allocation fails when {result_length} exceeds the max BigInt size.
570 MaybeHandle<BigInt> BigInt::LeftShift(Isolate* isolate, Handle<BigInt> x,
571 Handle<BigInt> y) {
577 MaybeHandle<BigInt> BigInt::SignedRightShift(Isolate* isolate, Handle<BigInt> x,
578 Handle<BigInt> y) {
584 MaybeHandle<BigInt> BigInt::UnsignedRightShift(Isolate* isolate,
585 Handle<BigInt> x,
586 Handle<BigInt> y) {
587 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kBigIntShr), BigInt);
613 ComparisonResult BigInt::CompareToBigInt(Handle<BigInt> x, Handle<BigInt> y) {
623 bool BigInt::EqualToBigInt(BigInt x, BigInt y) {
632 MaybeHandle<BigInt> BigInt::BitwiseAnd(Isolate* isolate, Handle<BigInt> x,
633 Handle<BigInt> y) {
661 MaybeHandle<BigInt> BigInt::BitwiseXor(Isolate* isolate, Handle<BigInt> x,
662 Handle<BigInt> y) {
691 MaybeHandle<BigInt> BigInt::BitwiseOr(Isolate* isolate, Handle<BigInt> x,
692 Handle<BigInt> y) {
712 MaybeHandle<BigInt> BigInt::Increment(Isolate* isolate, Handle<BigInt> x) {
723 MaybeHandle<BigInt> BigInt::Decrement(Isolate* isolate, Handle<BigInt> x) {
728 // TODO(jkummerow): Consider caching a canonical -1n BigInt.
736 Maybe<ComparisonResult> BigInt::CompareToString(Isolate* isolate,
737 Handle<BigInt> x,
740 MaybeHandle<BigInt> maybe_ny = StringToBigInt(isolate, y);
742 Handle<BigInt> ny;
750 // c. Return BigInt::lessThan(x, ny).
754 Maybe<bool> BigInt::EqualToString(Isolate* isolate, Handle<BigInt> x,
757 MaybeHandle<BigInt> maybe_n = StringToBigInt(isolate, y);
759 Handle<BigInt> n;
771 bool BigInt::EqualToNumber(Handle<BigInt> x, Handle<Object> y) {
779 // Any multi-digit BigInt is bigger than a Smi.
790 ComparisonResult BigInt::CompareToNumber(Handle<BigInt> x, Handle<Object> y) {
803 // Any multi-digit BigInt is bigger than a Smi.
818 ComparisonResult BigInt::CompareToDouble(Handle<BigInt> x, double y) {
862 // mantissa according to its exponent, so it will align with the BigInt {x},
924 MaybeHandle<String> BigInt::ToString(Isolate* isolate, Handle<BigInt> bigint,
961 // unavoidable, e.g. a 4-bit BigInt can be as big as "10" or as small as
1018 MaybeHandle<BigInt> BigInt::FromNumber(Isolate* isolate,
1028 BigInt);
1033 MaybeHandle<BigInt> BigInt::FromObject(Isolate* isolate, Handle<Object> obj) {
1039 BigInt);
1046 return Handle<BigInt>::cast(obj);
1049 Handle<BigInt> n;
1052 return MaybeHandle<BigInt>();
1067 BigInt);
1074 isolate, NewTypeError(MessageTemplate::kBigIntFromObject, obj), BigInt);
1077 Handle<Object> BigInt::ToNumber(Isolate* isolate, Handle<BigInt> x) {
1177 void BigInt::BigIntShortPrint(std::ostream& os) {
1192 // result, otherwise a new BigInt will be allocated for the result.
1193 // {result_storage} and {x} may refer to the same BigInt for in-place
1242 MaybeHandle<BigInt> MutableBigInt::LeftShiftByAbsolute(Isolate* isolate,
1247 return ThrowBigIntTooBig<BigInt>(isolate);
1253 return ThrowBigIntTooBig<BigInt>(isolate);
1257 return MaybeHandle<BigInt>();
1264 Handle<BigInt> MutableBigInt::RightShiftByAbsolute(Isolate* isolate,
1286 Handle<BigInt> MutableBigInt::RightShiftByMaximum(Isolate* isolate, bool sign) {
1288 // TODO(jkummerow): Consider caching a canonical -1n BigInt.
1296 // a BigInt, or Nothing otherwise.
1297 Maybe<BigInt::digit_t> MutableBigInt::ToShiftAmount(Handle<BigIntBase> x) {
1310 MaybeHandle<BigInt> BigInt::Allocate(IsolateT* isolate,
1326 template MaybeHandle<BigInt> BigInt::Allocate(Isolate*,
1329 template MaybeHandle<BigInt> BigInt::Allocate(LocalIsolate*,
1335 uint32_t BigInt::GetBitfieldForSerialization() const {
1344 int BigInt::DigitsByteLengthForBitfield(uint32_t bitfield) {
1350 void BigInt::SerializeDigits(uint8_t* storage) {
1369 MaybeHandle<BigInt> BigInt::FromSerializedDigits(
1411 Handle<BigInt> BigInt::AsIntN(Isolate* isolate, uint64_t n, Handle<BigInt> x) {
1425 MaybeHandle<BigInt> BigInt::AsUintN(Isolate* isolate, uint64_t n,
1426 Handle<BigInt> x) {
1432 return ThrowBigIntTooBig<BigInt>(isolate);
1449 Handle<BigInt> BigInt::FromInt64(Isolate* isolate, int64_t n) {
1471 Handle<BigInt> BigInt::FromUint64(Isolate* isolate, uint64_t n) {
1482 MaybeHandle<BigInt> BigInt::FromWords64(Isolate* isolate, int sign_bit,
1486 return ThrowBigIntTooBig<BigInt>(isolate);
1496 return MaybeHandle<BigInt>();
1516 int BigInt::Words64Count() {
1522 void BigInt::ToWordsArray64(int* sign_bit, int* words64_count,
1559 int64_t BigInt::AsInt64(bool* lossless) {
1566 uint64_t BigInt::AsUint64(bool* lossless) {
1585 PrintHeader(os, "BigInt");
1601 BigInt x = BigInt::cast(Object(x_addr));
1602 BigInt y = BigInt::cast(Object(y_addr));
1610 BigInt x = BigInt::cast(Object(x_addr));
1611 BigInt y = BigInt::cast(Object(y_addr));
1618 BigInt x = BigInt::cast(Object(x_addr));
1619 BigInt y = BigInt::cast(Object(y_addr));