/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/heap/cppgc/heap.h
84 строки
3 KB
Michaël Zasso
deps: update V8 to 14.3.127.12
13 ноя 2025, 17:08
Не верифицирован
13 ноя 2025, 17:08
53379f3
Код
Авторство
О чём код?
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_HEAP_CPPGC_HEAP_H_ #define V8_HEAP_CPPGC_HEAP_H_ #include <optional> #include "include/cppgc/heap.h" #include "include/cppgc/liveness-broker.h" #include "include/cppgc/macros.h" #include "src/heap/cppgc/garbage-collector.h" #include "src/heap/cppgc/gc-invoker.h" #include "src/heap/cppgc/heap-base.h" #include "src/heap/cppgc/heap-growing.h" namespace cppgc { namespace internal { class V8_EXPORT_PRIVATE Heap final : public HeapBase, public cppgc::Heap, public GarbageCollector { public: static Heap* From(cppgc::Heap* heap) { return static_cast<Heap*>(heap); } static const Heap* From(const cppgc::Heap* heap) { return static_cast<const Heap*>(heap); } Heap(std::shared_ptr<cppgc::Platform> platform, cppgc::Heap::HeapOptions options); ~Heap() final; HeapBase& AsBase() { return *this; } const HeapBase& AsBase() const { return *this; } void CollectGarbage(GCConfig) final; void StartIncrementalGarbageCollection(GCConfig) final; bool RetryAllocate(v8::base::FunctionRef<bool()> allocate) final; void FinalizeIncrementalGarbageCollectionIfRunning(GCConfig); size_t epoch() const final { return epoch_; } std::optional<EmbedderStackState> overridden_stack_state() const final { return override_stack_state_; } void set_override_stack_state(EmbedderStackState state) final { CHECK(!override_stack_state_); override_stack_state_ = state; } void clear_overridden_stack_state() final { override_stack_state_.reset(); } #ifdef V8_ENABLE_ALLOCATION_TIMEOUT std::optional<int> UpdateAllocationTimeout() final { return std::nullopt; } #endif // V8_ENABLE_ALLOCATION_TIMEOUT void EnableGenerationalGC(); void DisableHeapGrowingForTesting(); private: void StartGarbageCollection(GCConfig); void FinalizeGarbageCollection(StackState); void FinalizeGarbageCollectionImpl(StackState); void FinalizeIncrementalGarbageCollectionIfNeeded(StackState) final; void StartIncrementalGarbageCollectionForTesting() final; void FinalizeIncrementalGarbageCollectionForTesting(EmbedderStackState) final; GCConfig config_; GCInvoker gc_invoker_; HeapGrowing growing_; bool generational_gc_enabled_ = false; size_t epoch_ = 0; std::optional<cppgc::EmbedderStackState> override_stack_state_; }; } // namespace internal } // namespace cppgc #endif // V8_HEAP_CPPGC_HEAP_H_