Commit c949f1eb authored by Paolo Severini's avatar Paolo Severini Committed by Commit Bot

[torque] Convert a few class layout definitions to torque.

Converted WeakFixedArray, PromiseReactionJobTask, PromiseResolveThenableJobTask,
PropertyCell, RegExpMatchInfo, WasmModuleObject, WasmTableObject,
WasmMemoryObject, WasmGlobalObject, WasmExceptionObject, AsmWasmData to torque.

Bug: v8:8952
Change-Id: Iddc8b7bc50f93f1a75b4a96667237eed57de236b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1536991
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60887}
parent 79972136
......@@ -147,6 +147,8 @@ extern class FixedDoubleArray extends FixedArrayBase {
floats[length]: float64;
}
extern class WeakFixedArray extends HeapObject { length: Smi; }
extern class ByteArray extends FixedArrayBase {}
type BytecodeArray extends FixedArrayBase;
......@@ -551,6 +553,15 @@ extern class ObjectTemplateInfo extends TemplateInfo {
extern class PropertyArray extends HeapObject { length_and_hash: Smi; }
extern class DependentCode extends WeakFixedArray {}
extern class PropertyCell extends HeapObject {
name: Name;
property_details_raw: Smi;
value: Object;
dependent_code: DependentCode;
}
extern class JSDataView extends JSArrayBufferView {}
type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType';
......@@ -913,6 +924,24 @@ extern class PromiseReaction extends Struct {
promise_or_capability: JSPromise | PromiseCapability | Undefined;
}
extern class PromiseReactionJobTask extends Microtask {
argument: Object;
context: Context;
handler: Callable | Undefined;
promise_or_capability: JSPromise | PromiseCapability | Undefined;
}
extern class PromiseFulfillReactionJobTask extends PromiseReactionJobTask {}
extern class PromiseRejectReactionJobTask extends PromiseReactionJobTask {}
extern class PromiseResolveThenableJobTask extends Microtask {
context: Context;
promise_to_resolve: JSPromise;
then: JSReceiver;
thenable: JSReceiver;
}
extern class JSRegExp extends JSObject {
data: FixedArray | Undefined;
source: String | Undefined;
......@@ -983,6 +1012,51 @@ extern class AccessorPair extends Struct {
extern class BreakPoint extends Tuple2 {}
extern class BreakPointInfo extends Tuple2 {}
extern class WasmModuleObject extends JSObject {
native_module: Foreign;
export_wrappers: FixedArray;
script: Script;
weak_instance_list: WeakArrayList;
asm_js_offset_table: ByteArray;
break_point_infos: FixedArray;
}
extern class WasmTableObject extends JSObject {
elements: FixedArray;
maximum_length: Smi | HeapNumber | Undefined;
dispatch_tables: FixedArray;
raw_type: Smi;
}
extern class WasmMemoryObject extends JSObject {
array_buffer: JSArrayBuffer;
maximum_pages: Smi;
instances: WeakArrayList;
}
extern class WasmGlobalObject extends JSObject {
untagged_buffer: JSArrayBuffer;
tagged_buffer: FixedArray;
offset: Smi;
flags: Smi;
}
extern class WasmExceptionObject extends JSObject {
serialized_signature: ByteArray; // PodArray<wasm::ValueType>
exception_tag: HeapObject;
}
extern class WasmExceptionPackage extends JSReceiver {}
extern class WasmExportedFunction extends JSFunction {}
extern class AsmWasmData extends Struct {
managed_native_module: Foreign; // Managed<wasm::NativeModule>
export_wrappers: FixedArray;
asm_js_offset_table: ByteArray;
uses_bitset: HeapNumber;
}
extern macro Is64(): constexpr bool;
extern macro SelectBooleanConstant(bool): Boolean;
......
......@@ -9412,8 +9412,8 @@ void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary,
var_value->Bind(value);
Node* details = LoadAndUntagToWord32ObjectField(property_cell,
PropertyCell::kDetailsOffset);
Node* details = LoadAndUntagToWord32ObjectField(
property_cell, PropertyCell::kPropertyDetailsRawOffset);
var_details->Bind(details);
Comment("] LoadPropertyFromGlobalDictionary");
......
......@@ -581,8 +581,8 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase(
CSA_ASSERT(this, IsPropertyCell(holder));
// Ensure the property cell doesn't contain the hole.
Node* value = LoadObjectField(holder, PropertyCell::kValueOffset);
Node* details =
LoadAndUntagToWord32ObjectField(holder, PropertyCell::kDetailsOffset);
Node* details = LoadAndUntagToWord32ObjectField(
holder, PropertyCell::kPropertyDetailsRawOffset);
GotoIf(IsTheHole(value), miss);
exit_point->Return(
......@@ -3178,8 +3178,8 @@ void AccessorAssembler::StoreGlobalIC_PropertyCellCase(Node* property_cell,
// runtime.
Node* cell_contents =
LoadObjectField(property_cell, PropertyCell::kValueOffset);
Node* details = LoadAndUntagToWord32ObjectField(property_cell,
PropertyCell::kDetailsOffset);
Node* details = LoadAndUntagToWord32ObjectField(
property_cell, PropertyCell::kPropertyDetailsRawOffset);
GotoIf(IsSetWord32(details, PropertyDetails::kAttributesReadOnlyMask), miss);
CSA_ASSERT(this,
Word32Equal(DecodeWord32<PropertyDetails::KindField>(details),
......
......@@ -665,7 +665,7 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain(
LoadObjectField(property_cell, PropertyCell::kValueOffset);
GotoIf(WordEqual(value, TheHoleConstant()), &next_proto);
Node* details = LoadAndUntagToWord32ObjectField(
property_cell, PropertyCell::kDetailsOffset);
property_cell, PropertyCell::kPropertyDetailsRawOffset);
JumpIfDataProperty(details, &ok_to_write, readonly);
if (accessor != nullptr) {
......
......@@ -254,15 +254,23 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
case JS_API_OBJECT_TYPE:
case JS_SPECIAL_API_OBJECT_TYPE:
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case WASM_EXCEPTION_TYPE:
case WASM_GLOBAL_TYPE:
case WASM_MEMORY_TYPE:
case WASM_TABLE_TYPE:
JSObject::cast(*this)->JSObjectVerify(isolate);
break;
case WASM_MODULE_TYPE:
WasmModuleObject::cast(*this)->WasmModuleObjectVerify(isolate);
break;
case WASM_TABLE_TYPE:
WasmTableObject::cast(*this)->WasmTableObjectVerify(isolate);
break;
case WASM_MEMORY_TYPE:
WasmMemoryObject::cast(*this)->WasmMemoryObjectVerify(isolate);
break;
case WASM_GLOBAL_TYPE:
WasmGlobalObject::cast(*this)->WasmGlobalObjectVerify(isolate);
break;
case WASM_EXCEPTION_TYPE:
WasmExceptionObject::cast(*this)->WasmExceptionObjectVerify(isolate);
break;
case WASM_INSTANCE_TYPE:
WasmInstanceObject::cast(*this)->WasmInstanceObjectVerify(isolate);
break;
......@@ -722,6 +730,7 @@ void FixedArray::FixedArrayVerify(Isolate* isolate) {
}
void WeakFixedArray::WeakFixedArrayVerify(Isolate* isolate) {
VerifySmiField(kLengthOffset);
for (int i = 0; i < length(); i++) {
MaybeObject::VerifyMaybeObjectPointer(isolate, Get(i));
}
......@@ -1222,7 +1231,12 @@ void Cell::CellVerify(Isolate* isolate) {
void PropertyCell::PropertyCellVerify(Isolate* isolate) {
CHECK(IsPropertyCell());
VerifyObjectField(isolate, kNameOffset);
CHECK(name()->IsName());
VerifySmiField(kPropertyDetailsRawOffset);
VerifyObjectField(isolate, kValueOffset);
VerifyObjectField(isolate, kDependentCodeOffset);
CHECK(dependent_code()->IsDependentCode());
}
void CodeDataContainer::CodeDataContainerVerify(Isolate* isolate) {
......@@ -1870,8 +1884,11 @@ void ArrayBoilerplateDescription::ArrayBoilerplateDescriptionVerify(
void AsmWasmData::AsmWasmDataVerify(Isolate* isolate) {
CHECK(IsAsmWasmData());
CHECK(managed_native_module()->IsForeign());
VerifyObjectField(isolate, kManagedNativeModuleOffset);
CHECK(export_wrappers()->IsFixedArray());
VerifyObjectField(isolate, kExportWrappersOffset);
CHECK(asm_js_offset_table()->IsByteArray());
VerifyObjectField(isolate, kAsmJsOffsetTableOffset);
CHECK(uses_bitset()->IsHeapNumber());
VerifyObjectField(isolate, kUsesBitsetOffset);
......@@ -1928,10 +1945,47 @@ void WasmModuleObject::WasmModuleObjectVerify(Isolate* isolate) {
VerifyObjectField(isolate, kExportWrappersOffset);
CHECK(export_wrappers()->IsFixedArray());
VerifyObjectField(isolate, kScriptOffset);
CHECK(script()->IsScript());
VerifyObjectField(isolate, kWeakInstanceListOffset);
VerifyObjectField(isolate, kAsmJsOffsetTableOffset);
VerifyObjectField(isolate, kBreakPointInfosOffset);
}
void WasmTableObject::WasmTableObjectVerify(Isolate* isolate) {
CHECK(IsWasmTableObject());
VerifyObjectField(isolate, kElementsOffset);
CHECK(elements()->IsFixedArray());
VerifyObjectField(isolate, kMaximumLengthOffset);
CHECK(maximum_length()->IsSmi() || maximum_length()->IsHeapNumber() ||
maximum_length()->IsUndefined(isolate));
VerifyObjectField(isolate, kDispatchTablesOffset);
VerifySmiField(kRawTypeOffset);
}
void WasmMemoryObject::WasmMemoryObjectVerify(Isolate* isolate) {
CHECK(IsWasmMemoryObject());
VerifyObjectField(isolate, kArrayBufferOffset);
CHECK(array_buffer()->IsJSArrayBuffer());
VerifySmiField(kMaximumPagesOffset);
VerifyObjectField(isolate, kInstancesOffset);
}
void WasmGlobalObject::WasmGlobalObjectVerify(Isolate* isolate) {
CHECK(IsWasmGlobalObject());
VerifyObjectField(isolate, kUntaggedBufferOffset);
VerifyObjectField(isolate, kTaggedBufferOffset);
VerifyObjectField(isolate, kOffsetOffset);
VerifyObjectField(isolate, kFlagsOffset);
}
void WasmExceptionObject::WasmExceptionObjectVerify(Isolate* isolate) {
CHECK(IsWasmExceptionObject());
VerifyObjectField(isolate, kSerializedSignatureOffset);
CHECK(serialized_signature()->IsByteArray());
VerifyObjectField(isolate, kExceptionTagOffset);
CHECK(exception_tag()->IsHeapObject());
}
void DataHandler::DataHandlerVerify(Isolate* isolate) {
CHECK(IsDataHandler());
CHECK_IMPLIES(!smi_handler()->IsSmi(),
......
......@@ -228,14 +228,20 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
case JS_ERROR_TYPE:
// TODO(titzer): debug printing for more wasm objects
case WASM_EXCEPTION_TYPE:
case WASM_GLOBAL_TYPE:
case WASM_MEMORY_TYPE:
case WASM_TABLE_TYPE:
JSObject::cast(*this)->JSObjectPrint(os);
break;
case WASM_MODULE_TYPE:
WasmModuleObject::cast(*this)->WasmModuleObjectPrint(os);
break;
case WASM_MEMORY_TYPE:
WasmMemoryObject::cast(*this)->WasmMemoryObjectPrint(os);
break;
case WASM_TABLE_TYPE:
WasmTableObject::cast(*this)->WasmTableObjectPrint(os);
break;
case WASM_GLOBAL_TYPE:
WasmGlobalObject::cast(*this)->WasmGlobalObjectPrint(os);
break;
case WASM_INSTANCE_TYPE:
WasmInstanceObject::cast(*this)->WasmInstanceObjectPrint(os);
break;
......@@ -1879,6 +1885,42 @@ void WasmModuleObject::WasmModuleObjectPrint(std::ostream& os) { // NOLINT
os << "\n";
}
void WasmTableObject::WasmTableObjectPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmTableObject");
os << "\n - elements: " << Brief(elements());
os << "\n - maximum_length: " << Brief(maximum_length());
os << "\n - dispatch_tables: " << Brief(dispatch_tables());
os << "\n - raw_type: " << raw_type();
os << "\n";
}
void WasmGlobalObject::WasmGlobalObjectPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmGlobalObject");
os << "\n - untagged_buffer: " << Brief(untagged_buffer());
os << "\n - tagged_buffer: " << Brief(tagged_buffer());
os << "\n - offset: " << offset();
os << "\n - flags: " << flags();
os << "\n - type: " << type();
os << "\n - is_mutable: " << is_mutable();
os << "\n";
}
void WasmMemoryObject::WasmMemoryObjectPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmMemoryObject");
os << "\n - array_buffer: " << Brief(array_buffer());
os << "\n - maximum_pages: " << maximum_pages();
os << "\n - instances: " << Brief(instances());
os << "\n";
}
void WasmExceptionObject::WasmExceptionObjectPrint(
std::ostream& os) { // NOLINT
PrintHeader(os, "WasmExceptionObject");
os << "\n - serialized_signature: " << Brief(serialized_signature());
os << "\n - exception_tag: " << Brief(exception_tag());
os << "\n";
}
void LoadHandler::LoadHandlerPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "LoadHandler");
// TODO(ishell): implement printing based on handler kind
......
......@@ -301,15 +301,9 @@ class WeakFixedArray : public HeapObject {
using BodyDescriptor = WeakArrayBodyDescriptor;
// Layout description.
#define WEAK_FIXED_ARRAY_FIELDS(V) \
V(kLengthOffset, kTaggedSize) \
/* Header size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
WEAK_FIXED_ARRAY_FIELDS)
#undef WEAK_FIXED_ARRAY_FIELDS
TORQUE_GENERATED_WEAK_FIXED_ARRAY_FIELDS)
static constexpr int kHeaderSize = kSize;
static const int kMaxLength =
(FixedArray::kMaxSize - kHeaderSize) / kTaggedSize;
......
......@@ -33,18 +33,8 @@ class PromiseReactionJobTask : public Microtask {
// a PromiseCapability (general case), or undefined (in case of await).
DECL_ACCESSORS(promise_or_capability, HeapObject)
// Layout description.
#define PROMISE_REACTION_JOB_FIELDS(V) \
V(kArgumentOffset, kTaggedSize) \
V(kContextOffset, kTaggedSize) \
V(kHandlerOffset, kTaggedSize) \
V(kPromiseOrCapabilityOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(Microtask::kHeaderSize,
PROMISE_REACTION_JOB_FIELDS)
#undef PROMISE_REACTION_JOB_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(
Microtask::kHeaderSize, TORQUE_GENERATED_PROMISE_REACTION_JOB_TASK_FIELDS)
// Dispatched behavior.
DECL_CAST(PromiseReactionJobTask)
......@@ -83,18 +73,9 @@ class PromiseResolveThenableJobTask : public Microtask {
DECL_ACCESSORS(then, JSReceiver)
DECL_ACCESSORS(thenable, JSReceiver)
// Layout description.
#define PROMISE_RESOLVE_THENABLE_JOB_FIELDS(V) \
V(kContextOffset, kTaggedSize) \
V(kPromiseToResolveOffset, kTaggedSize) \
V(kThenOffset, kTaggedSize) \
V(kThenableOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(Microtask::kHeaderSize,
PROMISE_RESOLVE_THENABLE_JOB_FIELDS)
#undef PROMISE_RESOLVE_THENABLE_JOB_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(
Microtask::kHeaderSize,
TORQUE_GENERATED_PROMISE_RESOLVE_THENABLE_JOB_TASK_FIELDS)
// Dispatched behavior.
DECL_CAST(PromiseResolveThenableJobTask)
......
......@@ -22,7 +22,7 @@ CAST_ACCESSOR(PropertyCell)
ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset)
ACCESSORS(PropertyCell, name, Name, kNameOffset)
ACCESSORS(PropertyCell, value, Object, kValueOffset)
ACCESSORS(PropertyCell, property_details_raw, Object, kDetailsOffset)
ACCESSORS(PropertyCell, property_details_raw, Smi, kPropertyDetailsRawOffset)
PropertyDetails PropertyCell::property_details() const {
return PropertyDetails(Smi::cast(property_details_raw()));
......
......@@ -6,6 +6,7 @@
#define V8_OBJECTS_PROPERTY_CELL_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"
......@@ -18,7 +19,7 @@ class PropertyCell : public HeapObject {
// [name]: the name of the global property.
DECL_ACCESSORS(name, Name)
// [property_details]: details of the global property.
DECL_ACCESSORS(property_details_raw, Object)
DECL_ACCESSORS(property_details_raw, Smi)
// [value]: value of the global property.
DECL_ACCESSORS(value, Object)
// [dependent_code]: dependent code that depends on the type of the global
......@@ -56,17 +57,8 @@ class PropertyCell : public HeapObject {
DECL_PRINTER(PropertyCell)
DECL_VERIFIER(PropertyCell)
// Layout description.
#define PROPERTY_CELL_FIELDS(V) \
V(kDetailsOffset, kTaggedSize) \
V(kNameOffset, kTaggedSize) \
V(kValueOffset, kTaggedSize) \
V(kDependentCodeOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, PROPERTY_CELL_FIELDS)
#undef PROPERTY_CELL_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_PROPERTY_CELL_FIELDS)
using BodyDescriptor = FixedBodyDescriptor<kNameOffset, kSize, kSize>;
......
......@@ -57,6 +57,9 @@ class V8_EXPORT_PRIVATE RegExpMatchInfo : NON_EXPORTED_BASE(public FixedArray) {
static const int kFirstCaptureIndex = 3;
static const int kLastMatchOverhead = kFirstCaptureIndex;
DEFINE_FIELD_OFFSET_CONSTANTS(FixedArray::kHeaderSize,
TORQUE_GENERATED_REG_EXP_MATCH_INFO_FIELDS)
// Every match info is guaranteed to have enough space to store two captures.
static const int kInitialCaptureIndices = 2;
......
......@@ -783,17 +783,17 @@ Handle<WasmTableObject> WasmTableObject::New(Isolate* isolate,
uint32_t initial, bool has_maximum,
uint32_t maximum,
Handle<FixedArray>* elements) {
Handle<JSFunction> table_ctor(
isolate->native_context()->wasm_table_constructor(), isolate);
auto table_obj = Handle<WasmTableObject>::cast(
isolate->factory()->NewJSObject(table_ctor));
Handle<FixedArray> backing_store = isolate->factory()->NewFixedArray(initial);
Object null = ReadOnlyRoots(isolate).null_value();
for (int i = 0; i < static_cast<int>(initial); ++i) {
backing_store->set(i, null);
}
Handle<JSFunction> table_ctor(
isolate->native_context()->wasm_table_constructor(), isolate);
auto table_obj = Handle<WasmTableObject>::cast(
isolate->factory()->NewJSObject(table_ctor));
table_obj->set_raw_type(static_cast<int>(type));
table_obj->set_elements(*backing_store);
Handle<Object> max;
......@@ -1149,20 +1149,21 @@ void SetInstanceMemory(Handle<WasmInstanceObject> instance,
Handle<WasmMemoryObject> WasmMemoryObject::New(
Isolate* isolate, MaybeHandle<JSArrayBuffer> maybe_buffer,
uint32_t maximum) {
Handle<JSArrayBuffer> buffer;
if (!maybe_buffer.ToHandle(&buffer)) {
// If no buffer was provided, create a 0-length one.
buffer = wasm::SetupArrayBuffer(isolate, nullptr, 0, false);
}
// TODO(kschimpf): Do we need to add an argument that defines the
// style of memory the user prefers (with/without trap handling), so
// that the memory will match the style of the compiled wasm module.
// See issue v8:7143
Handle<JSFunction> memory_ctor(
isolate->native_context()->wasm_memory_constructor(), isolate);
auto memory_obj = Handle<WasmMemoryObject>::cast(
isolate->factory()->NewJSObject(memory_ctor, AllocationType::kOld));
Handle<JSArrayBuffer> buffer;
if (!maybe_buffer.ToHandle(&buffer)) {
// If no buffer was provided, create a 0-length one.
buffer = wasm::SetupArrayBuffer(isolate, nullptr, 0, false);
}
memory_obj->set_array_buffer(*buffer);
memory_obj->set_maximum_pages(maximum);
......@@ -1766,10 +1767,6 @@ Handle<WasmExceptionObject> WasmExceptionObject::New(
Handle<HeapObject> exception_tag) {
Handle<JSFunction> exception_cons(
isolate->native_context()->wasm_exception_constructor(), isolate);
Handle<JSObject> exception_object =
isolate->factory()->NewJSObject(exception_cons, AllocationType::kOld);
Handle<WasmExceptionObject> exception =
Handle<WasmExceptionObject>::cast(exception_object);
// Serialize the signature.
DCHECK_EQ(0, sig->return_count());
......@@ -1781,6 +1778,11 @@ Handle<WasmExceptionObject> WasmExceptionObject::New(
for (wasm::ValueType param : sig->parameters()) {
serialized_sig->set(index++, param);
}
Handle<JSObject> exception_object =
isolate->factory()->NewJSObject(exception_cons, AllocationType::kOld);
Handle<WasmExceptionObject> exception =
Handle<WasmExceptionObject>::cast(exception_object);
exception->set_serialized_signature(*serialized_sig);
exception->set_exception_tag(*exception_tag);
......
......@@ -129,19 +129,8 @@ class WasmModuleObject : public JSObject {
DECL_PRINTER(WasmModuleObject)
DECL_VERIFIER(WasmModuleObject)
// Layout description.
#define WASM_MODULE_OBJECT_FIELDS(V) \
V(kNativeModuleOffset, kTaggedSize) \
V(kExportWrappersOffset, kTaggedSize) \
V(kScriptOffset, kTaggedSize) \
V(kWeakInstanceListOffset, kTaggedSize) \
V(kAsmJsOffsetTableOffset, kTaggedSize) \
V(kBreakPointInfosOffset, kTaggedSize) \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
WASM_MODULE_OBJECT_FIELDS)
#undef WASM_MODULE_OBJECT_FIELDS
TORQUE_GENERATED_WASM_MODULE_OBJECT_FIELDS)
// Creates a new {WasmModuleObject} with a new {NativeModule} underneath.
V8_EXPORT_PRIVATE static Handle<WasmModuleObject> New(
......@@ -264,16 +253,12 @@ class V8_EXPORT_PRIVATE WasmTableObject : public JSObject {
DECL_ACCESSORS(dispatch_tables, FixedArray)
DECL_INT_ACCESSORS(raw_type)
// Layout description.
#define WASM_TABLE_OBJECT_FIELDS(V) \
V(kElementsOffset, kTaggedSize) \
V(kMaximumLengthOffset, kTaggedSize) \
V(kDispatchTablesOffset, kTaggedSize) \
V(kRawTypeOffset, kTaggedSize) \
V(kSize, 0)
// Dispatched behavior.
DECL_PRINTER(WasmTableObject)
DECL_VERIFIER(WasmTableObject)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, WASM_TABLE_OBJECT_FIELDS)
#undef WASM_TABLE_OBJECT_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_WASM_TABLE_OBJECT_FIELDS)
inline uint32_t current_length();
inline wasm::ValueType type();
......@@ -337,16 +322,12 @@ class WasmMemoryObject : public JSObject {
DECL_INT_ACCESSORS(maximum_pages)
DECL_OPTIONAL_ACCESSORS(instances, WeakArrayList)
// Layout description.
#define WASM_MEMORY_OBJECT_FIELDS(V) \
V(kArrayBufferOffset, kTaggedSize) \
V(kMaximumPagesOffset, kTaggedSize) \
V(kInstancesOffset, kTaggedSize) \
V(kSize, 0)
// Dispatched behavior.
DECL_PRINTER(WasmMemoryObject)
DECL_VERIFIER(WasmMemoryObject)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
WASM_MEMORY_OBJECT_FIELDS)
#undef WASM_MEMORY_OBJECT_FIELDS
TORQUE_GENERATED_WASM_MEMORY_OBJECT_FIELDS)
// Add an instance to the internal (weak) list.
V8_EXPORT_PRIVATE static void AddInstance(Isolate* isolate,
......@@ -385,6 +366,10 @@ class WasmGlobalObject : public JSObject {
DECL_PRIMITIVE_ACCESSORS(type, wasm::ValueType)
DECL_BOOLEAN_ACCESSORS(is_mutable)
// Dispatched behavior.
DECL_PRINTER(WasmGlobalObject)
DECL_VERIFIER(WasmGlobalObject)
#define WASM_GLOBAL_OBJECT_FLAGS_BIT_FIELDS(V, _) \
V(TypeBits, wasm::ValueType, 8, _) \
V(IsMutableBit, bool, 1, _)
......@@ -393,17 +378,8 @@ class WasmGlobalObject : public JSObject {
#undef WASM_GLOBAL_OBJECT_FLAGS_BIT_FIELDS
// Layout description.
#define WASM_GLOBAL_OBJECT_FIELDS(V) \
V(kUntaggedBufferOffset, kTaggedSize) \
V(kTaggedBufferOffset, kTaggedSize) \
V(kOffsetOffset, kTaggedSize) \
V(kFlagsOffset, kTaggedSize) \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
WASM_GLOBAL_OBJECT_FIELDS)
#undef WASM_GLOBAL_OBJECT_FIELDS
TORQUE_GENERATED_WASM_GLOBAL_OBJECT_FIELDS)
V8_EXPORT_PRIVATE static MaybeHandle<WasmGlobalObject> New(
Isolate* isolate, MaybeHandle<JSArrayBuffer> maybe_untagged_buffer,
......@@ -621,15 +597,12 @@ class WasmExceptionObject : public JSObject {
DECL_ACCESSORS(serialized_signature, PodArray<wasm::ValueType>)
DECL_ACCESSORS(exception_tag, HeapObject)
// Layout description.
#define WASM_EXCEPTION_OBJECT_FIELDS(V) \
V(kSerializedSignatureOffset, kTaggedSize) \
V(kExceptionTagOffset, kTaggedSize) \
V(kSize, 0)
// Dispatched behavior.
DECL_PRINTER(WasmExceptionObject)
DECL_VERIFIER(WasmExceptionObject)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
WASM_EXCEPTION_OBJECT_FIELDS)
#undef WASM_EXCEPTION_OBJECT_FIELDS
TORQUE_GENERATED_WASM_EXCEPTION_OBJECT_FIELDS)
// Checks whether the given {sig} has the same parameter types as the
// serialized signature stored within this exception object.
......@@ -831,17 +804,8 @@ class AsmWasmData : public Struct {
DECL_PRINTER(AsmWasmData)
DECL_VERIFIER(AsmWasmData)
// Layout description.
#define ASM_WASM_DATA_FIELDS(V) \
V(kManagedNativeModuleOffset, kTaggedSize) \
V(kExportWrappersOffset, kTaggedSize) \
V(kAsmJsOffsetTableOffset, kTaggedSize) \
V(kUsesBitsetOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, ASM_WASM_DATA_FIELDS)
#undef ASM_WASM_DATA_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
TORQUE_GENERATED_ASM_WASM_DATA_FIELDS)
OBJECT_CONSTRUCTORS(AsmWasmData, Struct);
};
......
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