[cleanup][torque] Use @generateCppClass in some simple cases, part 3
Just mechanical conversion to remove boilerplate code. When .tq and .h files didn't agree on what a field is named, I used the name from the .h file. In a couple of cases the generated accessor became slightly more specific (HeapObject instead of Object), and I had to update the code that uses those accessors accordingly. Change-Id: Ie3af1590e3889887b167c9d045b07860b01f7d15 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1776479 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Seth Brenith <seth.brenith@microsoft.com> Cr-Commit-Position: refs/heads/master@{#64142}
This commit is contained in:
parent
0cbbb88dfa
commit
07fc96c0a8
@ -678,10 +678,11 @@ extern class EmbedderDataArray extends HeapObject {
|
||||
|
||||
type ScopeInfo extends HeapObject generates 'TNode<ScopeInfo>';
|
||||
|
||||
@generateCppClass
|
||||
extern class PreparseData extends HeapObject {
|
||||
// TODO(v8:8983): Add declaration for variable-sized region.
|
||||
data_length: int32;
|
||||
inner_length: int32;
|
||||
children_length: int32;
|
||||
}
|
||||
|
||||
extern class InterpreterData extends Struct {
|
||||
@ -873,9 +874,12 @@ extern class JSAsyncFromSyncIterator extends JSObject {
|
||||
next: Object;
|
||||
}
|
||||
|
||||
@generateCppClass
|
||||
extern class JSStringIterator extends JSObject {
|
||||
// The [[IteratedString]] inobject property.
|
||||
string: String;
|
||||
next_index: Smi;
|
||||
// The [[StringIteratorNextIndex]] inobject property.
|
||||
index: Smi;
|
||||
}
|
||||
|
||||
@abstract
|
||||
@ -1532,6 +1536,7 @@ extern class AccessorInfo extends Struct {
|
||||
data: Object;
|
||||
}
|
||||
|
||||
@generateCppClass
|
||||
extern class AccessorPair extends Struct {
|
||||
getter: Object;
|
||||
setter: Object;
|
||||
@ -1541,12 +1546,19 @@ extern class BreakPoint extends Tuple2 {}
|
||||
extern class BreakPointInfo extends Tuple2 {}
|
||||
type CoverageInfo extends FixedArray;
|
||||
|
||||
@generateCppClass
|
||||
extern class DebugInfo extends Struct {
|
||||
shared_function_info: SharedFunctionInfo;
|
||||
shared: SharedFunctionInfo;
|
||||
debugger_hints: Smi;
|
||||
// Script field from shared function info.
|
||||
script: Undefined | Script;
|
||||
// The original uninstrumented bytecode array for functions with break
|
||||
// points - the instrumented bytecode is held in the shared function info.
|
||||
original_bytecode_array: Undefined | BytecodeArray;
|
||||
// The debug instrumented bytecode array for functions with break points
|
||||
// - also pointed to by the shared function info.
|
||||
debug_bytecode_array: Undefined | BytecodeArray;
|
||||
// Fixed array holding status information for each active break point.
|
||||
break_points: FixedArray;
|
||||
flags: Smi;
|
||||
coverage_info: CoverageInfo | Undefined;
|
||||
@ -1566,6 +1578,7 @@ extern class FeedbackVector extends HeapObject {
|
||||
padding: uint32;
|
||||
}
|
||||
|
||||
@generateCppClass
|
||||
extern class FeedbackCell extends Struct {
|
||||
value: Undefined | FeedbackVector | FixedArray;
|
||||
interrupt_budget: int32;
|
||||
@ -1629,22 +1642,35 @@ extern class JSFinalizationGroup extends JSObject {
|
||||
flags: Smi;
|
||||
}
|
||||
|
||||
@generateCppClass
|
||||
extern class JSFinalizationGroupCleanupIterator extends JSObject {
|
||||
finalization_group: JSFinalizationGroup;
|
||||
}
|
||||
|
||||
@generateCppClass
|
||||
extern class WeakCell extends HeapObject {
|
||||
finalization_group: Undefined | JSFinalizationGroup;
|
||||
target: Undefined | JSReceiver;
|
||||
holdings: Object;
|
||||
|
||||
// For storing doubly linked lists of WeakCells in JSFinalizationGroup's
|
||||
// "active_cells" and "cleared_cells" lists.
|
||||
prev: Undefined | WeakCell;
|
||||
next: Undefined | WeakCell;
|
||||
|
||||
// For storing doubly linked lists of WeakCells per key in
|
||||
// JSFinalizationGroup's key-based hashmap. WeakCell also needs to know its
|
||||
// key, so that we can remove the key from the key_map when we remove the last
|
||||
// WeakCell associated with it.
|
||||
key: Object;
|
||||
key_list_prev: Undefined | WeakCell;
|
||||
key_list_next: Undefined | WeakCell;
|
||||
}
|
||||
|
||||
extern class JSWeakRef extends JSObject { target: Undefined | JSReceiver; }
|
||||
@generateCppClass
|
||||
extern class JSWeakRef extends JSObject {
|
||||
target: Undefined | JSReceiver;
|
||||
}
|
||||
|
||||
extern class BytecodeArray extends FixedArrayBase {
|
||||
// TODO(v8:8983): bytecode array object sizes vary based on their contents.
|
||||
|
@ -11,7 +11,7 @@ namespace string_iterator {
|
||||
properties_or_hash: kEmptyFixedArray,
|
||||
elements: kEmptyFixedArray,
|
||||
string: string,
|
||||
next_index: nextIndex
|
||||
index: nextIndex
|
||||
};
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ namespace string_iterator {
|
||||
kIncompatibleMethodReceiver, 'String Iterator.prototype.next',
|
||||
receiver);
|
||||
const string = iterator.string;
|
||||
const position: intptr = SmiUntag(iterator.next_index);
|
||||
const position: intptr = SmiUntag(iterator.index);
|
||||
const length: intptr = string.length_intptr;
|
||||
if (position >= length) {
|
||||
return AllocateJSIteratorResult(Undefined, True);
|
||||
@ -40,7 +40,7 @@ namespace string_iterator {
|
||||
const encoding = UTF16;
|
||||
const ch = string::LoadSurrogatePairAt(string, length, position, encoding);
|
||||
const value: String = string::StringFromSingleUTF16EncodedCodePoint(ch);
|
||||
iterator.next_index = SmiTag(position + value.length_intptr);
|
||||
iterator.index = SmiTag(position + value.length_intptr);
|
||||
return AllocateJSIteratorResult(value, False);
|
||||
}
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ FieldAccess AccessBuilder::ForJSStringIteratorString() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSStringIteratorIndex() {
|
||||
FieldAccess access = {kTaggedBase,
|
||||
JSStringIterator::kNextIndexOffset,
|
||||
JSStringIterator::kIndexOffset,
|
||||
Handle<Name>(),
|
||||
MaybeHandle<Map>(),
|
||||
TypeCache::Get()->kStringLengthType,
|
||||
|
@ -1171,7 +1171,7 @@ void Debug::PrepareFunctionForDebugExecution(
|
||||
if (debug_info->flags() & DebugInfo::kPreparedForDebugExecution) return;
|
||||
|
||||
// Make a copy of the bytecode array if available.
|
||||
Handle<Object> maybe_original_bytecode_array =
|
||||
Handle<HeapObject> maybe_original_bytecode_array =
|
||||
isolate_->factory()->undefined_value();
|
||||
if (shared->HasBytecodeArray()) {
|
||||
Handle<BytecodeArray> original_bytecode_array =
|
||||
|
@ -513,8 +513,6 @@ void BytecodeArray::BytecodeArrayVerify(Isolate* isolate) {
|
||||
|
||||
USE_TORQUE_VERIFIER(FreeSpace)
|
||||
|
||||
USE_TORQUE_VERIFIER(FeedbackCell)
|
||||
|
||||
void FeedbackVector::FeedbackVectorVerify(Isolate* isolate) {
|
||||
TorqueGeneratedClassVerifiers::FeedbackVectorVerify(*this, isolate);
|
||||
MaybeObject code = optimized_code_weak_or_smi();
|
||||
@ -1688,8 +1686,6 @@ void StoreHandler::StoreHandlerVerify(Isolate* isolate) {
|
||||
|
||||
USE_TORQUE_VERIFIER(AccessorInfo)
|
||||
|
||||
USE_TORQUE_VERIFIER(AccessorPair)
|
||||
|
||||
void CallHandlerInfo::CallHandlerInfoVerify(Isolate* isolate) {
|
||||
TorqueGeneratedClassVerifiers::CallHandlerInfoVerify(*this, isolate);
|
||||
CHECK(map() == ReadOnlyRoots(isolate).side_effect_call_handler_info_map() ||
|
||||
@ -1742,8 +1738,6 @@ void NormalizedMapCache::NormalizedMapCacheVerify(Isolate* isolate) {
|
||||
}
|
||||
}
|
||||
|
||||
USE_TORQUE_VERIFIER(DebugInfo)
|
||||
|
||||
USE_TORQUE_VERIFIER(StackFrameInfo)
|
||||
|
||||
void PreparseData::PreparseDataVerify(Isolate* isolate) {
|
||||
|
@ -21,24 +21,16 @@ namespace internal {
|
||||
OBJECT_CONSTRUCTORS_IMPL(BreakPoint, Tuple2)
|
||||
OBJECT_CONSTRUCTORS_IMPL(BreakPointInfo, Tuple2)
|
||||
OBJECT_CONSTRUCTORS_IMPL(CoverageInfo, FixedArray)
|
||||
OBJECT_CONSTRUCTORS_IMPL(DebugInfo, Struct)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(DebugInfo)
|
||||
|
||||
NEVER_READ_ONLY_SPACE_IMPL(DebugInfo)
|
||||
|
||||
CAST_ACCESSOR(BreakPointInfo)
|
||||
CAST_ACCESSOR(DebugInfo)
|
||||
CAST_ACCESSOR(CoverageInfo)
|
||||
CAST_ACCESSOR(BreakPoint)
|
||||
|
||||
SMI_ACCESSORS(DebugInfo, flags, kFlagsOffset)
|
||||
ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
|
||||
SMI_ACCESSORS(DebugInfo, debugger_hints, kDebuggerHintsOffset)
|
||||
ACCESSORS(DebugInfo, script, Object, kScriptOffset)
|
||||
ACCESSORS(DebugInfo, original_bytecode_array, Object,
|
||||
kOriginalBytecodeArrayOffset)
|
||||
ACCESSORS(DebugInfo, debug_bytecode_array, Object, kDebugBytecodeArrayOffset)
|
||||
ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsOffset)
|
||||
ACCESSORS(DebugInfo, coverage_info, Object, kCoverageInfoOffset)
|
||||
TQ_SMI_ACCESSORS(DebugInfo, flags)
|
||||
TQ_SMI_ACCESSORS(DebugInfo, debugger_hints)
|
||||
|
||||
BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, side_effect_state,
|
||||
DebugInfo::SideEffectStateBits)
|
||||
|
@ -22,7 +22,7 @@ class BytecodeArray;
|
||||
|
||||
// The DebugInfo class holds additional information for a function being
|
||||
// debugged.
|
||||
class DebugInfo : public Struct {
|
||||
class DebugInfo : public TorqueGeneratedDebugInfo<DebugInfo, Struct> {
|
||||
public:
|
||||
NEVER_READ_ONLY_SPACE
|
||||
enum Flag {
|
||||
@ -40,15 +40,9 @@ class DebugInfo : public Struct {
|
||||
// A bitfield that lists uses of the current instance.
|
||||
DECL_INT_ACCESSORS(flags)
|
||||
|
||||
// The shared function info for the source being debugged.
|
||||
DECL_ACCESSORS(shared, SharedFunctionInfo)
|
||||
|
||||
// Bit field containing various information collected for debugging.
|
||||
DECL_INT_ACCESSORS(debugger_hints)
|
||||
|
||||
// Script field from shared function info.
|
||||
DECL_ACCESSORS(script, Object)
|
||||
|
||||
// DebugInfo can be detached from the SharedFunctionInfo iff it is empty.
|
||||
bool IsEmpty() const;
|
||||
|
||||
@ -85,17 +79,6 @@ class DebugInfo : public Struct {
|
||||
void ClearBreakAtEntry();
|
||||
bool BreakAtEntry() const;
|
||||
|
||||
// The original uninstrumented bytecode array for functions with break
|
||||
// points - the instrumented bytecode is held in the shared function info.
|
||||
DECL_ACCESSORS(original_bytecode_array, Object)
|
||||
|
||||
// The debug instrumented bytecode array for functions with break points
|
||||
// - also pointed to by the shared function info.
|
||||
DECL_ACCESSORS(debug_bytecode_array, Object)
|
||||
|
||||
// Fixed array holding status information for each active break point.
|
||||
DECL_ACCESSORS(break_points, FixedArray)
|
||||
|
||||
// Check if there is a break point at a source position.
|
||||
bool HasBreakPoint(Isolate* isolate, int source_position);
|
||||
// Attempt to clear a break point. Return true if successful.
|
||||
@ -162,17 +145,9 @@ class DebugInfo : public Struct {
|
||||
|
||||
// Clears all fields related to block coverage.
|
||||
void ClearCoverageInfo(Isolate* isolate);
|
||||
DECL_ACCESSORS(coverage_info, Object)
|
||||
|
||||
DECL_CAST(DebugInfo)
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER(DebugInfo)
|
||||
DECL_VERIFIER(DebugInfo)
|
||||
|
||||
// Layout description.
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
|
||||
TORQUE_GENERATED_DEBUG_INFO_FIELDS)
|
||||
|
||||
static const int kEstimatedNofBreakPointsInFunction = 4;
|
||||
|
||||
@ -180,7 +155,7 @@ class DebugInfo : public Struct {
|
||||
// Get the break point info object for a source position.
|
||||
Object GetBreakPointInfo(Isolate* isolate, int source_position);
|
||||
|
||||
OBJECT_CONSTRUCTORS(DebugInfo, Struct);
|
||||
TQ_OBJECT_CONSTRUCTORS(DebugInfo)
|
||||
};
|
||||
|
||||
// The BreakPointInfo class holds information for break points set in a
|
||||
|
@ -17,12 +17,7 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
OBJECT_CONSTRUCTORS_IMPL(FeedbackCell, Struct)
|
||||
|
||||
CAST_ACCESSOR(FeedbackCell)
|
||||
|
||||
ACCESSORS(FeedbackCell, value, HeapObject, kValueOffset)
|
||||
INT32_ACCESSORS(FeedbackCell, interrupt_budget, kInterruptBudgetOffset)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(FeedbackCell)
|
||||
|
||||
void FeedbackCell::clear_padding() {
|
||||
if (FeedbackCell::kAlignedSize == FeedbackCell::kUnalignedSize) return;
|
||||
|
@ -18,7 +18,7 @@ namespace internal {
|
||||
// number of closures created for a certain function per native
|
||||
// context. There's at most one FeedbackCell for each function in
|
||||
// a native context.
|
||||
class FeedbackCell : public Struct {
|
||||
class FeedbackCell : public TorqueGeneratedFeedbackCell<FeedbackCell, Struct> {
|
||||
public:
|
||||
static int GetInitialInterruptBudget() {
|
||||
if (FLAG_lazy_feedback_allocation) {
|
||||
@ -27,19 +27,8 @@ class FeedbackCell : public Struct {
|
||||
return FLAG_interrupt_budget;
|
||||
}
|
||||
|
||||
// [value]: value of the cell.
|
||||
DECL_ACCESSORS(value, HeapObject)
|
||||
DECL_INT32_ACCESSORS(interrupt_budget)
|
||||
|
||||
DECL_CAST(FeedbackCell)
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER(FeedbackCell)
|
||||
DECL_VERIFIER(FeedbackCell)
|
||||
|
||||
// Layout description.
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
|
||||
TORQUE_GENERATED_FEEDBACK_CELL_FIELDS)
|
||||
|
||||
static const int kUnalignedSize = kSize;
|
||||
static const int kAlignedSize = RoundUp<kObjectAlignment>(int{kSize});
|
||||
@ -50,7 +39,7 @@ class FeedbackCell : public Struct {
|
||||
using BodyDescriptor =
|
||||
FixedBodyDescriptor<kValueOffset, kInterruptBudgetOffset, kAlignedSize>;
|
||||
|
||||
OBJECT_CONSTRUCTORS(FeedbackCell, Struct);
|
||||
TQ_OBJECT_CONSTRUCTORS(FeedbackCell)
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -40,7 +40,7 @@ TQ_OBJECT_CONSTRUCTORS_IMPL(JSGlobalProxy)
|
||||
JSIteratorResult::JSIteratorResult(Address ptr) : JSObject(ptr) {}
|
||||
OBJECT_CONSTRUCTORS_IMPL(JSMessageObject, JSObject)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(JSPrimitiveWrapper)
|
||||
OBJECT_CONSTRUCTORS_IMPL(JSStringIterator, JSObject)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(JSStringIterator)
|
||||
|
||||
NEVER_READ_ONLY_SPACE_IMPL(JSReceiver)
|
||||
|
||||
@ -49,7 +49,6 @@ CAST_ACCESSOR(JSGlobalObject)
|
||||
CAST_ACCESSOR(JSIteratorResult)
|
||||
CAST_ACCESSOR(JSMessageObject)
|
||||
CAST_ACCESSOR(JSReceiver)
|
||||
CAST_ACCESSOR(JSStringIterator)
|
||||
|
||||
MaybeHandle<Object> JSReceiver::GetProperty(Isolate* isolate,
|
||||
Handle<JSReceiver> receiver,
|
||||
@ -1009,8 +1008,7 @@ inline int JSGlobalProxy::SizeWithEmbedderFields(int embedder_field_count) {
|
||||
ACCESSORS(JSIteratorResult, value, Object, kValueOffset)
|
||||
ACCESSORS(JSIteratorResult, done, Object, kDoneOffset)
|
||||
|
||||
ACCESSORS(JSStringIterator, string, String, kStringOffset)
|
||||
SMI_ACCESSORS(JSStringIterator, index, kNextIndexOffset)
|
||||
TQ_SMI_ACCESSORS(JSStringIterator, index)
|
||||
|
||||
// If the fast-case backing storage takes up much more memory than a dictionary
|
||||
// backing storage would, the object should have slow elements.
|
||||
|
@ -1370,25 +1370,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
|
||||
|
@ -17,38 +17,21 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
OBJECT_CONSTRUCTORS_IMPL(WeakCell, HeapObject)
|
||||
OBJECT_CONSTRUCTORS_IMPL(JSWeakRef, JSObject)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(WeakCell)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(JSWeakRef)
|
||||
OBJECT_CONSTRUCTORS_IMPL(JSFinalizationGroup, JSObject)
|
||||
OBJECT_CONSTRUCTORS_IMPL(JSFinalizationGroupCleanupIterator, JSObject)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(JSFinalizationGroupCleanupIterator)
|
||||
|
||||
ACCESSORS(JSFinalizationGroup, native_context, NativeContext,
|
||||
kNativeContextOffset)
|
||||
ACCESSORS(JSFinalizationGroup, cleanup, Object, kCleanupOffset)
|
||||
ACCESSORS(JSFinalizationGroup, active_cells, Object, kActiveCellsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, cleared_cells, Object, kClearedCellsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, active_cells, HeapObject, kActiveCellsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, cleared_cells, HeapObject, kClearedCellsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, key_map, Object, kKeyMapOffset)
|
||||
SMI_ACCESSORS(JSFinalizationGroup, flags, kFlagsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, next, Object, kNextOffset)
|
||||
CAST_ACCESSOR(JSFinalizationGroup)
|
||||
|
||||
ACCESSORS(WeakCell, finalization_group, Object, kFinalizationGroupOffset)
|
||||
ACCESSORS(WeakCell, target, HeapObject, kTargetOffset)
|
||||
ACCESSORS(WeakCell, holdings, Object, kHoldingsOffset)
|
||||
ACCESSORS(WeakCell, next, Object, kNextOffset)
|
||||
ACCESSORS(WeakCell, prev, Object, kPrevOffset)
|
||||
ACCESSORS(WeakCell, key, Object, kKeyOffset)
|
||||
ACCESSORS(WeakCell, key_list_next, Object, kKeyListNextOffset)
|
||||
ACCESSORS(WeakCell, key_list_prev, Object, kKeyListPrevOffset)
|
||||
CAST_ACCESSOR(WeakCell)
|
||||
|
||||
CAST_ACCESSOR(JSWeakRef)
|
||||
ACCESSORS(JSWeakRef, target, HeapObject, kTargetOffset)
|
||||
|
||||
ACCESSORS(JSFinalizationGroupCleanupIterator, finalization_group,
|
||||
JSFinalizationGroup, kFinalizationGroupOffset)
|
||||
CAST_ACCESSOR(JSFinalizationGroupCleanupIterator)
|
||||
|
||||
void JSFinalizationGroup::Register(
|
||||
Handle<JSFinalizationGroup> finalization_group, Handle<JSReceiver> target,
|
||||
Handle<Object> holdings, Handle<Object> key, Isolate* isolate) {
|
||||
@ -101,7 +84,7 @@ bool JSFinalizationGroup::Unregister(
|
||||
Handle<ObjectHashTable> key_map =
|
||||
handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
|
||||
Object value = key_map->Lookup(unregister_token);
|
||||
Object undefined = ReadOnlyRoots(isolate).undefined_value();
|
||||
HeapObject undefined = ReadOnlyRoots(isolate).undefined_value();
|
||||
while (value.IsWeakCell()) {
|
||||
WeakCell weak_cell = WeakCell::cast(value);
|
||||
weak_cell.RemoveFromFinalizationGroupCells(isolate);
|
||||
|
@ -28,8 +28,8 @@ class JSFinalizationGroup : public JSObject {
|
||||
DECL_ACCESSORS(native_context, NativeContext)
|
||||
DECL_ACCESSORS(cleanup, Object)
|
||||
|
||||
DECL_ACCESSORS(active_cells, Object)
|
||||
DECL_ACCESSORS(cleared_cells, Object)
|
||||
DECL_ACCESSORS(active_cells, HeapObject)
|
||||
DECL_ACCESSORS(cleared_cells, HeapObject)
|
||||
DECL_ACCESSORS(key_map, Object)
|
||||
|
||||
// For storing a list of JSFinalizationGroup objects in NativeContext.
|
||||
@ -75,32 +75,10 @@ class JSFinalizationGroup : public JSObject {
|
||||
};
|
||||
|
||||
// Internal object for storing weak references in JSFinalizationGroup.
|
||||
class WeakCell : public HeapObject {
|
||||
class WeakCell : public TorqueGeneratedWeakCell<WeakCell, HeapObject> {
|
||||
public:
|
||||
DECL_PRINTER(WeakCell)
|
||||
EXPORT_DECL_VERIFIER(WeakCell)
|
||||
DECL_CAST(WeakCell)
|
||||
|
||||
DECL_ACCESSORS(finalization_group, Object)
|
||||
DECL_ACCESSORS(target, HeapObject)
|
||||
DECL_ACCESSORS(holdings, Object)
|
||||
|
||||
// For storing doubly linked lists of WeakCells in JSFinalizationGroup's
|
||||
// "active_cells" and "cleared_cells" lists.
|
||||
DECL_ACCESSORS(prev, Object)
|
||||
DECL_ACCESSORS(next, Object)
|
||||
|
||||
// For storing doubly linked lists of WeakCells per key in
|
||||
// JSFinalizationGroup's key-based hashmap. WeakCell also needs to know its
|
||||
// key, so that we can remove the key from the key_map when we remove the last
|
||||
// WeakCell associated with it.
|
||||
DECL_ACCESSORS(key, Object)
|
||||
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)
|
||||
|
||||
class BodyDescriptor;
|
||||
|
||||
@ -115,40 +93,27 @@ class WeakCell : public HeapObject {
|
||||
|
||||
inline void RemoveFromFinalizationGroupCells(Isolate* isolate);
|
||||
|
||||
OBJECT_CONSTRUCTORS(WeakCell, HeapObject);
|
||||
TQ_OBJECT_CONSTRUCTORS(WeakCell)
|
||||
};
|
||||
|
||||
class JSWeakRef : public JSObject {
|
||||
class JSWeakRef : public TorqueGeneratedJSWeakRef<JSWeakRef, JSObject> {
|
||||
public:
|
||||
DECL_PRINTER(JSWeakRef)
|
||||
EXPORT_DECL_VERIFIER(JSWeakRef)
|
||||
DECL_CAST(JSWeakRef)
|
||||
|
||||
DECL_ACCESSORS(target, HeapObject)
|
||||
|
||||
// Layout description.
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
|
||||
TORQUE_GENERATED_JSWEAK_REF_FIELDS)
|
||||
|
||||
class BodyDescriptor;
|
||||
|
||||
OBJECT_CONSTRUCTORS(JSWeakRef, JSObject);
|
||||
TQ_OBJECT_CONSTRUCTORS(JSWeakRef)
|
||||
};
|
||||
|
||||
class JSFinalizationGroupCleanupIterator : public JSObject {
|
||||
class JSFinalizationGroupCleanupIterator
|
||||
: public TorqueGeneratedJSFinalizationGroupCleanupIterator<
|
||||
JSFinalizationGroupCleanupIterator, JSObject> {
|
||||
public:
|
||||
DECL_PRINTER(JSFinalizationGroupCleanupIterator)
|
||||
DECL_VERIFIER(JSFinalizationGroupCleanupIterator)
|
||||
DECL_CAST(JSFinalizationGroupCleanupIterator)
|
||||
|
||||
DECL_ACCESSORS(finalization_group, JSFinalizationGroup)
|
||||
|
||||
// Layout description.
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(
|
||||
JSObject::kHeaderSize,
|
||||
TORQUE_GENERATED_JSFINALIZATION_GROUP_CLEANUP_ITERATOR_FIELDS)
|
||||
|
||||
OBJECT_CONSTRUCTORS(JSFinalizationGroupCleanupIterator, JSObject);
|
||||
TQ_OBJECT_CONSTRUCTORS(JSFinalizationGroupCleanupIterator)
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -4989,7 +4989,7 @@ void SharedFunctionInfo::ScriptIterator::Reset(Isolate* isolate,
|
||||
}
|
||||
|
||||
void SharedFunctionInfo::SetScript(Handle<SharedFunctionInfo> shared,
|
||||
Handle<Object> script_object,
|
||||
Handle<HeapObject> script_object,
|
||||
int function_literal_id,
|
||||
bool reset_preparsed_scope_data) {
|
||||
if (shared->script() == *script_object) return;
|
||||
|
@ -21,11 +21,7 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
OBJECT_CONSTRUCTORS_IMPL(PreparseData, HeapObject)
|
||||
|
||||
CAST_ACCESSOR(PreparseData)
|
||||
INT_ACCESSORS(PreparseData, data_length, kDataLengthOffset)
|
||||
INT_ACCESSORS(PreparseData, children_length, kInnerLengthOffset)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(PreparseData)
|
||||
|
||||
int PreparseData::inner_start_offset() const {
|
||||
return InnerOffset(data_length());
|
||||
@ -107,7 +103,7 @@ DEFINE_DEOPT_ELEMENT_ACCESSORS(SharedFunctionInfo, Object)
|
||||
|
||||
ACCESSORS(SharedFunctionInfo, name_or_scope_info, Object,
|
||||
kNameOrScopeInfoOffset)
|
||||
ACCESSORS(SharedFunctionInfo, script_or_debug_info, Object,
|
||||
ACCESSORS(SharedFunctionInfo, script_or_debug_info, HeapObject,
|
||||
kScriptOrDebugInfoOffset)
|
||||
|
||||
INT32_ACCESSORS(SharedFunctionInfo, function_literal_id,
|
||||
@ -656,16 +652,16 @@ bool SharedFunctionInfo::HasWasmCapiFunctionData() const {
|
||||
return function_data().IsWasmCapiFunctionData();
|
||||
}
|
||||
|
||||
Object SharedFunctionInfo::script() const {
|
||||
Object maybe_script = script_or_debug_info();
|
||||
HeapObject SharedFunctionInfo::script() const {
|
||||
HeapObject maybe_script = script_or_debug_info();
|
||||
if (maybe_script.IsDebugInfo()) {
|
||||
return DebugInfo::cast(maybe_script).script();
|
||||
}
|
||||
return maybe_script;
|
||||
}
|
||||
|
||||
void SharedFunctionInfo::set_script(Object script) {
|
||||
Object maybe_debug_info = script_or_debug_info();
|
||||
void SharedFunctionInfo::set_script(HeapObject script) {
|
||||
HeapObject maybe_debug_info = script_or_debug_info();
|
||||
if (maybe_debug_info.IsDebugInfo()) {
|
||||
DebugInfo::cast(maybe_debug_info).set_script(script);
|
||||
} else {
|
||||
|
@ -57,11 +57,9 @@ class WasmJSFunctionData;
|
||||
// +-------------------------------+
|
||||
// | Inner PreparseData N |
|
||||
// +-------------------------------+
|
||||
class PreparseData : public HeapObject {
|
||||
class PreparseData
|
||||
: public TorqueGeneratedPreparseData<PreparseData, HeapObject> {
|
||||
public:
|
||||
DECL_INT_ACCESSORS(data_length)
|
||||
DECL_INT_ACCESSORS(children_length)
|
||||
|
||||
inline int inner_start_offset() const;
|
||||
inline ObjectSlot inner_data_start() const;
|
||||
|
||||
@ -76,12 +74,9 @@ class PreparseData : public HeapObject {
|
||||
// Clear uninitialized padding space.
|
||||
inline void clear_padding();
|
||||
|
||||
DECL_CAST(PreparseData)
|
||||
DECL_PRINTER(PreparseData)
|
||||
DECL_VERIFIER(PreparseData)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
|
||||
TORQUE_GENERATED_PREPARSE_DATA_FIELDS)
|
||||
static const int kDataStartOffset = kSize;
|
||||
|
||||
class BodyDescriptor;
|
||||
@ -94,7 +89,7 @@ class PreparseData : public HeapObject {
|
||||
return InnerOffset(data_length) + children_length * kTaggedSize;
|
||||
}
|
||||
|
||||
OBJECT_CONSTRUCTORS(PreparseData, HeapObject);
|
||||
TQ_OBJECT_CONSTRUCTORS(PreparseData)
|
||||
|
||||
private:
|
||||
inline Object get_child_raw(int index) const;
|
||||
@ -202,7 +197,7 @@ class SharedFunctionInfo : public HeapObject {
|
||||
// Set up the link between shared function info and the script. The shared
|
||||
// function info is added to the list on the script.
|
||||
V8_EXPORT_PRIVATE static void SetScript(
|
||||
Handle<SharedFunctionInfo> shared, Handle<Object> script_object,
|
||||
Handle<SharedFunctionInfo> shared, Handle<HeapObject> script_object,
|
||||
int function_literal_id, bool reset_preparsed_scope_data = true);
|
||||
|
||||
// Layout description of the optimized code map.
|
||||
@ -368,10 +363,10 @@ class SharedFunctionInfo : public HeapObject {
|
||||
// [script_or_debug_info]: One of:
|
||||
// - Script from which the function originates.
|
||||
// - a DebugInfo which holds the actual script [HasDebugInfo()].
|
||||
DECL_ACCESSORS(script_or_debug_info, Object)
|
||||
DECL_ACCESSORS(script_or_debug_info, HeapObject)
|
||||
|
||||
inline Object script() const;
|
||||
inline void set_script(Object script);
|
||||
inline HeapObject script() const;
|
||||
inline void set_script(HeapObject script);
|
||||
|
||||
// The function is subject to debugging if a debug info is attached.
|
||||
inline bool HasDebugInfo() const;
|
||||
|
@ -22,12 +22,10 @@ namespace internal {
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(Struct)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(Tuple2)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(Tuple3)
|
||||
OBJECT_CONSTRUCTORS_IMPL(AccessorPair, Struct)
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(AccessorPair)
|
||||
|
||||
TQ_OBJECT_CONSTRUCTORS_IMPL(ClassPositions)
|
||||
|
||||
CAST_ACCESSOR(AccessorPair)
|
||||
|
||||
void Struct::InitializeBody(int object_size) {
|
||||
Object value = GetReadOnlyRoots().undefined_value();
|
||||
for (int offset = kHeaderSize; offset < object_size; offset += kTaggedSize) {
|
||||
@ -35,9 +33,6 @@ void Struct::InitializeBody(int object_size) {
|
||||
}
|
||||
}
|
||||
|
||||
ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
|
||||
ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
|
||||
|
||||
TQ_SMI_ACCESSORS(ClassPositions, start)
|
||||
TQ_SMI_ACCESSORS(ClassPositions, end)
|
||||
|
||||
|
@ -46,13 +46,8 @@ class Tuple3 : public TorqueGeneratedTuple3<Tuple3, Tuple2> {
|
||||
// * a FunctionTemplateInfo: a real (lazy) accessor
|
||||
// * undefined: considered an accessor by the spec, too, strangely enough
|
||||
// * null: an accessor which has not been set
|
||||
class AccessorPair : public Struct {
|
||||
class AccessorPair : public TorqueGeneratedAccessorPair<AccessorPair, Struct> {
|
||||
public:
|
||||
DECL_ACCESSORS(getter, Object)
|
||||
DECL_ACCESSORS(setter, Object)
|
||||
|
||||
DECL_CAST(AccessorPair)
|
||||
|
||||
static Handle<AccessorPair> Copy(Isolate* isolate, Handle<AccessorPair> pair);
|
||||
|
||||
inline Object get(AccessorComponent component);
|
||||
@ -71,13 +66,8 @@ class AccessorPair : public Struct {
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER(AccessorPair)
|
||||
DECL_VERIFIER(AccessorPair)
|
||||
|
||||
// Layout description.
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
|
||||
TORQUE_GENERATED_ACCESSOR_PAIR_FIELDS)
|
||||
|
||||
OBJECT_CONSTRUCTORS(AccessorPair, Struct);
|
||||
TQ_OBJECT_CONSTRUCTORS(AccessorPair)
|
||||
};
|
||||
|
||||
class ClassPositions
|
||||
|
@ -3314,6 +3314,7 @@ void ImplementationVisitor::GenerateClassDefinitions(
|
||||
IncludeGuardScope inline_header_guard(inline_header, basename + "-inl.h");
|
||||
inline_header << "#include \"torque-generated/class-definitions-tq.h\"\n\n";
|
||||
inline_header << "#include \"src/objects/js-promise.h\"\n";
|
||||
inline_header << "#include \"src/objects/js-weak-refs.h\"\n";
|
||||
inline_header << "#include \"src/objects/module.h\"\n";
|
||||
inline_header << "#include \"src/objects/objects-inl.h\"\n";
|
||||
inline_header << "#include \"src/objects/script.h\"\n";
|
||||
@ -3329,6 +3330,7 @@ void ImplementationVisitor::GenerateClassDefinitions(
|
||||
implementation << "#include \"src/objects/embedder-data-array-inl.h\"\n";
|
||||
implementation << "#include \"src/objects/js-generator-inl.h\"\n";
|
||||
implementation << "#include \"src/objects/js-regexp-inl.h\"\n";
|
||||
implementation << "#include \"src/objects/js-weak-refs-inl.h\"\n";
|
||||
implementation
|
||||
<< "#include \"src/objects/js-regexp-string-iterator-inl.h\"\n";
|
||||
implementation << "#include \"src/objects/literal-objects-inl.h\"\n";
|
||||
|
Loading…
Reference in New Issue
Block a user