summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/js-objects.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects/js-objects.h')
-rw-r--r--deps/v8/src/objects/js-objects.h79
1 files changed, 55 insertions, 24 deletions
diff --git a/deps/v8/src/objects/js-objects.h b/deps/v8/src/objects/js-objects.h
index a9510642f1..f38cbe16e6 100644
--- a/deps/v8/src/objects/js-objects.h
+++ b/deps/v8/src/objects/js-objects.h
@@ -6,6 +6,8 @@
#define V8_OBJECTS_JS_OBJECTS_H_
#include "src/objects/embedder-data-slot.h"
+// TODO(jkummerow): Consider forward-declaring instead.
+#include "src/objects/internal-index.h"
#include "src/objects/objects.h"
#include "src/objects/property-array.h"
#include "torque-generated/class-definitions-tq.h"
@@ -264,7 +266,7 @@ class JSReceiver : public HeapObject {
static const int kHashMask = PropertyArray::HashField::kMask;
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
- TORQUE_GENERATED_JSRECEIVER_FIELDS)
+ TORQUE_GENERATED_JS_RECEIVER_FIELDS)
bool HasProxyInPrototype(Isolate* isolate);
V8_WARN_UNUSED_RESULT static MaybeHandle<FixedArray> GetPrivateEntries(
@@ -631,7 +633,7 @@ class JSObject : public TorqueGeneratedJSObject<JSObject, JSReceiver> {
FieldIndex index, Object value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline void RawFastDoublePropertyAsBitsAtPut(FieldIndex index, uint64_t bits);
- inline void WriteToField(int descriptor, PropertyDetails details,
+ inline void WriteToField(InternalIndex descriptor, PropertyDetails details,
Object value);
// Access to in object properties.
@@ -806,6 +808,29 @@ class JSObject : public TorqueGeneratedJSObject<JSObject, JSReceiver> {
TQ_OBJECT_CONSTRUCTORS(JSObject)
};
+// An abstract superclass for JSObjects that may have elements while having an
+// empty fixed array as elements backing store. It doesn't carry any
+// functionality but allows function classes to be identified in the type
+// system.
+class JSCustomElementsObject
+ : public TorqueGeneratedJSCustomElementsObject<JSCustomElementsObject,
+ JSObject> {
+ public:
+ STATIC_ASSERT(kHeaderSize == JSObject::kHeaderSize);
+ TQ_OBJECT_CONSTRUCTORS(JSCustomElementsObject)
+};
+
+// An abstract superclass for JSObjects that require non-standard element
+// access. It doesn't carry any functionality but allows function classes to be
+// identified in the type system.
+class JSSpecialObject
+ : public TorqueGeneratedJSSpecialObject<JSSpecialObject,
+ JSCustomElementsObject> {
+ public:
+ STATIC_ASSERT(kHeaderSize == JSObject::kHeaderSize);
+ TQ_OBJECT_CONSTRUCTORS(JSSpecialObject)
+};
+
// JSAccessorPropertyDescriptor is just a JSObject with a specific initial
// map. This initial map adds in-object properties for "get", "set",
// "enumerable" and "configurable" properties, as assigned by the
@@ -893,9 +918,21 @@ class JSIteratorResult : public JSObject {
OBJECT_CONSTRUCTORS(JSIteratorResult, JSObject);
};
+// An abstract superclass for classes representing JavaScript function values.
+// It doesn't carry any functionality but allows function classes to be
+// identified in the type system.
+class JSFunctionOrBoundFunction
+ : public TorqueGeneratedJSFunctionOrBoundFunction<JSFunctionOrBoundFunction,
+ JSObject> {
+ public:
+ STATIC_ASSERT(kHeaderSize == JSObject::kHeaderSize);
+ TQ_OBJECT_CONSTRUCTORS(JSFunctionOrBoundFunction)
+};
+
// JSBoundFunction describes a bound function exotic object.
class JSBoundFunction
- : public TorqueGeneratedJSBoundFunction<JSBoundFunction, JSObject> {
+ : public TorqueGeneratedJSBoundFunction<JSBoundFunction,
+ JSFunctionOrBoundFunction> {
public:
static MaybeHandle<String> GetName(Isolate* isolate,
Handle<JSBoundFunction> function);
@@ -916,7 +953,7 @@ class JSBoundFunction
};
// JSFunction describes JavaScript functions.
-class JSFunction : public JSObject {
+class JSFunction : public JSFunctionOrBoundFunction {
public:
// [prototype_or_initial_map]:
DECL_ACCESSORS(prototype_or_initial_map, HeapObject)
@@ -1119,13 +1156,13 @@ class JSFunction : public JSObject {
// ES6 section 19.2.3.5 Function.prototype.toString ( ).
static Handle<String> ToString(Handle<JSFunction> function);
- DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
- TORQUE_GENERATED_JSFUNCTION_FIELDS)
+ DEFINE_FIELD_OFFSET_CONSTANTS(JSFunctionOrBoundFunction::kHeaderSize,
+ TORQUE_GENERATED_JS_FUNCTION_FIELDS)
static constexpr int kSizeWithoutPrototype = kPrototypeOrInitialMapOffset;
static constexpr int kSizeWithPrototype = kSize;
- OBJECT_CONSTRUCTORS(JSFunction, JSObject);
+ OBJECT_CONSTRUCTORS(JSFunction, JSFunctionOrBoundFunction);
};
// JSGlobalProxy's prototype must be a JSGlobalObject or null,
@@ -1137,7 +1174,7 @@ class JSFunction : public JSObject {
// Accessing a JSGlobalProxy requires security check.
class JSGlobalProxy
- : public TorqueGeneratedJSGlobalProxy<JSGlobalProxy, JSObject> {
+ : public TorqueGeneratedJSGlobalProxy<JSGlobalProxy, JSSpecialObject> {
public:
inline bool IsDetachedFrom(JSGlobalObject global) const;
@@ -1151,7 +1188,7 @@ class JSGlobalProxy
};
// JavaScript global object.
-class JSGlobalObject : public JSObject {
+class JSGlobalObject : public JSSpecialObject {
public:
// [native context]: the natives corresponding to this global object.
DECL_ACCESSORS(native_context, NativeContext)
@@ -1179,15 +1216,16 @@ class JSGlobalObject : public JSObject {
DECL_VERIFIER(JSGlobalObject)
// Layout description.
- DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
- TORQUE_GENERATED_JSGLOBAL_OBJECT_FIELDS)
+ DEFINE_FIELD_OFFSET_CONSTANTS(JSSpecialObject::kHeaderSize,
+ TORQUE_GENERATED_JS_GLOBAL_OBJECT_FIELDS)
- OBJECT_CONSTRUCTORS(JSGlobalObject, JSObject);
+ OBJECT_CONSTRUCTORS(JSGlobalObject, JSSpecialObject);
};
// Representation for JS Wrapper objects, String, Number, Boolean, etc.
class JSPrimitiveWrapper
- : public TorqueGeneratedJSPrimitiveWrapper<JSPrimitiveWrapper, JSObject> {
+ : public TorqueGeneratedJSPrimitiveWrapper<JSPrimitiveWrapper,
+ JSCustomElementsObject> {
public:
// Dispatched behavior.
DECL_PRINTER(JSPrimitiveWrapper)
@@ -1319,7 +1357,7 @@ class JSMessageObject : public JSObject {
DECL_VERIFIER(JSMessageObject)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
- TORQUE_GENERATED_JSMESSAGE_OBJECT_FIELDS)
+ TORQUE_GENERATED_JS_MESSAGE_OBJECT_FIELDS)
// TODO(v8:8989): [torque] Support marker constants.
static const int kPointerFieldsEndOffset = kStartPositionOffset;
@@ -1370,25 +1408,18 @@ class JSAsyncFromSyncIterator
TQ_OBJECT_CONSTRUCTORS(JSAsyncFromSyncIterator)
};
-class JSStringIterator : public JSObject {
+class JSStringIterator
+ : public TorqueGeneratedJSStringIterator<JSStringIterator, JSObject> {
public:
// Dispatched behavior.
DECL_PRINTER(JSStringIterator)
DECL_VERIFIER(JSStringIterator)
- DECL_CAST(JSStringIterator)
-
- // [string]: the [[IteratedString]] inobject property.
- DECL_ACCESSORS(string, String)
-
// [index]: The [[StringIteratorNextIndex]] inobject property.
inline int index() const;
inline void set_index(int value);
- DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
- TORQUE_GENERATED_JSSTRING_ITERATOR_FIELDS)
-
- OBJECT_CONSTRUCTORS(JSStringIterator, JSObject);
+ TQ_OBJECT_CONSTRUCTORS(JSStringIterator)
};
} // namespace internal