v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
div-helpers.cc
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
8
9namespace v8 {
10namespace bigint {
11
12namespace {
13
14void Copy(RWDigits Z, Digits X) {
15 if (Z == X) return;
16 int i = 0;
17 for (; i < X.len(); i++) Z[i] = X[i];
18 for (; i < Z.len(); i++) Z[i] = 0;
19}
20
21} // namespace
22
23// Z := X << shift
24// Z and X may alias for an in-place shift.
25void LeftShift(RWDigits Z, Digits X, int shift) {
26 DCHECK(shift >= 0);
27 DCHECK(shift < kDigitBits);
28 DCHECK(Z.len() >= X.len());
29 if (shift == 0) return Copy(Z, X);
30 digit_t carry = 0;
31 int i = 0;
32 for (; i < X.len(); i++) {
33 digit_t d = X[i];
34 Z[i] = (d << shift) | carry;
35 carry = d >> (kDigitBits - shift);
36 }
37 if (i < Z.len()) {
38 Z[i++] = carry;
39 } else {
40 DCHECK(carry == 0);
41 }
42 for (; i < Z.len(); i++) Z[i] = 0;
43}
44
45// Z := X >> shift
46// Z and X may alias for an in-place shift.
47void RightShift(RWDigits Z, Digits X, int shift) {
48 DCHECK(shift >= 0);
49 DCHECK(shift < kDigitBits);
50 X.Normalize();
51 DCHECK(Z.len() >= X.len());
52 if (shift == 0) return Copy(Z, X);
53 int i = 0;
54 if (X.len() > 0) {
55 digit_t carry = X[0] >> shift;
56 int last = X.len() - 1;
57 for (; i < last; i++) {
58 digit_t d = X[i + 1];
59 Z[i] = (d << (kDigitBits - shift)) | carry;
60 carry = d >> shift;
61 }
62 Z[i++] = carry;
63 }
64 for (; i < Z.len(); i++) Z[i] = 0;
65}
66
67} // namespace bigint
68} // namespace v8
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 LeftShift(RWDigits Z, Digits X, digit_t shift)
Definition bitwise.cc:136
static constexpr int kDigitBits
Definition bigint.h:51
void RightShift(RWDigits Z, Digits X, digit_t shift, const RightShiftState &state)
Definition bitwise.cc:195
uintptr_t digit_t
Definition bigint.h:34
#define DCHECK(condition)
Definition logging.h:482