v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap.cc File Reference
#include "src/heap/heap.h"
#include <algorithm>
#include <atomic>
#include <cinttypes>
#include <iomanip>
#include <memory>
#include <optional>
#include <unordered_map>
#include <unordered_set>
#include "include/v8-locker.h"
#include "src/api/api-inl.h"
#include "src/base/bits.h"
#include "src/base/flags.h"
#include "src/base/logging.h"
#include "src/base/macros.h"
#include "src/base/once.h"
#include "src/base/platform/memory.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/time.h"
#include "src/base/utils/random-number-generator.h"
#include "src/builtins/accessors.h"
#include "src/codegen/assembler-inl.h"
#include "src/codegen/compilation-cache.h"
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
#include "src/debug/debug.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/execution/embedder-state.h"
#include "src/execution/isolate-utils-inl.h"
#include "src/execution/microtask-queue.h"
#include "src/execution/v8threads.h"
#include "src/execution/vm-state-inl.h"
#include "src/flags/flags.h"
#include "src/handles/global-handles-inl.h"
#include "src/handles/traced-handles.h"
#include "src/heap/allocation-observer.h"
#include "src/heap/array-buffer-sweeper.h"
#include "src/heap/base/stack.h"
#include "src/heap/base/worklist.h"
#include "src/heap/code-range.h"
#include "src/heap/code-stats.h"
#include "src/heap/collection-barrier.h"
#include "src/heap/combined-heap.h"
#include "src/heap/concurrent-marking.h"
#include "src/heap/cppgc-js/cpp-heap.h"
#include "src/heap/ephemeron-remembered-set.h"
#include "src/heap/evacuation-verifier-inl.h"
#include "src/heap/finalization-registry-cleanup-task.h"
#include "src/heap/gc-callbacks.h"
#include "src/heap/gc-tracer-inl.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/heap-allocator.h"
#include "src/heap/heap-controller.h"
#include "src/heap/heap-layout-inl.h"
#include "src/heap/heap-layout-tracer.h"
#include "src/heap/heap-utils-inl.h"
#include "src/heap/heap-visitor-inl.h"
#include "src/heap/heap-visitor.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/large-spaces.h"
#include "src/heap/local-heap-inl.h"
#include "src/heap/mark-compact-inl.h"
#include "src/heap/mark-compact.h"
#include "src/heap/marking-barrier-inl.h"
#include "src/heap/marking-barrier.h"
#include "src/heap/marking-state-inl.h"
#include "src/heap/marking-state.h"
#include "src/heap/memory-balancer.h"
#include "src/heap/memory-chunk-layout.h"
#include "src/heap/memory-chunk-metadata.h"
#include "src/heap/memory-measurement.h"
#include "src/heap/memory-reducer.h"
#include "src/heap/minor-gc-job.h"
#include "src/heap/minor-mark-sweep.h"
#include "src/heap/mutable-page-metadata-inl.h"
#include "src/heap/new-spaces.h"
#include "src/heap/object-lock.h"
#include "src/heap/object-stats.h"
#include "src/heap/page-pool.h"
#include "src/heap/paged-spaces-inl.h"
#include "src/heap/parked-scope.h"
#include "src/heap/pretenuring-handler.h"
#include "src/heap/read-only-heap.h"
#include "src/heap/remembered-set.h"
#include "src/heap/safepoint.h"
#include "src/heap/scavenger-inl.h"
#include "src/heap/stress-scavenge-observer.h"
#include "src/heap/sweeper.h"
#include "src/heap/trusted-range.h"
#include "src/heap/visit-object.h"
#include "src/heap/zapping.h"
#include "src/init/bootstrapper.h"
#include "src/init/v8.h"
#include "src/interpreter/interpreter.h"
#include "src/logging/log.h"
#include "src/logging/runtime-call-stats-scope.h"
#include "src/numbers/conversions.h"
#include "src/objects/allocation-site.h"
#include "src/objects/data-handler.h"
#include "src/objects/free-space-inl.h"
#include "src/objects/hash-table-inl.h"
#include "src/objects/hash-table.h"
#include "src/objects/instance-type.h"
#include "src/objects/maybe-object.h"
#include "src/objects/objects.h"
#include "src/objects/slots-atomic-inl.h"
#include "src/objects/slots-inl.h"
#include "src/objects/slots.h"
#include "src/objects/visitors.h"
#include "src/profiler/heap-profiler.h"
#include "src/regexp/regexp.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/serializer-deserializer.h"
#include "src/snapshot/snapshot.h"
#include "src/strings/string-hasher.h"
#include "src/strings/string-stream.h"
#include "src/strings/unicode-inl.h"
#include "src/tasks/cancelable-task.h"
#include "src/tracing/trace-event.h"
#include "src/utils/utils-inl.h"
#include "src/utils/utils.h"
#include "src/objects/object-macros.h"
#include "src/objects/object-macros-undef.h"

Go to the source code of this file.

Classes

class  v8::internal::Heap::AllocationTrackerForDebugging
 
class  v8::internal::IdleTaskOnContextDispose
 
class  v8::internal::ActivateMemoryReducerTask
 
class  v8::internal::MemoryPressureInterruptTask
 
class  v8::internal::StressConcurrentAllocationTask
 
class  v8::internal::StressConcurrentAllocationObserver
 
class  v8::internal::CheckHandleCountVisitor
 
class  v8::internal::HeapObjectsFilter
 
class  v8::internal::UnreachableObjectsFilter
 
class  v8::internal::UnreachableObjectsFilter::MarkingVisitor
 

Namespaces

namespace  v8
 
namespace  v8::internal
 

Macros

#define DICT(s)
 
#define LIST(s)
 
#define QUOTE(s)
 
#define MEMBER(s)
 
#define UPDATE_COUNTERS_FOR_SPACE(space)
 
#define UPDATE_FRAGMENTATION_FOR_SPACE(space)
 
#define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(space)
 
#define DEF_RIGHT_TRIM(T)
 
#define COMPARE_AND_RETURN_NAME(name)
 
#define COMPARE_AND_RETURN_NAME(name)
 

Functions

static GCType v8::internal::GetGCTypeFromGarbageCollector (GarbageCollector collector)
 

Macro Definition Documentation

◆ COMPARE_AND_RETURN_NAME [1/2]

#define COMPARE_AND_RETURN_NAME ( name)
Value:
case name: \
*object_type = #name; \
*object_sub_type = ""; \
return true;
const char * name
Definition builtins.cc:39

◆ COMPARE_AND_RETURN_NAME [2/2]

#define COMPARE_AND_RETURN_NAME ( name)
Value:
case ObjectStats::FIRST_VIRTUAL_TYPE + \
static_cast<int>(ObjectStats::VirtualInstanceType::name): \
*object_type = #name; \
*object_sub_type = ""; \
return true;

◆ DEF_RIGHT_TRIM

#define DEF_RIGHT_TRIM ( T)
Value:
Heap::RightTrimArray<T>(Tagged<T> object, int new_capacity, \
int old_capacity);
#define EXPORT_TEMPLATE_DEFINE(export)
#define V8_EXPORT_PRIVATE
Definition macros.h:460

Definition at line 3508 of file heap.cc.

◆ DICT

#define DICT ( s)
Value:
"{" << s << "}"

◆ LIST

#define LIST ( s)
Value:
"[" << s << "]"

◆ MEMBER

#define MEMBER ( s)
Value:
QUOTE(s) << ":"
#define QUOTE(s)

◆ QUOTE

#define QUOTE ( s)
Value:
"\"" << s << "\""

◆ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE

#define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE ( space)
Value:
UPDATE_FRAGMENTATION_FOR_SPACE(space)
#define UPDATE_COUNTERS_FOR_SPACE(space)

◆ UPDATE_COUNTERS_FOR_SPACE

#define UPDATE_COUNTERS_FOR_SPACE ( space)
Value:
isolate_->counters()->space##_bytes_available()->Set( \
static_cast<int>(space()->Available())); \
isolate_->counters()->space##_bytes_committed()->Set( \
static_cast<int>(space()->CommittedMemory())); \
isolate_->counters()->space##_bytes_used()->Set( \
static_cast<int>(space()->SizeOfObjects()));
Isolate * isolate_
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 space

◆ UPDATE_FRAGMENTATION_FOR_SPACE

#define UPDATE_FRAGMENTATION_FOR_SPACE ( space)
Value:
if (space()->CommittedMemory() > 0) { \
isolate_->counters()->external_fragmentation_##space()->AddSample( \
static_cast<int>(100 - (space()->SizeOfObjects() * 100.0) / \
space()->CommittedMemory())); \
}