Commit 37b4c060 authored by Francis McCabe's avatar Francis McCabe Committed by Commit Bot

Revert "Torquefy a few more types"

This reverts commit a1fdd521.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Torquefy a few more types
> 
> WeakFixedArray, WeakArrayList, JSFinalizationGroup, JSFinalizationGroupCleanupIterator, WeakCell, JSWeakRef, BytecodeArray, SourcePositionWithFrameCache
> 
> Bug: v8:8952
> 
> Change-Id: I9708b08e11603977aeab7bce94b8233a41700ccb
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1504433
> Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#60688}

TBR=rmcilroy@chromium.org,jgruber@chromium.org,irinayat@microsoft.com

Change-Id: I55b3571763ea054e47d8bef855769e8ca9a1545d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:8952
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1559210Reviewed-by: 's avatarFrancis McCabe <fgm@chromium.org>
Commit-Queue: Francis McCabe <fgm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60689}
parent a1fdd521
......@@ -1090,11 +1090,11 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ mov(r9, Operand(0));
__ strh(r9, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOsrNestingLevelOffset));
BytecodeArray::kOSRNestingLevelOffset));
// Load the initial bytecode offset.
__ mov(kInterpreterBytecodeOffsetRegister,
......
......@@ -1219,10 +1219,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ Strh(wzr, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOsrNestingLevelOffset));
BytecodeArray::kOSRNestingLevelOffset));
// Load the initial bytecode offset.
__ Mov(kInterpreterBytecodeOffsetRegister,
......
......@@ -14,7 +14,6 @@
#include 'src/objects/js-generator.h'
#include 'src/objects/js-promise.h'
#include 'src/objects/js-regexp-string-iterator.h'
#include 'src/objects/js-weak-refs.h'
#include 'src/objects/module.h'
#include 'src/objects/stack-frame-info.h'
......@@ -33,7 +32,6 @@ type Zero extends PositiveSmi;
extern class HeapObject extends Tagged { map: Map; }
type Object = Smi | HeapObject;
type int32 generates 'TNode<Int32T>' constexpr 'int32_t';
type uint32 generates 'TNode<Uint32T>' constexpr 'uint32_t';
type int31 extends int32
......@@ -272,6 +270,7 @@ transient type FastJSArrayWithNoCustomIteration extends FastJSArray;
type NoSharedNameSentinel extends Smi;
type JSModuleNamespace extends JSObject;
type WeakArrayList extends HeapObject;
extern class JSWeakCollection extends JSObject { table: Object; }
extern class JSWeakSet extends JSWeakCollection {}
......@@ -295,13 +294,6 @@ extern class JSMessageObject extends JSObject {
error_level: Smi;
}
extern class WeakArrayList extends HeapObject {
capacity: Smi;
length: Smi;
// TODO(v8:8983): declare variable-sized region for contained MaybeObject's
// objects[length]: MaybeObject;
}
extern class PrototypeInfo extends Struct {
js_module_namespace: JSModuleNamespace | Undefined;
prototype_users: WeakArrayList | Zero;
......@@ -915,60 +907,6 @@ extern class AccessorPair extends Struct {
extern class BreakPoint extends Tuple2 {}
extern class BreakPointInfo extends Tuple2 {}
extern class WeakFixedArray extends HeapObject {
length: Smi;
// TODO(v8:8983): declare variable-sized region for contained MaybeObject's
// objects[length]: MaybeObject;
}
extern class JSFinalizationGroup extends JSObject {
// TODO: test-js-weak-refs doesn't init the fields so they are Undefined but
// this shouldn't happen in production for context, cleanup, key_map, flags
native_context: NativeContext;
cleanup: Object;
active_cells: Undefined | WeakCell;
cleared_cells: Undefined | WeakCell;
key_map: Object;
next: Undefined | JSFinalizationGroup;
flags: Smi;
}
extern class JSFinalizationGroupCleanupIterator extends JSObject {
finalization_group: JSFinalizationGroup;
}
extern class WeakCell extends HeapObject {
finalization_group: Undefined | JSFinalizationGroup;
target: Undefined | JSReceiver;
holdings: Object;
prev: Undefined | WeakCell;
next: Undefined | WeakCell;
key: Object;
key_list_prev: Undefined | WeakCell;
key_list_next: Undefined | WeakCell;
}
extern class JSWeakRef extends JSObject { target: Undefined | JSReceiver; }
extern class SourcePositionTableWithFrameCache extends Struct {
source_position_table: ByteArray;
stack_frame_cache: Object;
}
extern class BytecodeArray extends FixedArrayBase {
// TODO(v8:8983): bytecode array object sizes vary based on their contents.
constant_pool: FixedArray;
handler_table: ByteArray;
source_position_table: Undefined | ByteArray |
SourcePositionTableWithFrameCache;
frame_size: int32;
parameter_size: int32;
incoming_new_target_or_generator_register: int32;
interrupt_budget: int32;
osr_nesting_level: int8;
bytecode_age: int8;
}
extern macro Is64(): constexpr bool;
extern macro SelectBooleanConstant(bool): Boolean;
......
......@@ -1018,10 +1018,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ mov_w(FieldOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOsrNestingLevelOffset),
BytecodeArray::kOSRNestingLevelOffset),
Immediate(0));
// Push bytecode array.
......
......@@ -1105,12 +1105,12 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ li(r8, Operand(0));
__ StoreHalfWord(r8,
FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOsrNestingLevelOffset),
BytecodeArray::kOSRNestingLevelOffset),
r0);
// Load initial bytecode offset.
......
......@@ -1156,12 +1156,12 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ lghi(r1, Operand(0));
__ StoreHalfWord(r1,
FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOsrNestingLevelOffset),
BytecodeArray::kOSRNestingLevelOffset),
r0);
// Load the initial bytecode offset.
......
......@@ -1105,10 +1105,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// 8-bit fields next to each other, so we could just optimize by writing a
// 16-bit. These static asserts guard our assumption is valid.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
BytecodeArray::kOsrNestingLevelOffset + kCharSize);
BytecodeArray::kOSRNestingLevelOffset + kCharSize);
STATIC_ASSERT(BytecodeArray::kNoAgeBytecodeAge == 0);
__ movw(FieldOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kOsrNestingLevelOffset),
BytecodeArray::kOSRNestingLevelOffset),
Immediate(0));
// Load initial bytecode offset.
......
......@@ -1528,9 +1528,9 @@ void InterpreterAssembler::UpdateInterruptBudgetOnReturn() {
UpdateInterruptBudget(profiling_weight, true);
}
Node* InterpreterAssembler::LoadOsrNestingLevel() {
Node* InterpreterAssembler::LoadOSRNestingLevel() {
return LoadObjectField(BytecodeArrayTaggedPointer(),
BytecodeArray::kOsrNestingLevelOffset,
BytecodeArray::kOSRNestingLevelOffset,
MachineType::Int8());
}
......
......@@ -237,7 +237,7 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
void UpdateInterruptBudgetOnReturn();
// Returns the OSR nesting level from the bytecode header.
compiler::Node* LoadOsrNestingLevel();
compiler::Node* LoadOSRNestingLevel();
// Dispatch to the bytecode.
compiler::Node* Dispatch();
......
......@@ -2338,7 +2338,7 @@ IGNITION_HANDLER(JumpIfJSReceiverConstant, InterpreterAssembler) {
IGNITION_HANDLER(JumpLoop, InterpreterAssembler) {
Node* relative_jump = BytecodeOperandUImmWord(0);
Node* loop_depth = BytecodeOperandImm(1);
Node* osr_level = LoadOsrNestingLevel();
Node* osr_level = LoadOSRNestingLevel();
// Check if OSR points at the given {loop_depth} are armed by comparing it to
// the current {osr_level} loaded from the header of the BytecodeArray.
......
......@@ -489,10 +489,6 @@ void BytecodeArray::BytecodeArrayVerify(Isolate* isolate) {
// - No consecutive sequences of prefix Wide / ExtraWide.
CHECK(IsBytecodeArray());
CHECK(constant_pool()->IsFixedArray());
CHECK(source_position_table()->IsUndefined() ||
source_position_table()->IsByteArray() ||
source_position_table()->IsSourcePositionTableWithFrameCache());
CHECK(handler_table()->IsByteArray());
VerifyHeapPointer(isolate, constant_pool());
}
......@@ -725,15 +721,12 @@ void FixedArray::FixedArrayVerify(Isolate* isolate) {
}
void WeakFixedArray::WeakFixedArrayVerify(Isolate* isolate) {
VerifySmiField(kLengthOffset);
for (int i = 0; i < length(); i++) {
MaybeObject::VerifyMaybeObjectPointer(isolate, Get(i));
}
}
void WeakArrayList::WeakArrayListVerify(Isolate* isolate) {
VerifySmiField(kCapacityOffset);
VerifySmiField(kLengthOffset);
for (int i = 0; i < length(); i++) {
MaybeObject::VerifyMaybeObjectPointer(isolate, Get(i));
}
......@@ -1387,7 +1380,6 @@ void JSFinalizationGroup::JSFinalizationGroupVerify(Isolate* isolate) {
if (cleared_cells()->IsWeakCell()) {
CHECK(WeakCell::cast(cleared_cells())->prev()->IsUndefined(isolate));
}
CHECK(next()->IsUndefined(isolate) || next()->IsJSFinalizationGroup());
}
void JSFinalizationGroupCleanupIterator::
......@@ -1853,12 +1845,6 @@ void Tuple3::Tuple3Verify(Isolate* isolate) {
VerifyObjectField(isolate, kValue3Offset);
}
void SourcePositionTableWithFrameCache::SourcePositionTableWithFrameCacheVerify(
Isolate* isolate) {
CHECK(source_position_table()->IsByteArray());
VerifyObjectField(isolate, kStackFrameCacheOffset);
}
void ClassPositions::ClassPositionsVerify(Isolate* isolate) {
CHECK(IsClassPositions());
VerifySmiField(kStartOffset);
......
......@@ -1781,14 +1781,6 @@ void Tuple3::Tuple3Print(std::ostream& os) { // NOLINT
os << "\n";
}
void SourcePositionTableWithFrameCache::SourcePositionTableWithFrameCachePrint(
std::ostream& os) {
PrintHeader(os, "SourcePositionTableWithFrameCache");
os << "\n - source position table: " << Brief(source_position_table());
os << "\n - stack frame cache: " << Brief(stack_frame_cache());
os << "\n";
}
void ClassPositions::ClassPositionsPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "ClassPositions");
os << "\n - start position: " << start();
......
......@@ -29,7 +29,7 @@ OBJECT_CONSTRUCTORS_IMPL(BytecodeArray, FixedArrayBase)
OBJECT_CONSTRUCTORS_IMPL(AbstractCode, HeapObject)
OBJECT_CONSTRUCTORS_IMPL(DependentCode, WeakFixedArray)
OBJECT_CONSTRUCTORS_IMPL(CodeDataContainer, HeapObject)
OBJECT_CONSTRUCTORS_IMPL(SourcePositionTableWithFrameCache, Struct)
OBJECT_CONSTRUCTORS_IMPL(SourcePositionTableWithFrameCache, Tuple2)
NEVER_READ_ONLY_SPACE_IMPL(AbstractCode)
......@@ -42,9 +42,9 @@ CAST_ACCESSOR(DeoptimizationData)
CAST_ACCESSOR(SourcePositionTableWithFrameCache)
ACCESSORS(SourcePositionTableWithFrameCache, source_position_table, ByteArray,
kSourcePositionTableOffset)
kSourcePositionTableIndex)
ACCESSORS(SourcePositionTableWithFrameCache, stack_frame_cache,
SimpleNumberDictionary, kStackFrameCacheOffset)
SimpleNumberDictionary, kStackFrameCacheIndex)
int AbstractCode::raw_instruction_size() {
if (IsCode()) {
......@@ -624,32 +624,32 @@ void BytecodeArray::set(int index, byte value) {
WRITE_BYTE_FIELD(*this, kHeaderSize + index * kCharSize, value);
}
void BytecodeArray::set_frame_size(int32_t frame_size) {
void BytecodeArray::set_frame_size(int frame_size) {
DCHECK_GE(frame_size, 0);
DCHECK(IsAligned(frame_size, kSystemPointerSize));
WRITE_INT32_FIELD(*this, kFrameSizeOffset, frame_size);
WRITE_INT_FIELD(*this, kFrameSizeOffset, frame_size);
}
int32_t BytecodeArray::frame_size() const {
return READ_INT32_FIELD(*this, kFrameSizeOffset);
int BytecodeArray::frame_size() const {
return READ_INT_FIELD(*this, kFrameSizeOffset);
}
int BytecodeArray::register_count() const {
return frame_size() / kSystemPointerSize;
}
void BytecodeArray::set_parameter_count(int32_t number_of_parameters) {
void BytecodeArray::set_parameter_count(int number_of_parameters) {
DCHECK_GE(number_of_parameters, 0);
// Parameter count is stored as the size on stack of the parameters to allow
// it to be used directly by generated code.
WRITE_INT32_FIELD(*this, kParameterSizeOffset,
WRITE_INT_FIELD(*this, kParameterSizeOffset,
(number_of_parameters << kSystemPointerSizeLog2));
}
interpreter::Register BytecodeArray::incoming_new_target_or_generator_register()
const {
int register_operand =
READ_INT32_FIELD(*this, kIncomingNewTargetOrGeneratorRegisterOffset);
READ_INT_FIELD(*this, kIncomingNewTargetOrGeneratorRegisterOffset);
if (register_operand == 0) {
return interpreter::Register::invalid_value();
} else {
......@@ -660,33 +660,33 @@ interpreter::Register BytecodeArray::incoming_new_target_or_generator_register()
void BytecodeArray::set_incoming_new_target_or_generator_register(
interpreter::Register incoming_new_target_or_generator_register) {
if (!incoming_new_target_or_generator_register.is_valid()) {
WRITE_INT32_FIELD(*this, kIncomingNewTargetOrGeneratorRegisterOffset, 0);
WRITE_INT_FIELD(*this, kIncomingNewTargetOrGeneratorRegisterOffset, 0);
} else {
DCHECK(incoming_new_target_or_generator_register.index() <
register_count());
DCHECK_NE(0, incoming_new_target_or_generator_register.ToOperand());
WRITE_INT32_FIELD(*this, kIncomingNewTargetOrGeneratorRegisterOffset,
WRITE_INT_FIELD(*this, kIncomingNewTargetOrGeneratorRegisterOffset,
incoming_new_target_or_generator_register.ToOperand());
}
}
int32_t BytecodeArray::interrupt_budget() const {
return READ_INT32_FIELD(*this, kInterruptBudgetOffset);
int BytecodeArray::interrupt_budget() const {
return READ_INT_FIELD(*this, kInterruptBudgetOffset);
}
void BytecodeArray::set_interrupt_budget(int32_t interrupt_budget) {
void BytecodeArray::set_interrupt_budget(int interrupt_budget) {
DCHECK_GE(interrupt_budget, 0);
WRITE_INT32_FIELD(*this, kInterruptBudgetOffset, interrupt_budget);
WRITE_INT_FIELD(*this, kInterruptBudgetOffset, interrupt_budget);
}
int BytecodeArray::osr_loop_nesting_level() const {
return READ_INT8_FIELD(*this, kOsrNestingLevelOffset);
return READ_INT8_FIELD(*this, kOSRNestingLevelOffset);
}
void BytecodeArray::set_osr_loop_nesting_level(int depth) {
DCHECK(0 <= depth && depth <= AbstractCode::kMaxLoopNestingMarker);
STATIC_ASSERT(AbstractCode::kMaxLoopNestingMarker < kMaxInt8);
WRITE_INT8_FIELD(*this, kOsrNestingLevelOffset, depth);
WRITE_INT8_FIELD(*this, kOSRNestingLevelOffset, depth);
}
BytecodeArray::Age BytecodeArray::bytecode_age() const {
......@@ -705,8 +705,7 @@ void BytecodeArray::set_bytecode_age(BytecodeArray::Age age) {
int BytecodeArray::parameter_count() const {
// Parameter count is stored as the size on stack of the parameters to allow
// it to be used directly by generated code.
return READ_INT32_FIELD(*this, kParameterSizeOffset)
>> kSystemPointerSizeLog2;
return READ_INT_FIELD(*this, kParameterSizeOffset) >> kSystemPointerSizeLog2;
}
ACCESSORS(BytecodeArray, constant_pool, FixedArray, kConstantPoolOffset)
......
......@@ -741,14 +741,14 @@ class BytecodeArray : public FixedArrayBase {
// Accessors for frame size.
inline int frame_size() const;
inline void set_frame_size(int32_t frame_size);
inline void set_frame_size(int frame_size);
// Accessor for register count (derived from frame_size).
inline int register_count() const;
// Accessors for parameter count (including implicit 'this' receiver).
inline int32_t parameter_count() const;
inline void set_parameter_count(int32_t number_of_parameters);
inline int parameter_count() const;
inline void set_parameter_count(int number_of_parameters);
// Register used to pass the incoming new.target or generator object from the
// fucntion call.
......@@ -758,8 +758,8 @@ class BytecodeArray : public FixedArrayBase {
interpreter::Register incoming_new_target_or_generator_register);
// Accessors for profiling count.
inline int32_t interrupt_budget() const;
inline void set_interrupt_budget(int32_t interrupt_budget);
inline int interrupt_budget() const;
inline void set_interrupt_budget(int interrupt_budget);
// Accessors for OSR loop nesting level.
inline int osr_loop_nesting_level() const;
......@@ -831,15 +831,29 @@ class BytecodeArray : public FixedArrayBase {
// Compares only the bytecode array but not any of the header fields.
bool IsBytecodeEqual(const BytecodeArray other) const;
// Layout description.
// Layout description.
#define BYTECODE_ARRAY_FIELDS(V) \
/* Pointer fields. */ \
V(kConstantPoolOffset, kTaggedSize) \
V(kHandlerTableOffset, kTaggedSize) \
V(kSourcePositionTableOffset, kTaggedSize) \
V(kFrameSizeOffset, kIntSize) \
V(kParameterSizeOffset, kIntSize) \
V(kIncomingNewTargetOrGeneratorRegisterOffset, kIntSize) \
V(kInterruptBudgetOffset, kIntSize) \
V(kOSRNestingLevelOffset, kCharSize) \
V(kBytecodeAgeOffset, kCharSize) \
/* Total size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(FixedArrayBase::kHeaderSize,
TORQUE_GENERATED_BYTECODE_ARRAY_FIELDS)
static constexpr int kHeaderSize = kSize;
BYTECODE_ARRAY_FIELDS)
#undef BYTECODE_ARRAY_FIELDS
// InterpreterEntryTrampoline expects these fields to be next to each other
// and writes a 16-bit value to reset them.
STATIC_ASSERT(BytecodeArray::kBytecodeAgeOffset ==
kOsrNestingLevelOffset + kCharSize);
kOSRNestingLevelOffset + kCharSize);
// Maximal memory consumption for a single BytecodeArray.
static const int kMaxSize = 512 * MB;
......@@ -938,22 +952,25 @@ class DeoptimizationData : public FixedArray {
OBJECT_CONSTRUCTORS(DeoptimizationData, FixedArray);
};
class SourcePositionTableWithFrameCache : public Struct {
class SourcePositionTableWithFrameCache : public Tuple2 {
public:
DECL_ACCESSORS(source_position_table, ByteArray)
DECL_ACCESSORS(stack_frame_cache, SimpleNumberDictionary)
DECL_CAST(SourcePositionTableWithFrameCache)
DECL_PRINTER(SourcePositionTableWithFrameCache)
DECL_VERIFIER(SourcePositionTableWithFrameCache)
// Layout description.
#define SOURCE_POSITION_TABLE_WITH_FRAME_FIELDS(V) \
V(kSourcePositionTableIndex, kTaggedSize) \
V(kStackFrameCacheIndex, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(
Struct::kHeaderSize,
TORQUE_GENERATED_SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_FIELDS)
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
SOURCE_POSITION_TABLE_WITH_FRAME_FIELDS)
#undef SOURCE_POSITION_TABLE_WITH_FRAME_FIELDS
OBJECT_CONSTRUCTORS(SourcePositionTableWithFrameCache, Struct);
OBJECT_CONSTRUCTORS(SourcePositionTableWithFrameCache, Tuple2);
};
} // namespace internal
......
......@@ -302,9 +302,14 @@ 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,
TORQUE_GENERATED_WEAK_FIXED_ARRAY_FIELDS)
static constexpr int kHeaderSize = kSize;
WEAK_FIXED_ARRAY_FIELDS)
#undef WEAK_FIXED_ARRAY_FIELDS
static const int kMaxLength =
(FixedArray::kMaxSize - kHeaderSize) / kTaggedSize;
......@@ -366,9 +371,14 @@ class WeakArrayList : public HeapObject {
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_WEAK_ARRAY_LIST_FIELDS)
static constexpr int kHeaderSize = kSize;
#define WEAK_ARRAY_LIST_FIELDS(V) \
V(kCapacityOffset, kTaggedSize) \
V(kLengthOffset, kTaggedSize) \
/* Header size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, WEAK_ARRAY_LIST_FIELDS)
#undef WEAK_ARRAY_LIST_FIELDS
using BodyDescriptor = WeakArrayBodyDescriptor;
......
......@@ -60,9 +60,21 @@ class JSFinalizationGroup : public JSObject {
static void Cleanup(Handle<JSFinalizationGroup> finalization_group,
Isolate* isolate);
// Layout description.
// Layout description.
#define JS_FINALIZATION_GROUP_FIELDS(V) \
V(kNativeContextOffset, kTaggedSize) \
V(kCleanupOffset, kTaggedSize) \
V(kActiveCellsOffset, kTaggedSize) \
V(kClearedCellsOffset, kTaggedSize) \
V(kKeyMapOffset, kTaggedSize) \
V(kNextOffset, kTaggedSize) \
V(kFlagsOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSFINALIZATION_GROUP_FIELDS)
JS_FINALIZATION_GROUP_FIELDS)
#undef JS_FINALIZATION_GROUP_FIELDS
// Bitfields in flags.
class ScheduledForCleanupField : public BitField<bool, 0, 1> {};
......@@ -94,9 +106,21 @@ class WeakCell : public HeapObject {
DECL_ACCESSORS(key_list_prev, Object)
DECL_ACCESSORS(key_list_next, Object)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_WEAK_CELL_FIELDS)
// Layout description.
#define WEAK_CELL_FIELDS(V) \
V(kFinalizationGroupOffset, kTaggedSize) \
V(kTargetOffset, kTaggedSize) \
V(kHoldingsOffset, kTaggedSize) \
V(kPrevOffset, kTaggedSize) \
V(kNextOffset, kTaggedSize) \
V(kKeyOffset, kTaggedSize) \
V(kKeyListPrevOffset, kTaggedSize) \
V(kKeyListNextOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, WEAK_CELL_FIELDS)
#undef WEAK_CELL_FIELDS
class BodyDescriptor;
......@@ -122,9 +146,14 @@ class JSWeakRef : public JSObject {
DECL_ACCESSORS(target, HeapObject)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSWEAK_REF_FIELDS)
// Layout description.
#define JS_WEAK_REF_FIELDS(V) \
V(kTargetOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_WEAK_REF_FIELDS)
#undef JS_WEAK_REF_FIELDS
class BodyDescriptor;
......@@ -160,10 +189,15 @@ class JSFinalizationGroupCleanupIterator : public JSObject {
DECL_ACCESSORS(finalization_group, JSFinalizationGroup)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(
JSObject::kHeaderSize,
TORQUE_GENERATED_JSFINALIZATION_GROUP_CLEANUP_ITERATOR_FIELDS)
// Layout description.
#define JS_FINALIZATION_GROUP_CLEANUP_ITERATOR_FIELDS(V) \
V(kFinalizationGroupOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JS_FINALIZATION_GROUP_CLEANUP_ITERATOR_FIELDS)
#undef JS_FINALIZATION_GROUP_CLEANUP_ITERATOR_FIELDS
OBJECT_CONSTRUCTORS(JSFinalizationGroupCleanupIterator, JSObject);
};
......
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