#ifndef V8_OBJECTS_PROTOTYPE_INFO_H_
#define V8_OBJECTS_PROTOTYPE_INFO_H_
#include "src/objects/fixed-array.h"
#include "src/objects/objects.h"
#include "src/objects/struct.h"
#include "torque-generated/bit-fields.h"
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
#include "torque-generated/src/objects/prototype-info-tq.inc"
class PrototypeInfo
: public TorqueGeneratedPrototypeInfo<PrototypeInfo, Struct> {
public:
enum CachedHandlerIndex {
kLoadNonExistentHandlerDefault = 0,
kLoadNonExistentHandlerWithLookupOnReceiver,
kCachedHandlerCount,
};
static constexpr int kSize =
kCachedHandlerOffset + kCachedHandlerCount * kTaggedSize;
static const int UNREGISTERED = -1;
DECL_GETTER(derived_maps, Tagged<HeapObject>)
DECL_RELEASE_ACQUIRE_ACCESSORS(derived_maps, Tagged<HeapObject>)
static inline void SetObjectCreateMap(DirectHandle<PrototypeInfo> info,
DirectHandle<Map> map,
Isolate* isolate);
inline Tagged<MaybeObject> ObjectCreateMap(AcquireLoadTag);
inline Tagged<MaybeObject> ObjectCreateMap();
static inline void AddDerivedMap(DirectHandle<PrototypeInfo> info,
DirectHandle<Map> to, Isolate* isolate);
inline Tagged<MaybeObject> GetDerivedMap(DirectHandle<Map> from);
static inline bool IsPrototypeInfoFast(Tagged<Object> object);
DECL_BOOLEAN_ACCESSORS(should_be_fast_map)
DECL_PRINTER(PrototypeInfo)
DECL_VERIFIER(PrototypeInfo)
DEFINE_TORQUE_GENERATED_PROTOTYPE_INFO_FLAGS()
class BodyDescriptor;
TQ_OBJECT_CONSTRUCTORS(PrototypeInfo)
};
class V8_EXPORT_PRIVATE PrototypeUsers : public WeakArrayList {
public:
static Handle<WeakArrayList> Add(Isolate* isolate,
Handle<WeakArrayList> array,
DirectHandle<Map> value,
int* assigned_index);
static inline void MarkSlotEmpty(Tagged<WeakArrayList> array, int index);
using CompactionCallback = void (*)(Tagged<HeapObject> object, int from_index,
int to_index);
static Tagged<WeakArrayList> Compact(
DirectHandle<WeakArrayList> array, Heap* heap,
CompactionCallback callback,
AllocationType allocation = AllocationType::kYoung);
#ifdef VERIFY_HEAP
static void Verify(Tagged<WeakArrayList> array);
#endif
static const int kEmptySlotIndex = 0;
static const int kFirstIndex = 1;
static const int kNoEmptySlotsMarker = 0;
private:
static inline Tagged<Smi> empty_slot_index(Tagged<WeakArrayList> array);
static inline void set_empty_slot_index(Tagged<WeakArrayList> array,
int index);
static void ScanForEmptySlots(Tagged<WeakArrayList> array);
DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeUsers);
};
}
}
#include "src/objects/object-macros-undef.h"
#endif