// Copyright 2016 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_SLOT_SET_H_ #define V8_HEAP_SLOT_SET_H_ #include <map> #include <memory> #include <stack> #include <vector> #include "src/base/bit-field.h" #include "src/heap/base/basic-slot-set.h" #include "src/objects/compressed-slots.h" #include "src/objects/slots.h" #include "src/utils/allocation.h" #include "src/utils/utils.h" #include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck namespace v8 { namespace internal { KEEP_SLOT; REMOVE_SLOT; SlotCallbackResult; // Possibly empty buckets (buckets that do not contain any slots) are discovered // by the scavenger. Buckets might become non-empty when promoting objects later // or in another thread, so all those buckets need to be revisited. // Track possibly empty buckets within a SlotSet in this data structure. The // class contains a word-sized bitmap, in case more bits are needed the bitmap // is replaced with a pointer to a malloc-allocated bitmap. class PossiblyEmptyBuckets { … }; static_assert(std::is_standard_layout<PossiblyEmptyBuckets>::value); static_assert …; class SlotSet final : public ::heap::base::BasicSlotSet<kTaggedSize> { … }; static_assert(std::is_standard_layout<SlotSet>::value); static_assert(std::is_standard_layout<SlotSet::Bucket>::value); enum class SlotType : uint8_t { … }; // Data structure for maintaining a list of typed slots in a page. // Typed slots can only appear in Code objects, so // the maximum possible offset is limited by the // LargePageMetadata::kMaxCodePageSize. The implementation is a chain of chunks, // where each chunk is an array of encoded (slot type, slot offset) pairs. There // is no duplicate detection and we do not expect many duplicates because typed // slots contain V8 internal pointers that are not directly exposed to JS. class V8_EXPORT_PRIVATE TypedSlots { … }; // A multiset of per-page typed slots that allows concurrent iteration // clearing of invalid slots. class V8_EXPORT_PRIVATE TypedSlotSet : public TypedSlots { … }; } // namespace internal } // namespace v8 #endif // V8_HEAP_SLOT_SET_H_