Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects/objects-body-descriptors.h')
-rw-r--r--deps/v8/src/objects/objects-body-descriptors.h89
1 files changed, 74 insertions, 15 deletions
diff --git a/deps/v8/src/objects/objects-body-descriptors.h b/deps/v8/src/objects/objects-body-descriptors.h
index 13adf4c3db6..8135e1f1701 100644
--- a/deps/v8/src/objects/objects-body-descriptors.h
+++ b/deps/v8/src/objects/objects-body-descriptors.h
@@ -74,15 +74,14 @@ class BodyDescriptorBase {
ObjectVisitor* v);
};
-// This class describes a body of an object of a fixed size
-// in which all pointer fields are located in the [start_offset, end_offset)
-// interval.
-template <int start_offset, int end_offset, int size>
-class FixedBodyDescriptor final : public BodyDescriptorBase {
+// This class describes a body of an object in which all pointer fields are
+// located in the [start_offset, end_offset) interval.
+// All pointers have to be strong.
+template <int start_offset, int end_offset>
+class FixedRangeBodyDescriptor : public BodyDescriptorBase {
public:
static const int kStartOffset = start_offset;
static const int kEndOffset = end_offset;
- static const int kSize = size;
static bool IsValidSlot(Map map, HeapObject obj, int offset) {
return offset >= kStartOffset && offset < kEndOffset;
@@ -99,14 +98,30 @@ class FixedBodyDescriptor final : public BodyDescriptorBase {
IterateBody(map, obj, v);
}
- static inline int SizeOf(Map map, HeapObject object) { return kSize; }
+ private:
+ static inline int SizeOf(Map map, HeapObject object) {
+ // Has to be implemented by the subclass.
+ UNREACHABLE();
+ }
};
-// This class describes a body of an object of a variable size
-// in which all pointer fields are located in the [start_offset, object_size)
+// This class describes a body of an object of a fixed size
+// in which all pointer fields are located in the [start_offset, end_offset)
// interval.
+// All pointers have to be strong.
+template <int start_offset, int end_offset, int size>
+class FixedBodyDescriptor
+ : public FixedRangeBodyDescriptor<start_offset, end_offset> {
+ public:
+ static const int kSize = size;
+ static inline int SizeOf(Map map, HeapObject object) { return kSize; }
+};
+
+// This class describes a body of an object in which all pointer fields are
+// located in the [start_offset, object_size) interval.
+// All pointers have to be strong.
template <int start_offset>
-class FlexibleBodyDescriptor final : public BodyDescriptorBase {
+class SuffixRangeBodyDescriptor : public BodyDescriptorBase {
public:
static const int kStartOffset = start_offset;
@@ -120,13 +135,30 @@ class FlexibleBodyDescriptor final : public BodyDescriptorBase {
IteratePointers(obj, start_offset, object_size, v);
}
+ private:
+ static inline int SizeOf(Map map, HeapObject object) {
+ // Has to be implemented by the subclass.
+ UNREACHABLE();
+ }
+};
+
+// This class describes a body of an object of a variable size
+// in which all pointer fields are located in the [start_offset, object_size)
+// interval.
+// All pointers have to be strong.
+template <int start_offset>
+class FlexibleBodyDescriptor : public SuffixRangeBodyDescriptor<start_offset> {
+ public:
static inline int SizeOf(Map map, HeapObject object);
};
using StructBodyDescriptor = FlexibleBodyDescriptor<HeapObject::kHeaderSize>;
+// This class describes a body of an object in which all pointer fields are
+// located in the [start_offset, object_size) interval.
+// Pointers may be strong or may be MaybeObject-style weak pointers.
template <int start_offset>
-class FlexibleWeakBodyDescriptor final : public BodyDescriptorBase {
+class SuffixRangeWeakBodyDescriptor : public BodyDescriptorBase {
public:
static const int kStartOffset = start_offset;
@@ -140,9 +172,40 @@ class FlexibleWeakBodyDescriptor final : public BodyDescriptorBase {
IterateMaybeWeakPointers(obj, start_offset, object_size, v);
}
+ private:
+ static inline int SizeOf(Map map, HeapObject object) {
+ // Has to be implemented by the subclass.
+ UNREACHABLE();
+ }
+};
+
+// This class describes a body of an object of a variable size
+// in which all pointer fields are located in the [start_offset, object_size)
+// interval.
+// Pointers may be strong or may be MaybeObject-style weak pointers.
+template <int start_offset>
+class FlexibleWeakBodyDescriptor
+ : public SuffixRangeWeakBodyDescriptor<start_offset> {
+ public:
static inline int SizeOf(Map map, HeapObject object);
};
+// This class describes a body of an object without any pointers.
+class DataOnlyBodyDescriptor : public BodyDescriptorBase {
+ public:
+ static bool IsValidSlot(Map map, HeapObject obj, int offset) { return false; }
+
+ template <typename ObjectVisitor>
+ static inline void IterateBody(Map map, HeapObject obj, int object_size,
+ ObjectVisitor* v) {}
+
+ private:
+ static inline int SizeOf(Map map, HeapObject object) {
+ // Has to be implemented by the subclass.
+ UNREACHABLE();
+ }
+};
+
// This class describes a body of an object which has a parent class that also
// has a body descriptor. This represents a union of the parent's body
// descriptor, and a new descriptor for the child -- so, both parent and child's
@@ -180,10 +243,6 @@ class SubclassBodyDescriptor final : public BodyDescriptorBase {
}
};
-#define TORQUE_BODY_DESCRIPTOR_LIST_ADAPTER(V, TYPE, TypeName) V(TYPE, TypeName)
-#define TORQUE_BODY_DESCRIPTOR_LIST(V) \
- TORQUE_BODY_DESCRIPTOR_LIST_GENERATOR(TORQUE_BODY_DESCRIPTOR_LIST_ADAPTER, V)
-
} // namespace internal
} // namespace v8