Commit aa3aaa76 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[offthread] OffThreadFactory support for BigInt

This CL templatizes some methods in BigInt on the Isolate type, to allow
BigInts to be allocated off-thread from a BigInt literal.

A necessary side-effect is exporting the Isolate class in its entirety,
to allow it to be used as a specializing type for ' HandleFor' in
unittests.

Bug: chromium:1011762
Change-Id: I768f9e4d46a4532d6818d9a67c13801bc5952e5d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2036079
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66105}
parent e9559993
This diff is collapsed.
...@@ -173,6 +173,19 @@ HandleFor<Impl, String> FactoryBase<Impl>::NewConsString( ...@@ -173,6 +173,19 @@ HandleFor<Impl, String> FactoryBase<Impl>::NewConsString(
return result; return result;
} }
template <typename Impl>
HandleFor<Impl, FreshlyAllocatedBigInt> FactoryBase<Impl>::NewBigInt(
int length, AllocationType allocation) {
if (length < 0 || length > BigInt::kMaxLength) {
isolate()->FatalProcessOutOfHeapMemory("invalid BigInt length");
}
HeapObject result = AllocateRawWithImmortalMap(
BigInt::SizeFor(length), allocation, read_only_roots().bigint_map());
FreshlyAllocatedBigInt bigint = FreshlyAllocatedBigInt::cast(result);
bigint.clear_padding();
return handle(bigint, isolate());
}
template <typename Impl> template <typename Impl>
HandleFor<Impl, SeqOneByteString> HandleFor<Impl, SeqOneByteString>
FactoryBase<Impl>::AllocateRawOneByteInternalizedString(int length, FactoryBase<Impl>::AllocateRawOneByteInternalizedString(int length,
......
...@@ -15,6 +15,7 @@ namespace internal { ...@@ -15,6 +15,7 @@ namespace internal {
class HeapObject; class HeapObject;
class SeqOneByteString; class SeqOneByteString;
class SeqTwoByteString; class SeqTwoByteString;
class FreshlyAllocatedBigInt;
template <typename Impl> template <typename Impl>
class V8_EXPORT_PRIVATE FactoryBase { class V8_EXPORT_PRIVATE FactoryBase {
...@@ -47,6 +48,11 @@ class V8_EXPORT_PRIVATE FactoryBase { ...@@ -47,6 +48,11 @@ class V8_EXPORT_PRIVATE FactoryBase {
HandleFor<Impl, String> left, HandleFor<Impl, String> right, int length, HandleFor<Impl, String> left, HandleFor<Impl, String> right, int length,
bool one_byte, AllocationType allocation = AllocationType::kYoung); bool one_byte, AllocationType allocation = AllocationType::kYoung);
// Allocates a new BigInt with {length} digits. Only to be used by
// MutableBigInt::New*.
HandleFor<Impl, FreshlyAllocatedBigInt> NewBigInt(
int length, AllocationType allocation = AllocationType::kYoung);
protected: protected:
HeapObject AllocateRawWithImmortalMap( HeapObject AllocateRawWithImmortalMap(
int size, AllocationType allocation, Map map, int size, AllocationType allocation, Map map,
......
...@@ -2071,18 +2071,6 @@ Handle<HeapNumber> Factory::NewHeapNumberForCodeAssembler(double value) { ...@@ -2071,18 +2071,6 @@ Handle<HeapNumber> Factory::NewHeapNumberForCodeAssembler(double value) {
: NewHeapNumber<AllocationType::kOld>(value); : NewHeapNumber<AllocationType::kOld>(value);
} }
Handle<FreshlyAllocatedBigInt> Factory::NewBigInt(int length,
AllocationType allocation) {
if (length < 0 || length > BigInt::kMaxLength) {
isolate()->heap()->FatalProcessOutOfMemory("invalid BigInt length");
}
HeapObject result = AllocateRawWithImmortalMap(BigInt::SizeFor(length),
allocation, *bigint_map());
FreshlyAllocatedBigInt bigint = FreshlyAllocatedBigInt::cast(result);
bigint.clear_padding();
return handle(bigint, isolate());
}
Handle<JSObject> Factory::NewError(Handle<JSFunction> constructor, Handle<JSObject> Factory::NewError(Handle<JSFunction> constructor,
MessageTemplate template_index, MessageTemplate template_index,
Handle<Object> arg0, Handle<Object> arg1, Handle<Object> arg0, Handle<Object> arg1,
......
...@@ -113,7 +113,7 @@ struct HandleTraits<Factory> { ...@@ -113,7 +113,7 @@ struct HandleTraits<Factory> {
template <typename T> template <typename T>
using HandleType = Handle<T>; using HandleType = Handle<T>;
template <typename T> template <typename T>
using MaybeHandleType = v8::internal::MaybeHandle<T>; using MaybeHandleType = MaybeHandle<T>;
}; };
// Interface for handle based allocation. // Interface for handle based allocation.
...@@ -556,11 +556,6 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -556,11 +556,6 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
inline Handle<HeapNumber> NewHeapNumberWithHoleNaN(); inline Handle<HeapNumber> NewHeapNumberWithHoleNaN();
// Allocates a new BigInt with {length} digits. Only to be used by
// MutableBigInt::New*.
Handle<FreshlyAllocatedBigInt> NewBigInt(
int length, AllocationType allocation = AllocationType::kYoung);
Handle<JSObject> NewArgumentsObject(Handle<JSFunction> callee, int length); Handle<JSObject> NewArgumentsObject(Handle<JSFunction> callee, int length);
// Allocates and initializes a new JavaScript object based on a // Allocates and initializes a new JavaScript object based on a
......
...@@ -162,11 +162,6 @@ void OffThreadFactory::Publish(Isolate* isolate) { ...@@ -162,11 +162,6 @@ void OffThreadFactory::Publish(Isolate* isolate) {
} }
} }
OffThreadHandle<Object> OffThreadFactory::NewInvalidStringLengthError() {
// TODO(leszeks): Implement.
UNREACHABLE();
}
// Hacky method for creating a simple object with a slot pointing to a string. // Hacky method for creating a simple object with a slot pointing to a string.
// TODO(leszeks): Remove once we have full FixedArray support. // TODO(leszeks): Remove once we have full FixedArray support.
OffThreadHandle<FixedArray> OffThreadFactory::StringWrapperForTest( OffThreadHandle<FixedArray> OffThreadFactory::StringWrapperForTest(
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "src/base/logging.h"
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/handles/handles.h" #include "src/handles/handles.h"
#include "src/heap/factory-base.h" #include "src/heap/factory-base.h"
...@@ -59,7 +60,12 @@ class V8_EXPORT_PRIVATE OffThreadFactory ...@@ -59,7 +60,12 @@ class V8_EXPORT_PRIVATE OffThreadFactory
void FinishOffThread(); void FinishOffThread();
void Publish(Isolate* isolate); void Publish(Isolate* isolate);
OffThreadHandle<Object> NewInvalidStringLengthError(); // The parser shouldn't allow the OffThreadFactory to get into a state where
// it generates errors.
OffThreadHandle<Object> NewInvalidStringLengthError() { UNREACHABLE(); }
OffThreadHandle<Object> NewRangeError(MessageTemplate template_index) {
UNREACHABLE();
}
OffThreadHandle<FixedArray> StringWrapperForTest( OffThreadHandle<FixedArray> StringWrapperForTest(
OffThreadHandle<String> string); OffThreadHandle<String> string);
......
This diff is collapsed.
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
#ifndef V8_NUMBERS_CONVERSIONS_H_ #ifndef V8_NUMBERS_CONVERSIONS_H_
#define V8_NUMBERS_CONVERSIONS_H_ #define V8_NUMBERS_CONVERSIONS_H_
#include "src/base/export-template.h"
#include "src/base/logging.h" #include "src/base/logging.h"
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/handles/handle-for.h"
#include "src/utils/vector.h" #include "src/utils/vector.h"
namespace v8 { namespace v8 {
...@@ -99,8 +101,10 @@ MaybeHandle<BigInt> StringToBigInt(Isolate* isolate, Handle<String> string); ...@@ -99,8 +101,10 @@ MaybeHandle<BigInt> StringToBigInt(Isolate* isolate, Handle<String> string);
// 0x -> hex // 0x -> hex
// 0o -> octal // 0o -> octal
// 0b -> binary // 0b -> binary
V8_EXPORT_PRIVATE MaybeHandle<BigInt> BigIntLiteral(Isolate* isolate, template <typename Isolate>
const char* string); EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
MaybeHandleFor<Isolate, BigInt> BigIntLiteral(Isolate* isolate,
const char* string);
const int kDoubleToCStringMinBufferSize = 100; const int kDoubleToCStringMinBufferSize = 100;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "src/objects/bigint.h" #include "src/objects/bigint.h"
#include "src/execution/isolate-inl.h" #include "src/execution/isolate-inl.h"
#include "src/execution/off-thread-isolate.h"
#include "src/heap/factory.h" #include "src/heap/factory.h"
#include "src/heap/heap-write-barrier-inl.h" #include "src/heap/heap-write-barrier-inl.h"
#include "src/numbers/conversions.h" #include "src/numbers/conversions.h"
...@@ -44,12 +45,15 @@ class MutableBigInt : public FreshlyAllocatedBigInt { ...@@ -44,12 +45,15 @@ class MutableBigInt : public FreshlyAllocatedBigInt {
public: public:
// Bottleneck for converting MutableBigInts to BigInts. // Bottleneck for converting MutableBigInts to BigInts.
static MaybeHandle<BigInt> MakeImmutable(MaybeHandle<MutableBigInt> maybe); static MaybeHandle<BigInt> MakeImmutable(MaybeHandle<MutableBigInt> maybe);
static Handle<BigInt> MakeImmutable(Handle<MutableBigInt> result); template <typename Isolate = v8::internal::Isolate>
static HandleFor<Isolate, BigInt> MakeImmutable(
HandleFor<Isolate, MutableBigInt> result);
static void Canonicalize(MutableBigInt result); static void Canonicalize(MutableBigInt result);
// Allocation helpers. // Allocation helpers.
static MaybeHandle<MutableBigInt> New( template <typename Isolate>
static MaybeHandleFor<Isolate, MutableBigInt> New(
Isolate* isolate, int length, Isolate* isolate, int length,
AllocationType allocation = AllocationType::kYoung); AllocationType allocation = AllocationType::kYoung);
static Handle<BigInt> NewFromInt(Isolate* isolate, int value); static Handle<BigInt> NewFromInt(Isolate* isolate, int value);
...@@ -57,15 +61,21 @@ class MutableBigInt : public FreshlyAllocatedBigInt { ...@@ -57,15 +61,21 @@ class MutableBigInt : public FreshlyAllocatedBigInt {
void InitializeDigits(int length, byte value = 0); void InitializeDigits(int length, byte value = 0);
static Handle<MutableBigInt> Copy(Isolate* isolate, static Handle<MutableBigInt> Copy(Isolate* isolate,
Handle<BigIntBase> source); Handle<BigIntBase> source);
static Handle<BigInt> Zero(Isolate* isolate) { template <typename Isolate>
static HandleFor<Isolate, BigInt> Zero(Isolate* isolate) {
// TODO(jkummerow): Consider caching a canonical zero-BigInt. // TODO(jkummerow): Consider caching a canonical zero-BigInt.
return MakeImmutable(New(isolate, 0)).ToHandleChecked(); return MakeImmutable<Isolate>(New(isolate, 0).ToHandleChecked());
} }
static Handle<MutableBigInt> Cast(Handle<FreshlyAllocatedBigInt> bigint) { static Handle<MutableBigInt> Cast(Handle<FreshlyAllocatedBigInt> bigint) {
SLOW_DCHECK(bigint->IsBigInt()); SLOW_DCHECK(bigint->IsBigInt());
return Handle<MutableBigInt>::cast(bigint); return Handle<MutableBigInt>::cast(bigint);
} }
static OffThreadHandle<MutableBigInt> Cast(
OffThreadHandle<FreshlyAllocatedBigInt> bigint) {
SLOW_DCHECK(bigint->IsBigInt());
return OffThreadHandle<MutableBigInt>::cast(bigint);
}
static MutableBigInt cast(Object o) { static MutableBigInt cast(Object o) {
SLOW_DCHECK(o.IsBigInt()); SLOW_DCHECK(o.IsBigInt());
return MutableBigInt(o.ptr()); return MutableBigInt(o.ptr());
...@@ -236,8 +246,8 @@ NEVER_READ_ONLY_SPACE_IMPL(MutableBigInt) ...@@ -236,8 +246,8 @@ NEVER_READ_ONLY_SPACE_IMPL(MutableBigInt)
#include "src/objects/object-macros-undef.h" #include "src/objects/object-macros-undef.h"
template <typename T> template <typename T, typename Isolate>
MaybeHandle<T> ThrowBigIntTooBig(Isolate* isolate) { MaybeHandleFor<Isolate, T> ThrowBigIntTooBig(Isolate* isolate) {
// If the result of a BigInt computation is truncated to 64 bit, Turbofan // If the result of a BigInt computation is truncated to 64 bit, Turbofan
// can sometimes truncate intermediate results already, which can prevent // can sometimes truncate intermediate results already, which can prevent
// those from exceeding the maximum length, effectively preventing a // those from exceeding the maximum length, effectively preventing a
...@@ -250,12 +260,13 @@ MaybeHandle<T> ThrowBigIntTooBig(Isolate* isolate) { ...@@ -250,12 +260,13 @@ MaybeHandle<T> ThrowBigIntTooBig(Isolate* isolate) {
THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kBigIntTooBig), T); THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kBigIntTooBig), T);
} }
MaybeHandle<MutableBigInt> MutableBigInt::New(Isolate* isolate, int length, template <typename Isolate>
AllocationType allocation) { MaybeHandleFor<Isolate, MutableBigInt> MutableBigInt::New(
Isolate* isolate, int length, AllocationType allocation) {
if (length > BigInt::kMaxLength) { if (length > BigInt::kMaxLength) {
return ThrowBigIntTooBig<MutableBigInt>(isolate); return ThrowBigIntTooBig<MutableBigInt>(isolate);
} }
Handle<MutableBigInt> result = HandleFor<Isolate, MutableBigInt> result =
Cast(isolate->factory()->NewBigInt(length, allocation)); Cast(isolate->factory()->NewBigInt(length, allocation));
result->initialize_bitfield(false, length); result->initialize_bitfield(false, length);
#if DEBUG #if DEBUG
...@@ -367,14 +378,16 @@ void MutableBigInt::InitializeDigits(int length, byte value) { ...@@ -367,14 +378,16 @@ void MutableBigInt::InitializeDigits(int length, byte value) {
MaybeHandle<BigInt> MutableBigInt::MakeImmutable( MaybeHandle<BigInt> MutableBigInt::MakeImmutable(
MaybeHandle<MutableBigInt> maybe) { MaybeHandle<MutableBigInt> maybe) {
Handle<MutableBigInt> result; HandleFor<Isolate, MutableBigInt> result;
if (!maybe.ToHandle(&result)) return MaybeHandle<BigInt>(); if (!maybe.ToHandle(&result)) return MaybeHandleFor<Isolate, BigInt>();
return MakeImmutable(result); return MakeImmutable(result);
} }
Handle<BigInt> MutableBigInt::MakeImmutable(Handle<MutableBigInt> result) { template <typename Isolate>
HandleFor<Isolate, BigInt> MutableBigInt::MakeImmutable(
HandleFor<Isolate, MutableBigInt> result) {
MutableBigInt::Canonicalize(*result); MutableBigInt::Canonicalize(*result);
return Handle<BigInt>::cast(result); return HandleFor<Isolate, BigInt>::cast(result);
} }
void MutableBigInt::Canonicalize(MutableBigInt result) { void MutableBigInt::Canonicalize(MutableBigInt result) {
...@@ -405,9 +418,13 @@ void MutableBigInt::Canonicalize(MutableBigInt result) { ...@@ -405,9 +418,13 @@ void MutableBigInt::Canonicalize(MutableBigInt result) {
result.digit(result.length() - 1) != 0); // MSD is non-zero. result.digit(result.length() - 1) != 0); // MSD is non-zero.
} }
Handle<BigInt> BigInt::Zero(Isolate* isolate) { template <typename Isolate>
HandleFor<Isolate, BigInt> BigInt::Zero(Isolate* isolate) {
return MutableBigInt::Zero(isolate); return MutableBigInt::Zero(isolate);
} }
template Handle<BigInt> BigInt::Zero<Isolate>(Isolate* isolate);
template OffThreadHandle<BigInt> BigInt::Zero<OffThreadIsolate>(
OffThreadIsolate* isolate);
Handle<BigInt> BigInt::UnaryMinus(Isolate* isolate, Handle<BigInt> x) { Handle<BigInt> BigInt::UnaryMinus(Isolate* isolate, Handle<BigInt> x) {
// Special case: There is no -0n. // Special case: There is no -0n.
...@@ -1505,13 +1522,13 @@ void MutableBigInt::InternalMultiplyAdd(BigIntBase source, digit_t factor, ...@@ -1505,13 +1522,13 @@ void MutableBigInt::InternalMultiplyAdd(BigIntBase source, digit_t factor,
} }
// Multiplies {x} with {factor} and then adds {summand} to it. // Multiplies {x} with {factor} and then adds {summand} to it.
void BigInt::InplaceMultiplyAdd(Handle<FreshlyAllocatedBigInt> x, void BigInt::InplaceMultiplyAdd(FreshlyAllocatedBigInt x, uintptr_t factor,
uintptr_t factor, uintptr_t summand) { uintptr_t summand) {
STATIC_ASSERT(sizeof(factor) == sizeof(digit_t)); STATIC_ASSERT(sizeof(factor) == sizeof(digit_t));
STATIC_ASSERT(sizeof(summand) == sizeof(digit_t)); STATIC_ASSERT(sizeof(summand) == sizeof(digit_t));
Handle<MutableBigInt> bigint = MutableBigInt::Cast(x); MutableBigInt bigint = MutableBigInt::cast(x);
MutableBigInt::InternalMultiplyAdd(*bigint, factor, summand, bigint->length(), MutableBigInt::InternalMultiplyAdd(bigint, factor, summand, bigint.length(),
*bigint); bigint);
} }
// Divides {x} by {divisor}, returning the result in {quotient} and {remainder}. // Divides {x} by {divisor}, returning the result in {quotient} and {remainder}.
...@@ -1907,7 +1924,8 @@ constexpr uint8_t kMaxBitsPerChar[] = { ...@@ -1907,7 +1924,8 @@ constexpr uint8_t kMaxBitsPerChar[] = {
static const int kBitsPerCharTableShift = 5; static const int kBitsPerCharTableShift = 5;
static const size_t kBitsPerCharTableMultiplier = 1u << kBitsPerCharTableShift; static const size_t kBitsPerCharTableMultiplier = 1u << kBitsPerCharTableShift;
MaybeHandle<FreshlyAllocatedBigInt> BigInt::AllocateFor( template <typename Isolate>
MaybeHandleFor<Isolate, FreshlyAllocatedBigInt> BigInt::AllocateFor(
Isolate* isolate, int radix, int charcount, ShouldThrow should_throw, Isolate* isolate, int radix, int charcount, ShouldThrow should_throw,
AllocationType allocation) { AllocationType allocation) {
DCHECK(2 <= radix && radix <= 36); DCHECK(2 <= radix && radix <= 36);
...@@ -1923,7 +1941,7 @@ MaybeHandle<FreshlyAllocatedBigInt> BigInt::AllocateFor( ...@@ -1923,7 +1941,7 @@ MaybeHandle<FreshlyAllocatedBigInt> BigInt::AllocateFor(
// Divide by kDigitsBits, rounding up. // Divide by kDigitsBits, rounding up.
int length = static_cast<int>((bits_min + kDigitBits - 1) / kDigitBits); int length = static_cast<int>((bits_min + kDigitBits - 1) / kDigitBits);
if (length <= kMaxLength) { if (length <= kMaxLength) {
Handle<MutableBigInt> result = HandleFor<Isolate, MutableBigInt> result =
MutableBigInt::New(isolate, length, allocation).ToHandleChecked(); MutableBigInt::New(isolate, length, allocation).ToHandleChecked();
result->InitializeDigits(length); result->InitializeDigits(length);
return result; return result;
...@@ -1934,16 +1952,31 @@ MaybeHandle<FreshlyAllocatedBigInt> BigInt::AllocateFor( ...@@ -1934,16 +1952,31 @@ MaybeHandle<FreshlyAllocatedBigInt> BigInt::AllocateFor(
if (should_throw == kThrowOnError) { if (should_throw == kThrowOnError) {
return ThrowBigIntTooBig<FreshlyAllocatedBigInt>(isolate); return ThrowBigIntTooBig<FreshlyAllocatedBigInt>(isolate);
} else { } else {
return MaybeHandle<FreshlyAllocatedBigInt>(); return MaybeHandleFor<Isolate, FreshlyAllocatedBigInt>();
} }
} }
template MaybeHandle<FreshlyAllocatedBigInt> BigInt::AllocateFor<Isolate>(
Handle<BigInt> BigInt::Finalize(Handle<FreshlyAllocatedBigInt> x, bool sign) { Isolate* isolate, int radix, int charcount, ShouldThrow should_throw,
Handle<MutableBigInt> bigint = MutableBigInt::Cast(x); AllocationType allocation);
template OffThreadHandle<FreshlyAllocatedBigInt>
BigInt::AllocateFor<OffThreadIsolate>(OffThreadIsolate* isolate, int radix,
int charcount, ShouldThrow should_throw,
AllocationType allocation);
template <typename Isolate>
HandleFor<Isolate, BigInt> BigInt::Finalize(
HandleFor<Isolate, FreshlyAllocatedBigInt> x, bool sign) {
HandleFor<Isolate, MutableBigInt> bigint =
HandleFor<Isolate, MutableBigInt>::cast(x);
bigint->set_sign(sign); bigint->set_sign(sign);
return MutableBigInt::MakeImmutable(bigint); return MutableBigInt::MakeImmutable<Isolate>(bigint);
} }
template Handle<BigInt> BigInt::Finalize<Isolate>(
Handle<FreshlyAllocatedBigInt>, bool);
template OffThreadHandle<BigInt> BigInt::Finalize<OffThreadIsolate>(
OffThreadHandle<FreshlyAllocatedBigInt>, bool);
// The serialization format MUST NOT CHANGE without updating the format // The serialization format MUST NOT CHANGE without updating the format
// version in value-serializer.cc! // version in value-serializer.cc!
uint32_t BigInt::GetBitfieldForSerialization() const { uint32_t BigInt::GetBitfieldForSerialization() const {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define V8_OBJECTS_BIGINT_H_ #define V8_OBJECTS_BIGINT_H_
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/handles/handle-for.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "src/objects/primitive-heap-object.h" #include "src/objects/primitive-heap-object.h"
#include "src/utils/utils.h" #include "src/utils/utils.h"
...@@ -238,18 +239,23 @@ class BigInt : public BigIntBase { ...@@ -238,18 +239,23 @@ class BigInt : public BigIntBase {
class BodyDescriptor; class BodyDescriptor;
private: private:
template <typename Isolate>
friend class StringToBigIntHelper; friend class StringToBigIntHelper;
friend class ValueDeserializer; friend class ValueDeserializer;
friend class ValueSerializer; friend class ValueSerializer;
// Special functions for StringToBigIntHelper: // Special functions for StringToBigIntHelper:
static Handle<BigInt> Zero(Isolate* isolate); template <typename Isolate>
static MaybeHandle<FreshlyAllocatedBigInt> AllocateFor( static HandleFor<Isolate, BigInt> Zero(Isolate* isolate);
template <typename Isolate>
static MaybeHandleFor<Isolate, FreshlyAllocatedBigInt> AllocateFor(
Isolate* isolate, int radix, int charcount, ShouldThrow should_throw, Isolate* isolate, int radix, int charcount, ShouldThrow should_throw,
AllocationType allocation); AllocationType allocation);
static void InplaceMultiplyAdd(Handle<FreshlyAllocatedBigInt> x, static void InplaceMultiplyAdd(FreshlyAllocatedBigInt x, uintptr_t factor,
uintptr_t factor, uintptr_t summand); uintptr_t summand);
static Handle<BigInt> Finalize(Handle<FreshlyAllocatedBigInt> x, bool sign); template <typename Isolate>
static HandleFor<Isolate, BigInt> Finalize(
HandleFor<Isolate, FreshlyAllocatedBigInt> x, bool sign);
// Special functions for ValueSerializer/ValueDeserializer: // Special functions for ValueSerializer/ValueDeserializer:
uint32_t GetBitfieldForSerialization() const; uint32_t GetBitfieldForSerialization() const;
......
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