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/+/1534304
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60420}
This commit is contained in:
Z Duong Nguyen-Huu 2019-03-21 12:45:35 -07:00 committed by Commit Bot
parent 27b9262f44
commit 1cab593c19
5 changed files with 34 additions and 27 deletions

View File

@ -231,12 +231,27 @@ type JSModuleNamespace extends JSObject;
type WeakArrayList extends HeapObject;
extern class JSWeakCollection extends JSObject { table: Object; }
extern class JSWeekSet extends JSWeakCollection {}
extern class JSWeekMap extends JSWeakCollection {}
extern class JSCollectionIterator extends JSObject {
table: 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 {
js_module_namespace: JSModuleNamespace | Undefined;
prototype_users: WeakArrayList | Zero;
@ -265,6 +280,8 @@ extern class Script extends Struct {
}
type DebugInfo extends HeapObject;
extern class EmbedderDataArray extends HeapObject { length: Smi; }
type ScopeInfo extends Object generates 'TNode<ScopeInfo>';
extern class PreparseData extends HeapObject {
@ -404,6 +421,8 @@ extern class JSAccessorPropertyDescriptor extends JSObject {
}
extern class JSCollection extends JSObject { table: Object; }
extern class JSSet extends JSCollection {}
extern class JSMap extends JSCollection {}
extern class JSDate extends JSObject {
value: NumberOrUndefined;

View File

@ -705,6 +705,7 @@ void EmbedderDataArray::EmbedderDataArrayVerify(Isolate* isolate) {
Object e = slot.load_tagged();
Object::VerifyPointer(isolate, e);
}
VerifySmiField(kLengthOffset);
}
void FixedArray::FixedArrayVerify(Isolate* isolate) {
@ -993,6 +994,10 @@ void JSMessageObject::JSMessageObjectVerify(Isolate* isolate) {
VerifyObjectField(isolate, kArgumentsOffset);
VerifyObjectField(isolate, kScriptOffset);
VerifyObjectField(isolate, kStackFramesOffset);
VerifySmiField(kMessageTypeOffset);
VerifySmiField(kStartPositionOffset);
VerifySmiField(kEndPositionOffset);
VerifySmiField(kErrorLevelOffset);
}
void String::StringVerify(Isolate* isolate) {

View File

@ -8,6 +8,7 @@
#include "src/globals.h"
#include "src/maybe-handles.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):
#include "src/objects/object-macros.h"
@ -27,14 +28,10 @@ class EmbedderDataArray : public HeapObject {
DECL_CAST(EmbedderDataArray)
// Layout description.
#define EMBEDDER_DATA_ARRAY_FIELDS(V) \
V(kLengthOffset, kTaggedSize) \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
EMBEDDER_DATA_ARRAY_FIELDS)
#undef EMBEDDER_DATA_ARRAY_FIELDS
TORQUE_GENERATED_EMBEDDER_DATA_ARRAY_FIELDS)
// TODO(v8:8989): [torque] Support marker constants.
static const int kHeaderSize = kSize;
// Garbage collection support.
static constexpr int SizeFor(int length) {

View File

@ -721,11 +721,11 @@ ACCESSORS(JSDate, min, Object, kMinOffset)
ACCESSORS(JSDate, sec, Object, kSecOffset)
MessageTemplate JSMessageObject::type() const {
Object value = READ_FIELD(*this, kTypeOffset);
Object value = READ_FIELD(*this, kMessageTypeOffset);
return MessageTemplateFromInt(Smi::ToInt(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, script, Script, kScriptOffset)

View File

@ -1372,24 +1372,10 @@ class JSMessageObject : public JSObject {
DECL_PRINTER(JSMessageObject)
DECL_VERIFIER(JSMessageObject)
// Layout description.
#define JS_MESSAGE_FIELDS(V) \
/* Tagged fields. */ \
V(kTypeOffset, kTaggedSize) \
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
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSMESSAGE_OBJECT_FIELDS)
// TODO(v8:8989): [torque] Support marker constants.
static const int kPointerFieldsEndOffset = kStartPositionOffset;
typedef FixedBodyDescriptor<HeapObject::kMapOffset, kPointerFieldsEndOffset,
kSize>