18 for (;
i < Z.
len();
i++) Z[
i] = 0;
38 for (;
i < Z.
len();
i++) Z[
i] = 0;
48 for (;
i <
X.len();
i++) Z[
i] =
X[
i];
49 for (;
i < Z.
len();
i++) Z[
i] = 0;
57 for (;
i <
X.len();
i++) Z[
i] =
X[
i];
58 for (;
i < Y.
len();
i++) Z[
i] = Y[
i];
59 for (;
i < Z.
len();
i++) Z[
i] = 0;
75 for (;
i < Z.
len();
i++) Z[
i] = 0;
87 for (;
i < Z.
len();
i++) Z[
i] = 0;
93 if (Y.
len() <
X.len()) {
100 for (;
i < Y.
len();
i++) Z[
i] = Y[
i];
101 for (;
i < Z.
len();
i++) Z[
i] = 0;
119 for (;
i < Z.
len();
i++) Z[
i] = 0;
129 for (;
i <
X.len();
i++) Z[
i] =
X[
i];
132 for (;
i < Z.
len();
i++) Z[
i] = 0;
137 int digit_shift =
static_cast<int>(shift /
kDigitBits);
138 int bits_shift =
static_cast<int>(shift %
kDigitBits);
141 for (;
i < digit_shift; ++
i) Z[
i] = 0;
142 if (bits_shift == 0) {
143 for (;
i <
X.len() + digit_shift; ++
i) Z[
i] =
X[
i - digit_shift];
144 for (;
i < Z.
len(); ++
i) Z[
i] = 0;
147 for (;
i <
X.len() + digit_shift; ++
i) {
149 Z[
i] = (d << bits_shift) | carry;
152 if (carry != 0) Z[
i++] = carry;
153 for (;
i < Z.
len(); ++
i) Z[
i] = 0;
159 int digit_shift =
static_cast<int>(shift /
kDigitBits);
160 int bits_shift =
static_cast<int>(shift %
kDigitBits);
161 int result_length =
X.len() - digit_shift;
162 if (result_length <= 0)
return 0;
167 bool must_round_down =
false;
170 if ((
X[digit_shift] &
mask) != 0) {
171 must_round_down =
true;
173 for (
int i = 0;
i < digit_shift;
i++) {
175 must_round_down =
true;
182 if (must_round_down && bits_shift == 0) {
184 const bool rounding_can_overflow =
digit_ismax(
X.msd());
185 if (rounding_can_overflow) ++result_length;
189 DCHECK(!must_round_down || x_sign);
190 state->must_round_down = must_round_down;
192 return result_length;
197 int digit_shift =
static_cast<int>(shift /
kDigitBits);
198 int bits_shift =
static_cast<int>(shift %
kDigitBits);
201 if (bits_shift == 0) {
202 for (;
i <
X.len() - digit_shift; ++
i) Z[
i] =
X[
i + digit_shift];
204 digit_t carry =
X[digit_shift] >> bits_shift;
205 for (;
i <
X.len() - digit_shift - 1; ++
i) {
208 carry = d >> bits_shift;
212 for (;
i < Z.
len(); ++
i) Z[
i] = 0;
214 if (state.must_round_down) {
224void TruncateToNBits(RWDigits Z, Digits
X,
int n) {
228 int last = digits - 1;
229 for (
int i = 0;
i < last;
i++) {
236 msd = (msd << drop) >> drop;
242void TruncateAndSubFromPowerOfTwo(RWDigits Z, Digits
X,
int n) {
247 int last = digits - 1;
248 int have_x = std::min(last,
X.len());
252 for (;
i < last;
i++) Z[
i] =
digit_sub(0, borrow, &borrow);
255 digit_t msd = last <
X.len() ?
X[last] : 0;
257 Z[last] =
digit_sub2(0, msd, borrow, &borrow);
260 msd = (msd << drop) >> drop;
266 Z[last] = result_msd & (minuend_msd - 1);
276 if (
X.len() < needed_digits)
return -1;
277 if (
X.len() > needed_digits)
return needed_digits;
278 digit_t top_digit =
X[needed_digits - 1];
280 if (top_digit < compare_digit)
return -1;
281 if (top_digit > compare_digit)
return needed_digits;
283 if (!x_negative)
return needed_digits;
284 for (
int i = needed_digits - 2;
i >= 0;
i--) {
285 if (
X[
i] != 0)
return needed_digits;
295 digit_t top_digit =
X[needed_digits - 1];
308 bool has_bit = (top_digit & compare_digit) == compare_digit;
310 TruncateToNBits(Z,
X, n);
313 TruncateAndSubFromPowerOfTwo(Z,
X, n);
314 if (!x_negative)
return true;
317 if ((top_digit & (compare_digit - 1)) != 0)
return false;
318 for (
int i = needed_digits - 2;
i >= 0;
i--) {
319 if (
X[
i] != 0)
return false;
327 if (
X.len() < needed_digits)
return -1;
328 if (
X.len() > needed_digits)
return needed_digits;
330 if (bits_in_top_digit == 0)
return -1;
331 digit_t top_digit =
X[needed_digits - 1];
332 if ((top_digit >> bits_in_top_digit) == 0)
return -1;
333 return needed_digits;
338 TruncateToNBits(Z,
X, n);
342 TruncateAndSubFromPowerOfTwo(Z,
X, n);
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and X(inclusive) percent " "of the regular marking start limit") DEFINE_INT(stress_scavenge
void BitwiseXor_NegNeg(RWDigits Z, Digits X, Digits Y)
bool AsIntN(RWDigits Z, Digits X, bool x_negative, int n)
void BitwiseAnd_PosPos(RWDigits Z, Digits X, Digits Y)
void BitwiseOr_PosNeg(RWDigits Z, Digits X, Digits Y)
int RightShift_ResultLength(Digits X, bool x_sign, digit_t shift, RightShiftState *state)
void BitwiseXor_PosPos(RWDigits Z, Digits X, Digits Y)
void LeftShift(RWDigits Z, Digits X, digit_t shift)
void BitwiseOr_PosPos(RWDigits Z, Digits X, Digits Y)
static constexpr int kDigitBits
void BitwiseAnd_NegNeg(RWDigits Z, Digits X, Digits Y)
int AsIntNResultLength(Digits X, bool x_negative, int n)
void Add(RWDigits Z, Digits X, Digits Y)
void AsUintN_Neg(RWDigits Z, Digits X, int n)
digit_t digit_sub2(digit_t a, digit_t b, digit_t borrow_in, digit_t *borrow_out)
void BitwiseOr_NegNeg(RWDigits Z, Digits X, Digits Y)
void RightShift(RWDigits Z, Digits X, digit_t shift, const RightShiftState &state)
digit_t digit_sub(digit_t a, digit_t b, digit_t *borrow)
constexpr bool digit_ismax(digit_t x)
void BitwiseXor_PosNeg(RWDigits Z, Digits X, Digits Y)
int AsUintN_Pos_ResultLength(Digits X, int n)
void BitwiseAnd_PosNeg(RWDigits Z, Digits X, Digits Y)
void AsUintN_Pos(RWDigits Z, Digits X, int n)
#define DCHECK(condition)