Commit 1cab593c authored by Z Duong Nguyen-Huu's avatar Z Duong Nguyen-Huu Committed by Commit Bot

Torquefy some types

EmbedderDataArray, JSMessageObject, JSSet, JSMap, JSWeakSet, JSWeakMap

Bug: v8:8952
Change-Id: I996d9e18006184b8ac7be7d362e8faf36e44aaef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1534304Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60420}
parent 27b9262f
...@@ -231,12 +231,27 @@ type JSModuleNamespace extends JSObject; ...@@ -231,12 +231,27 @@ type JSModuleNamespace extends JSObject;
type WeakArrayList extends HeapObject; type WeakArrayList extends HeapObject;
extern class JSWeakCollection extends JSObject { table: Object; } extern class JSWeakCollection extends JSObject { table: Object; }
extern class JSWeekSet extends JSWeakCollection {}
extern class JSWeekMap extends JSWeakCollection {}
extern class JSCollectionIterator extends JSObject { extern class JSCollectionIterator extends JSObject {
table: Object; table: Object;
index: Object; index: Object;
} }
extern class JSMessageObject extends JSObject {
// Tagged fields.
message_type: Smi;
arguments: Object;
script: Script;
stack_frames: Object;
// Raw data fields.
// TODO(ishell): store as int32 instead of Smi.
start_position: Smi;
end_position: Smi;
error_level: Smi;
}
extern class PrototypeInfo extends Struct { extern class PrototypeInfo extends Struct {
js_module_namespace: JSModuleNamespace | Undefined; js_module_namespace: JSModuleNamespace | Undefined;
prototype_users: WeakArrayList | Zero; prototype_users: WeakArrayList | Zero;
...@@ -265,6 +280,8 @@ extern class Script extends Struct { ...@@ -265,6 +280,8 @@ extern class Script extends Struct {
} }
type DebugInfo extends HeapObject; type DebugInfo extends HeapObject;
extern class EmbedderDataArray extends HeapObject { length: Smi; }
type ScopeInfo extends Object generates 'TNode<ScopeInfo>'; type ScopeInfo extends Object generates 'TNode<ScopeInfo>';
extern class PreparseData extends HeapObject { extern class PreparseData extends HeapObject {
...@@ -404,6 +421,8 @@ extern class JSAccessorPropertyDescriptor extends JSObject { ...@@ -404,6 +421,8 @@ extern class JSAccessorPropertyDescriptor extends JSObject {
} }
extern class JSCollection extends JSObject { table: Object; } extern class JSCollection extends JSObject { table: Object; }
extern class JSSet extends JSCollection {}
extern class JSMap extends JSCollection {}
extern class JSDate extends JSObject { extern class JSDate extends JSObject {
value: NumberOrUndefined; value: NumberOrUndefined;
......
...@@ -705,6 +705,7 @@ void EmbedderDataArray::EmbedderDataArrayVerify(Isolate* isolate) { ...@@ -705,6 +705,7 @@ void EmbedderDataArray::EmbedderDataArrayVerify(Isolate* isolate) {
Object e = slot.load_tagged(); Object e = slot.load_tagged();
Object::VerifyPointer(isolate, e); Object::VerifyPointer(isolate, e);
} }
VerifySmiField(kLengthOffset);
} }
void FixedArray::FixedArrayVerify(Isolate* isolate) { void FixedArray::FixedArrayVerify(Isolate* isolate) {
...@@ -993,6 +994,10 @@ void JSMessageObject::JSMessageObjectVerify(Isolate* isolate) { ...@@ -993,6 +994,10 @@ void JSMessageObject::JSMessageObjectVerify(Isolate* isolate) {
VerifyObjectField(isolate, kArgumentsOffset); VerifyObjectField(isolate, kArgumentsOffset);
VerifyObjectField(isolate, kScriptOffset); VerifyObjectField(isolate, kScriptOffset);
VerifyObjectField(isolate, kStackFramesOffset); VerifyObjectField(isolate, kStackFramesOffset);
VerifySmiField(kMessageTypeOffset);
VerifySmiField(kStartPositionOffset);
VerifySmiField(kEndPositionOffset);
VerifySmiField(kErrorLevelOffset);
} }
void String::StringVerify(Isolate* isolate) { void String::StringVerify(Isolate* isolate) {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "src/globals.h" #include "src/globals.h"
#include "src/maybe-handles.h" #include "src/maybe-handles.h"
#include "src/objects/heap-object.h" #include "src/objects/heap-object.h"
#include "torque-generated/class-definitions-from-dsl.h"
// Has to be the last include (doesn't have include guards): // Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h" #include "src/objects/object-macros.h"
...@@ -27,14 +28,10 @@ class EmbedderDataArray : public HeapObject { ...@@ -27,14 +28,10 @@ class EmbedderDataArray : public HeapObject {
DECL_CAST(EmbedderDataArray) DECL_CAST(EmbedderDataArray)
// Layout description.
#define EMBEDDER_DATA_ARRAY_FIELDS(V) \
V(kLengthOffset, kTaggedSize) \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
EMBEDDER_DATA_ARRAY_FIELDS) TORQUE_GENERATED_EMBEDDER_DATA_ARRAY_FIELDS)
#undef EMBEDDER_DATA_ARRAY_FIELDS // TODO(v8:8989): [torque] Support marker constants.
static const int kHeaderSize = kSize;
// Garbage collection support. // Garbage collection support.
static constexpr int SizeFor(int length) { static constexpr int SizeFor(int length) {
......
...@@ -721,11 +721,11 @@ ACCESSORS(JSDate, min, Object, kMinOffset) ...@@ -721,11 +721,11 @@ ACCESSORS(JSDate, min, Object, kMinOffset)
ACCESSORS(JSDate, sec, Object, kSecOffset) ACCESSORS(JSDate, sec, Object, kSecOffset)
MessageTemplate JSMessageObject::type() const { MessageTemplate JSMessageObject::type() const {
Object value = READ_FIELD(*this, kTypeOffset); Object value = READ_FIELD(*this, kMessageTypeOffset);
return MessageTemplateFromInt(Smi::ToInt(value)); return MessageTemplateFromInt(Smi::ToInt(value));
} }
void JSMessageObject::set_type(MessageTemplate value) { void JSMessageObject::set_type(MessageTemplate value) {
WRITE_FIELD(*this, kTypeOffset, Smi::FromInt(static_cast<int>(value))); WRITE_FIELD(*this, kMessageTypeOffset, Smi::FromInt(static_cast<int>(value)));
} }
ACCESSORS(JSMessageObject, argument, Object, kArgumentsOffset) ACCESSORS(JSMessageObject, argument, Object, kArgumentsOffset)
ACCESSORS(JSMessageObject, script, Script, kScriptOffset) ACCESSORS(JSMessageObject, script, Script, kScriptOffset)
......
...@@ -1372,24 +1372,10 @@ class JSMessageObject : public JSObject { ...@@ -1372,24 +1372,10 @@ class JSMessageObject : public JSObject {
DECL_PRINTER(JSMessageObject) DECL_PRINTER(JSMessageObject)
DECL_VERIFIER(JSMessageObject) DECL_VERIFIER(JSMessageObject)
// Layout description. DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
#define JS_MESSAGE_FIELDS(V) \ TORQUE_GENERATED_JSMESSAGE_OBJECT_FIELDS)
/* Tagged fields. */ \ // TODO(v8:8989): [torque] Support marker constants.
V(kTypeOffset, kTaggedSize) \ static const int kPointerFieldsEndOffset = kStartPositionOffset;
V(kArgumentsOffset, kTaggedSize) \
V(kScriptOffset, kTaggedSize) \
V(kStackFramesOffset, kTaggedSize) \
V(kPointerFieldsEndOffset, 0) \
/* Raw data fields. */ \
/* TODO(ishell): store as int32 instead of Smi. */ \
V(kStartPositionOffset, kTaggedSize) \
V(kEndPositionOffset, kTaggedSize) \
V(kErrorLevelOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_MESSAGE_FIELDS)
#undef JS_MESSAGE_FIELDS
typedef FixedBodyDescriptor<HeapObject::kMapOffset, kPointerFieldsEndOffset, typedef FixedBodyDescriptor<HeapObject::kMapOffset, kPointerFieldsEndOffset,
kSize> kSize>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment