29 DCHECK(integer_part >= min);
30 DCHECK(integer_part <= max);
42void ProcessorImpl::InvertBasecase(RWDigits Z, Digits
V, RWDigits scratch) {
45 DCHECK(scratch.len() >= 2 *
V.len());
47 RWDigits
X(scratch, 0, 2 * n);
50 for (;
i <
n;
i++)
X[
i] = 0;
53 RWDigits R(
nullptr, 0);
70void ProcessorImpl::InvertNewton(RWDigits Z, Digits
V, RWDigits scratch) {
71 const int vn =
V.len();
74 const int kSOffset = 0;
75 const int kWOffset = 0;
83 DCHECK(
V.len() > kBasecasePrecision);
90 int target_fraction_bits[8 *
sizeof(vn)];
94 target_fraction_bits[iteration] = k;
103 Digits top_part_of_v(
V, vn - initial_digits, initial_digits);
104 InvertBasecase(Z, top_part_of_v, scratch);
105 Z[initial_digits] = Z[initial_digits] + 1;
107 Z.set_len(initial_digits + 1);
111 DcheckIntegerPartRange(Z, 1, 2);
114 RWDigits
S(scratch, kSOffset, 2 * Z.len());
118 DcheckIntegerPartRange(S, 1, 4);
122 int t_len = std::min(
V.len(), fraction_digits);
123 Digits
T(
V,
V.len() - t_len, t_len);
128 RWDigits
U(scratch, kUOffset,
S.len() + T.len());
129 DCHECK(
U.len() > fraction_digits);
132 U =
U + (
U.len() - (1 + fraction_digits));
133 DcheckIntegerPartRange(U, 0, 3);
138 RWDigits
W(scratch, kWOffset,
U.len());
139 int padding_digits =
U.len() - Z.len();
140 for (
int i = 0;
i < padding_digits;
i++) W[
i] = 0;
142 DcheckIntegerPartRange(W, 2, 4);
155 DcheckIntegerPartRange(Z, 1, 2);
162 Digits W_part(W,
W.len() - vn - 1, vn);
163 Digits U_part(U,
U.len() - vn - 1, vn);
165 digit_t integer_part =
W.msd() -
U.msd() - borrow;
166 DCHECK(integer_part == 1 || integer_part == 2);
167 if (integer_part == 2) {
171 for (
int i = 0;
i < Z.len();
i++) Z[
i] = ~
digit_t{0};
176 k = target_fraction_bits[iteration];
187void ProcessorImpl::Invert(RWDigits Z, Digits
V, RWDigits scratch) {
195 return InvertNewton(Z,
V, scratch);
203 InvertBasecase(Z,
V, scratch);
215void ProcessorImpl::DivideBarrett(RWDigits Q, RWDigits R, Digits A, Digits B,
216 Digits
I, RWDigits scratch) {
217 DCHECK(Q.len() >
A.len() -
B.len());
226 int orig_q_len = Q.len();
229 Digits A1 =
A +
B.len();
235 RWDigits
K(scratch, 0, 2 *
I.len());
238 Q.set_len(
I.len() + 1);
239 Add(Q,
K +
I.len(), A1);
243 RWDigits
P(scratch, 0,
A.len() + 1);
248 for (
int i =
B.len();
i < R.len();
i++) R[
i] = 0;
261 }
while (r_high != 0);
274 int final_q_len = Q.len();
275 Q.set_len(orig_q_len);
276 for (
int i = final_q_len;
i < orig_q_len;
i++) Q[
i] = 0;
280void ProcessorImpl::DivideBarrett(RWDigits Q, RWDigits R, Digits A, Digits B) {
281 DCHECK(Q.len() >
A.len() -
B.len());
287 ShiftedDigits b_normalized(B);
288 ShiftedDigits a_normalized(A, b_normalized.shift());
298 int barrett_dividend_length =
A.len() <= 2 *
B.len() ?
A.len() : 2 *
B.len();
299 int i_len = barrett_dividend_length -
B.len();
300 ScratchDigits
I(i_len + 1);
304 ScratchDigits scratch(scratch_len);
305 Invert(
I, Digits(B,
B.len() - i_len, i_len), scratch);
309 if (
A.len() > 2 *
B.len()) {
319 ScratchDigits Z(z_len);
320 PutAt(Z, A + n * (t - 2), z_len);
323 ScratchDigits Qi(qi_len);
328 DivideBarrett(Qi, Ri, Z, B,
I, scratch);
330 RWDigits target = Q + n *
i;
332 int to_copy = std::min(qi_len, target.len());
333 for (
int j = 0; j < to_copy; j++) target[j] = Qi[j];
334 for (
int j = to_copy; j < target.len(); j++) target[j] = 0;
336 for (
int j = to_copy; j < Qi.len(); j++) {
342 for (
int i = t - 3;
i >= 0;
i--) {
348 DivideBarrett(Qi, Ri, Z, B,
I, scratch);
349 DCHECK(Qi[qi_len - 1] == 0);
355 DCHECK(Ri.len() <= R.len());
359 DivideBarrett(Q, R, A, B,
I, scratch);
void DivideBurnikelZiegler(RWDigits Q, RWDigits R, Digits A, Digits B)
void Multiply(RWDigits Z, Digits X, Digits Y)
void DivideSchoolbook(RWDigits Q, RWDigits R, Digits A, Digits B)
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
static digit_t digit_div(digit_t high, digit_t low, digit_t divisor, digit_t *remainder)
void PutAt(RWDigits Z, Digits A, int count)
bool IsBitNormalized(Digits X)
void LeftShift(RWDigits Z, Digits X, digit_t shift)
static constexpr int kDigitBits
constexpr int InvertNewtonScratchSpace(int n)
void Add(RWDigits Z, Digits X, Digits Y)
bool GreaterThanOrEqual(Digits A, Digits B)
constexpr int kInvertNewtonExtraSpace
void Subtract(RWDigits Z, Digits X, Digits Y)
digit_t digit_sub2(digit_t a, digit_t b, digit_t borrow_in, digit_t *borrow_out)
digit_t SubtractAndReturnBorrow(RWDigits Z, Digits X, Digits Y)
void RightShift(RWDigits Z, Digits X, digit_t shift, const RightShiftState &state)
digit_t AddAndReturnCarry(RWDigits Z, Digits X, Digits Y)
constexpr int kNewtonInversionThreshold
constexpr int kBurnikelThreshold
constexpr int InvertScratchSpace(int n)
constexpr int DivideBarrettScratchSpace(int n)
#define P(name, number_of_args, result_size)
#define I(name, number_of_args, result_size)
#define DCHECK(condition)