[torque][cleanup] Simplify some Torque-defined classes

This CL is pretty mechanical; I just iterated through some Torque
classes making the following changes:

- Use @generateCppClass if it seems easy to
- Use @generatePrint if the existing printer doesn't do anything special
- Fix up any imprecise field types

It also includes two minor changes to implementation-visitor:

- Add a new -inl.h file with the things needed for
  torque-generated/class-definitions-tq.cc so we don't need to keep
  changing the compiler when we add @generateCppClass.
- Avoid emitting incorrect accessors for ExternalPointers. This isn't
  strictly necessary for correctness, as the accessors defined in C++
  already hide the ones inherited from generated code, but it makes me
  feel safer.

Change-Id: I4d5a8ba6f86ebff57a0d147619212a3993b087c0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2185824
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#67719}
This commit is contained in:
Seth Brenith 2020-05-08 09:35:16 -07:00 committed by Commit Bot
parent 2d2b45cdfc
commit e769398540
61 changed files with 202 additions and 528 deletions

View File

@ -296,10 +296,6 @@ void BytecodeArray::BytecodeArrayVerify(Isolate* isolate) {
CHECK(handler_table().IsByteArray());
}
USE_TORQUE_VERIFIER(FreeSpace)
USE_TORQUE_VERIFIER(HeapNumber)
USE_TORQUE_VERIFIER(FeedbackVector)
USE_TORQUE_VERIFIER(JSReceiver)
@ -1304,8 +1300,6 @@ void JSDataView::JSDataViewVerify(Isolate* isolate) {
}
}
USE_TORQUE_VERIFIER(Foreign)
void AsyncGeneratorRequest::AsyncGeneratorRequestVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::AsyncGeneratorRequestVerify(*this, isolate);
CHECK_GE(resume_mode(), JSGeneratorObject::kNext);
@ -1488,8 +1482,6 @@ void StoreHandler::StoreHandlerVerify(Isolate* isolate) {
// TODO(ishell): check handler integrity
}
USE_TORQUE_VERIFIER(AccessorInfo)
void CallHandlerInfo::CallHandlerInfoVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::CallHandlerInfoVerify(*this, isolate);
CHECK(map() == ReadOnlyRoots(isolate).side_effect_call_handler_info_map() ||
@ -1513,8 +1505,6 @@ void AllocationSite::AllocationSiteVerify(Isolate* isolate) {
CHECK(nested_site().IsAllocationSite() || nested_site() == Smi::zero());
}
USE_TORQUE_VERIFIER(AllocationMemento)
void Script::ScriptVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::ScriptVerify(*this, isolate);
for (int i = 0; i < shared_function_infos().length(); ++i) {
@ -1558,32 +1548,6 @@ void PreparseData::PreparseDataVerify(Isolate* isolate) {
USE_TORQUE_VERIFIER(InterpreterData)
#ifdef V8_INTL_SUPPORT
USE_TORQUE_VERIFIER(JSV8BreakIterator)
USE_TORQUE_VERIFIER(JSCollator)
USE_TORQUE_VERIFIER(JSDateTimeFormat)
USE_TORQUE_VERIFIER(JSDisplayNames)
USE_TORQUE_VERIFIER(JSListFormat)
USE_TORQUE_VERIFIER(JSLocale)
USE_TORQUE_VERIFIER(JSNumberFormat)
USE_TORQUE_VERIFIER(JSPluralRules)
USE_TORQUE_VERIFIER(JSRelativeTimeFormat)
USE_TORQUE_VERIFIER(JSSegmentIterator)
USE_TORQUE_VERIFIER(JSSegmenter)
#endif // V8_INTL_SUPPORT
#endif // VERIFY_HEAP
#ifdef DEBUG

View File

@ -715,12 +715,6 @@ void DescriptorArray::DescriptorArrayPrint(std::ostream& os) {
PrintDescriptors(os);
}
void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(
std::ostream& os) { // NOLINT
PrintHeader(os, "AliasedArgumentsEntry");
os << "\n - aliased_context_slot: " << aliased_context_slot();
}
namespace {
void PrintFixedArrayWithHeader(std::ostream& os, FixedArray array,
const char* type) {
@ -1436,12 +1430,6 @@ void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT
JSObjectPrintBody(os, *this);
}
void Cell::CellPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "Cell");
os << "\n - value: " << Brief(value());
os << "\n";
}
void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "PropertyCell");
os << "\n - name: ";
@ -1514,17 +1502,6 @@ void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
os << "\n";
}
void AccessorInfo::AccessorInfoPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "AccessorInfo");
os << "\n - name: " << Brief(name());
os << "\n - flags: " << flags();
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
os << "\n - js_getter: " << Brief(js_getter());
os << "\n - data: " << Brief(data());
os << "\n";
}
void CallbackTask::CallbackTaskPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "CallbackTask");
os << "\n - callback: " << Brief(callback());
@ -1938,15 +1915,6 @@ void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT
os << "\n";
}
void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "AccessCheckInfo");
os << "\n - callback: " << Brief(callback());
os << "\n - named_interceptor: " << Brief(named_interceptor());
os << "\n - indexed_interceptor: " << Brief(indexed_interceptor());
os << "\n - data: " << Brief(data());
os << "\n";
}
void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "CallHandlerInfo");
os << "\n - callback: " << Brief(callback());
@ -1957,17 +1925,6 @@ void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
os << "\n";
}
void InterceptorInfo::InterceptorInfoPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "InterceptorInfo");
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
os << "\n - query: " << Brief(query());
os << "\n - deleter: " << Brief(deleter());
os << "\n - enumerator: " << Brief(enumerator());
os << "\n - data: " << Brief(data());
os << "\n";
}
void FunctionTemplateInfo::FunctionTemplateInfoPrint(
std::ostream& os) { // NOLINT
PrintHeader(os, "FunctionTemplateInfo");
@ -2274,27 +2231,6 @@ void ScopeInfo::ScopeInfoPrint(std::ostream& os) { // NOLINT
os << "\n";
}
void DebugInfo::DebugInfoPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "DebugInfo");
os << "\n - flags: " << flags();
os << "\n - debugger_hints: " << debugger_hints();
os << "\n - shared: " << Brief(shared());
os << "\n - script: " << Brief(script());
os << "\n - original bytecode array: " << Brief(original_bytecode_array());
os << "\n - debug bytecode array: " << Brief(debug_bytecode_array());
os << "\n - break_points: ";
break_points().FixedArrayPrint(os);
os << "\n - coverage_info: " << Brief(coverage_info());
os << "\n";
}
void WasmValue::WasmValuePrint(std::ostream& os) { // NOLINT
PrintHeader(os, "WasmValue");
os << "\n - value_type: " << value_type();
os << "\n - bytes_or_ref: " << Brief(bytes_or_ref());
os << "\n";
}
void StackTraceFrame::StackTraceFramePrint(std::ostream& os) { // NOLINT
PrintHeader(os, "StackTraceFrame");
os << "\n - frame_index: " << frame_index();

View File

@ -16,12 +16,11 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(AllocationMemento, Struct)
TQ_OBJECT_CONSTRUCTORS_IMPL(AllocationMemento)
OBJECT_CONSTRUCTORS_IMPL(AllocationSite, Struct)
NEVER_READ_ONLY_SPACE_IMPL(AllocationSite)
CAST_ACCESSOR(AllocationMemento)
CAST_ACCESSOR(AllocationSite)
ACCESSORS(AllocationSite, transition_info_or_boilerplate, Object,

View File

@ -162,12 +162,9 @@ class AllocationSite : public Struct {
OBJECT_CONSTRUCTORS(AllocationSite, Struct);
};
class AllocationMemento : public Struct {
class AllocationMemento
: public TorqueGeneratedAllocationMemento<AllocationMemento, Struct> {
public:
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ALLOCATION_MEMENTO_FIELDS)
DECL_ACCESSORS(allocation_site, Object)
inline bool IsValid() const;
@ -175,11 +172,8 @@ class AllocationMemento : public Struct {
inline Address GetAllocationSiteUnchecked() const;
DECL_PRINTER(AllocationMemento)
DECL_VERIFIER(AllocationMemento)
DECL_CAST(AllocationMemento)
OBJECT_CONSTRUCTORS(AllocationMemento, Struct);
TQ_OBJECT_CONSTRUCTORS(AllocationMemento)
};
} // namespace internal

View File

@ -3,6 +3,8 @@
// found in the LICENSE file.
extern class AllocationSite extends Struct;
@generateCppClass
extern class AllocationMemento extends Struct {
allocation_site: AllocationSite;
}

View File

@ -22,24 +22,15 @@ namespace v8 {
namespace internal {
TQ_OBJECT_CONSTRUCTORS_IMPL(AccessCheckInfo)
OBJECT_CONSTRUCTORS_IMPL(AccessorInfo, Struct)
TQ_OBJECT_CONSTRUCTORS_IMPL(AccessorInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(InterceptorInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(CallHandlerInfo)
CAST_ACCESSOR(AccessorInfo)
ACCESSORS(AccessorInfo, name, Name, kNameOffset)
SMI_ACCESSORS(AccessorInfo, flags, kFlagsOffset)
ACCESSORS(AccessorInfo, expected_receiver_type, Object,
kExpectedReceiverTypeOffset)
ACCESSORS_CHECKED2(AccessorInfo, getter, Object, kGetterOffset, true,
Foreign::IsNormalized(value))
ACCESSORS_CHECKED2(AccessorInfo, setter, Object, kSetterOffset, true,
Foreign::IsNormalized(value))
ACCESSORS(AccessorInfo, js_getter, Object, kJsGetterOffset)
ACCESSORS(AccessorInfo, data, Object, kDataOffset)
bool AccessorInfo::has_getter() {
bool result = getter() != Smi::zero();
@ -97,12 +88,12 @@ bool AccessorInfo::HasExpectedReceiverType() {
}
BOOL_ACCESSORS(InterceptorInfo, flags, can_intercept_symbols,
kCanInterceptSymbolsBit)
BOOL_ACCESSORS(InterceptorInfo, flags, all_can_read, kAllCanReadBit)
BOOL_ACCESSORS(InterceptorInfo, flags, non_masking, kNonMasking)
BOOL_ACCESSORS(InterceptorInfo, flags, is_named, kNamed)
BOOL_ACCESSORS(InterceptorInfo, flags, has_no_side_effect, kHasNoSideEffect)
CanInterceptSymbolsBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, all_can_read, AllCanReadBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, non_masking, NonMaskingBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, is_named, NamedBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, has_no_side_effect,
HasNoSideEffectBit::kShift)
bool CallHandlerInfo::IsSideEffectFreeCallHandlerInfo() const {
ReadOnlyRoots roots = GetReadOnlyRoots();

View File

@ -24,27 +24,17 @@ namespace internal {
// If the accessor in the prototype has the READ_ONLY property attribute, then
// a new value is added to the derived object when the property is set.
// This shadows the accessor in the prototype.
class AccessorInfo : public Struct {
class AccessorInfo : public TorqueGeneratedAccessorInfo<AccessorInfo, Struct> {
public:
DECL_ACCESSORS(name, Name)
DECL_INT_ACCESSORS(flags)
DECL_ACCESSORS(expected_receiver_type, Object)
// This directly points at a foreign C function to be used from the runtime.
DECL_ACCESSORS(getter, Object)
inline bool has_getter();
DECL_ACCESSORS(setter, Object)
inline bool has_setter();
// This either points at the same as above, or a trampoline in case we are
// running with the simulator. Use these entries from generated code.
DECL_ACCESSORS(js_getter, Object)
DECL_ACCESSORS(data, Object)
static Address redirect(Address address, AccessorComponent component);
Address redirected_getter() const;
// Dispatched behavior.
DECL_PRINTER(AccessorInfo)
DECL_BOOLEAN_ACCESSORS(all_can_read)
DECL_BOOLEAN_ACCESSORS(all_can_write)
DECL_BOOLEAN_ACCESSORS(is_special_data_property)
@ -68,35 +58,23 @@ class AccessorInfo : public Struct {
Handle<Map> map);
inline bool IsCompatibleReceiver(Object receiver);
DECL_CAST(AccessorInfo)
// Dispatched behavior.
DECL_VERIFIER(AccessorInfo)
// Append all descriptors to the array that are not already there.
// Return number added.
static int AppendUnique(Isolate* isolate, Handle<Object> descriptors,
Handle<FixedArray> array, int valid_descriptors);
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ACCESSOR_INFO_FIELDS)
private:
inline bool HasExpectedReceiverType();
// Bit positions in |flags|.
DEFINE_TORQUE_GENERATED_ACCESSOR_INFO_FLAGS()
OBJECT_CONSTRUCTORS(AccessorInfo, Struct);
TQ_OBJECT_CONSTRUCTORS(AccessorInfo)
};
class AccessCheckInfo
: public TorqueGeneratedAccessCheckInfo<AccessCheckInfo, Struct> {
public:
// Dispatched behavior.
DECL_PRINTER(AccessCheckInfo)
static AccessCheckInfo Get(Isolate* isolate, Handle<JSObject> receiver);
TQ_OBJECT_CONSTRUCTORS(AccessCheckInfo)
@ -111,14 +89,7 @@ class InterceptorInfo
DECL_BOOLEAN_ACCESSORS(is_named)
DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
// Dispatched behavior.
DECL_PRINTER(InterceptorInfo)
static const int kCanInterceptSymbolsBit = 0;
static const int kAllCanReadBit = 1;
static const int kNonMasking = 2;
static const int kNamed = 3;
static const int kHasNoSideEffect = 4;
DEFINE_TORQUE_GENERATED_INTERCEPTOR_INFO_FLAGS()
TQ_OBJECT_CONSTRUCTORS(InterceptorInfo)
};

View File

@ -9,7 +9,16 @@ extern class CallHandlerInfo extends Struct {
data: Object;
}
bitfield struct InterceptorInfoFlags extends uint31 {
can_intercept_symbols: bool: 1 bit;
all_can_read: bool: 1 bit;
non_masking: bool: 1 bit;
named: bool: 1 bit;
has_no_side_effect: bool: 1 bit;
}
@generateCppClass
@generatePrint
extern class InterceptorInfo extends Struct {
getter: NonNullForeign|Zero|Undefined;
setter: NonNullForeign|Zero|Undefined;
@ -19,10 +28,11 @@ extern class InterceptorInfo extends Struct {
enumerator: NonNullForeign|Zero|Undefined;
definer: NonNullForeign|Zero|Undefined;
data: Object;
flags: Smi;
flags: SmiTagged<InterceptorInfoFlags>;
}
@generateCppClass
@generatePrint
extern class AccessCheckInfo extends Struct {
callback: Foreign|Zero|Undefined;
named_interceptor: InterceptorInfo|Zero|Undefined;
@ -44,12 +54,16 @@ bitfield struct AccessorInfoFlags extends uint31 {
initial_attributes: PropertyAttributes: 3 bit;
}
@generateCppClass
@generatePrint
extern class AccessorInfo extends Struct {
name: Object;
name: Name;
flags: SmiTagged<AccessorInfoFlags>;
expected_receiver_type: Object;
setter: NonNullForeign|Zero;
getter: NonNullForeign|Zero;
// This either points at the same as above, or a trampoline in case we are
// running with the simulator. Use these entries from generated code.
js_getter: NonNullForeign|Zero;
data: Object;
}

View File

@ -113,9 +113,6 @@ class AliasedArgumentsEntry
: public TorqueGeneratedAliasedArgumentsEntry<AliasedArgumentsEntry,
Struct> {
public:
// Dispatched behavior.
DECL_PRINTER(AliasedArgumentsEntry)
TQ_OBJECT_CONSTRUCTORS(AliasedArgumentsEntry)
};

View File

@ -29,6 +29,7 @@ extern shape JSStrictArgumentsObject extends JSArgumentsObject {
type SloppyArgumentsElements extends FixedArray;
@generateCppClass
@generatePrint
extern class AliasedArgumentsEntry extends Struct {
aliased_context_slot: Smi;
}

View File

@ -20,9 +20,6 @@ class Cell : public TorqueGeneratedCell<Cell, HeapObject> {
inline Address ValueAddress() { return address() + kValueOffset; }
// Dispatched behavior.
DECL_PRINTER(Cell)
using BodyDescriptor = FixedBodyDescriptor<kValueOffset, kSize, kSize>;
TQ_OBJECT_CONSTRUCTORS(Cell)

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
@generateCppClass
@generatePrint
extern class Cell extends HeapObject {
value: Object;
}

View File

@ -0,0 +1,44 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_CLASS_DEFINITIONS_TQ_DEPS_INL_H_
#define V8_OBJECTS_CLASS_DEFINITIONS_TQ_DEPS_INL_H_
// This is a collection of -inl.h files required by the generated file
// class-definitions-tq.cc. Generally, classes using @generateCppClass need an
// entry here.
#include "src/objects/allocation-site-inl.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/embedder-data-array-inl.h"
#include "src/objects/free-space-inl.h"
#include "src/objects/js-aggregate-error-inl.h"
#include "src/objects/js-collection-inl.h"
#include "src/objects/js-generator-inl.h"
#include "src/objects/js-regexp-inl.h"
#include "src/objects/js-regexp-string-iterator-inl.h"
#include "src/objects/js-weak-refs-inl.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/microtask-inl.h"
#include "src/objects/module-inl.h"
#include "src/objects/promise-inl.h"
#include "src/objects/property-descriptor-object-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/struct-inl.h"
#include "src/objects/template-objects-inl.h"
#ifdef V8_INTL_SUPPORT
#include "src/objects/js-break-iterator-inl.h"
#include "src/objects/js-collator-inl.h"
#include "src/objects/js-date-time-format-inl.h"
#include "src/objects/js-display-names-inl.h"
#include "src/objects/js-list-format-inl.h"
#include "src/objects/js-locale-inl.h"
#include "src/objects/js-number-format-inl.h"
#include "src/objects/js-plural-rules-inl.h"
#include "src/objects/js-relative-time-format-inl.h"
#include "src/objects/js-segment-iterator-inl.h"
#include "src/objects/js-segmenter-inl.h"
#endif
#endif // V8_OBJECTS_CLASS_DEFINITIONS_TQ_DEPS_INL_H_

View File

@ -6,7 +6,7 @@
extern class Context extends HeapObject {
length: Smi;
scope_info: ScopeInfo;
previous: Object;
previous: Context|Zero|Undefined;
}
extern class AwaitContext extends Context generates 'TNode<Context>';
extern class BlockContext extends Context generates 'TNode<Context>';

View File

@ -126,9 +126,6 @@ class DebugInfo : public TorqueGeneratedDebugInfo<DebugInfo, Struct> {
// Clears all fields related to block coverage.
void ClearCoverageInfo(Isolate* isolate);
// Dispatched behavior.
DECL_PRINTER(DebugInfo)
static const int kEstimatedNofBreakPointsInFunction = 4;
private:
@ -206,7 +203,6 @@ class BreakPoint : public TorqueGeneratedBreakPoint<BreakPoint, Struct> {
class WasmValue : public TorqueGeneratedWasmValue<WasmValue, Struct> {
public:
NEVER_READ_ONLY_SPACE
DECL_PRINTER(WasmValue)
TQ_OBJECT_CONSTRUCTORS(WasmValue)
};

View File

@ -35,6 +35,7 @@ bitfield struct DebuggerHints extends uint31 {
}
@generateCppClass
@generatePrint
extern class DebugInfo extends Struct {
shared: SharedFunctionInfo;
// Bit field containing various information collected for debugging.
@ -71,9 +72,10 @@ extern class CoverageInfo extends HeapObject {
}
@generateCppClass
@generatePrint
extern class WasmValue extends Struct {
// The type, should map to ValueType::Kind values in value-type.h.
value_type: Smi;
value_type: SmiTagged<WasmValueType>;
// Holds the actual value. For example, if this holds a Wasm i32, this will
// be of length 4, for s128, it will have length 16. These values are
// represented by the respective C++ types, and memcpy-ed in.

View File

@ -24,12 +24,9 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(DescriptorArray, HeapObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(DescriptorArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(EnumCache)
CAST_ACCESSOR(DescriptorArray)
ACCESSORS(DescriptorArray, enum_cache, EnumCache, kEnumCacheOffset)
RELAXED_INT16_ACCESSORS(DescriptorArray, number_of_all_descriptors,
kNumberOfAllDescriptorsOffset)
RELAXED_INT16_ACCESSORS(DescriptorArray, number_of_descriptors,

View File

@ -50,13 +50,13 @@ class EnumCache : public TorqueGeneratedEnumCache<EnumCache, Struct> {
// The "value" fields store either values or field types. A field type is either
// FieldType::None(), FieldType::Any() or a weak reference to a Map. All other
// references are strong.
class DescriptorArray : public HeapObject {
class DescriptorArray
: public TorqueGeneratedDescriptorArray<DescriptorArray, HeapObject> {
public:
DECL_INT16_ACCESSORS(number_of_all_descriptors)
DECL_INT16_ACCESSORS(number_of_descriptors)
inline int16_t number_of_slack_descriptors() const;
inline int number_of_entries() const;
DECL_ACCESSORS(enum_cache, EnumCache)
void ClearEnumCache();
inline void CopyEnumCacheFrom(DescriptorArray array);
@ -135,14 +135,9 @@ class DescriptorArray : public HeapObject {
void Initialize(EnumCache enum_cache, HeapObject undefined_value,
int nof_descriptors, int slack);
DECL_CAST(DescriptorArray)
// Constant for denoting key was not found.
static const int kNotFound = -1;
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_DESCRIPTOR_ARRAY_FIELDS)
STATIC_ASSERT(IsAligned(kStartOfWeakFieldsOffset, kTaggedSize));
STATIC_ASSERT(IsAligned(kHeaderSize, kTaggedSize));
@ -234,7 +229,7 @@ class DescriptorArray : public HeapObject {
// Swap first and second descriptor.
inline void SwapSortedKeys(int first, int second);
OBJECT_CONSTRUCTORS(DescriptorArray, HeapObject);
TQ_OBJECT_CONSTRUCTORS(DescriptorArray)
};
class NumberOfMarkedDescriptors {

View File

@ -16,6 +16,7 @@ struct DescriptorEntry {
value: JSAny|Weak<Map>|AccessorInfo|AccessorPair|ClassPositions;
}
@generateCppClass
extern class DescriptorArray extends HeapObject {
const number_of_all_descriptors: uint16;
number_of_descriptors: uint16;

View File

@ -35,19 +35,16 @@ FixedArrayBase::FixedArrayBase(Address ptr,
: TorqueGeneratedFixedArrayBase(ptr, allow_smi) {}
TQ_OBJECT_CONSTRUCTORS_IMPL(FixedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(FixedDoubleArray)
OBJECT_CONSTRUCTORS_IMPL(ArrayList, FixedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(ArrayList)
TQ_OBJECT_CONSTRUCTORS_IMPL(ByteArray)
ByteArray::ByteArray(Address ptr, HeapObject::AllowInlineSmiStorage allow_smi)
: TorqueGeneratedByteArray(ptr, allow_smi) {}
OBJECT_CONSTRUCTORS_IMPL(TemplateList, FixedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(TemplateList)
TQ_OBJECT_CONSTRUCTORS_IMPL(WeakFixedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(WeakArrayList)
NEVER_READ_ONLY_SPACE_IMPL(WeakArrayList)
CAST_ACCESSOR(ArrayList)
CAST_ACCESSOR(TemplateList)
SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
SYNCHRONIZED_SMI_ACCESSORS(WeakFixedArray, length, kLengthOffset)

View File

@ -419,7 +419,7 @@ class WeakArrayList::Iterator {
// the allocated size. The number of elements is stored at kLengthIndex and is
// updated with every insertion. The elements of the ArrayList are stored in the
// underlying FixedArray starting at kFirstIndex.
class ArrayList : public FixedArray {
class ArrayList : public TorqueGeneratedArrayList<ArrayList, FixedArray> {
public:
V8_EXPORT_PRIVATE static Handle<ArrayList> Add(Isolate* isolate,
Handle<ArrayList> array,
@ -452,14 +452,13 @@ class ArrayList : public FixedArray {
// Return a copy of the list of size Length() without the first entry. The
// number returned by Length() is stored in the first entry.
static Handle<FixedArray> Elements(Isolate* isolate, Handle<ArrayList> array);
DECL_CAST(ArrayList)
private:
static Handle<ArrayList> EnsureSpace(Isolate* isolate,
Handle<ArrayList> array, int length);
static const int kLengthIndex = 0;
static const int kFirstIndex = 1;
OBJECT_CONSTRUCTORS(ArrayList, FixedArray);
TQ_OBJECT_CONSTRUCTORS(ArrayList)
};
enum SearchMode { ALL_ENTRIES, VALID_ENTRIES };
@ -575,7 +574,8 @@ class PodArray : public ByteArray {
OBJECT_CONSTRUCTORS(PodArray<T>, ByteArray);
};
class TemplateList : public FixedArray {
class TemplateList
: public TorqueGeneratedTemplateList<TemplateList, FixedArray> {
public:
static Handle<TemplateList> New(Isolate* isolate, int size);
inline int length() const;
@ -584,12 +584,11 @@ class TemplateList : public FixedArray {
inline void set(int index, Object value);
static Handle<TemplateList> Add(Isolate* isolate, Handle<TemplateList> list,
Handle<Object> value);
DECL_CAST(TemplateList)
private:
static const int kLengthIndex = 0;
static const int kFirstElementIndex = kLengthIndex + 1;
OBJECT_CONSTRUCTORS(TemplateList, FixedArray);
TQ_OBJECT_CONSTRUCTORS(TemplateList)
};
} // namespace internal

View File

@ -35,11 +35,12 @@ extern class ByteArray extends FixedArrayBase {
}
@hasSameInstanceTypeAsParent
@generateCppClass
extern class ArrayList extends FixedArray {
}
@hasSameInstanceTypeAsParent
@noVerifier
@generateCppClass
extern class TemplateList extends FixedArray {
}

View File

@ -18,9 +18,7 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(Foreign, HeapObject)
CAST_ACCESSOR(Foreign)
TQ_OBJECT_CONSTRUCTORS_IMPL(Foreign)
// static
bool Foreign::IsNormalized(Object value) {

View File

@ -6,7 +6,7 @@
#define V8_OBJECTS_FOREIGN_H_
#include "src/objects/heap-object.h"
#include "torque-generated/field-offsets-tq.h"
#include "torque-generated/class-definitions-tq.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
@ -15,21 +15,15 @@ namespace v8 {
namespace internal {
// Foreign describes objects pointing from JavaScript to C structures.
class Foreign : public HeapObject {
class Foreign : public TorqueGeneratedForeign<Foreign, HeapObject> {
public:
// [address]: field containing the address.
DECL_GETTER(foreign_address, Address)
static inline bool IsNormalized(Object object);
DECL_CAST(Foreign)
// Dispatched behavior.
DECL_PRINTER(Foreign)
DECL_VERIFIER(Foreign)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_FOREIGN_FIELDS)
#ifdef V8_COMPRESS_POINTERS
// TODO(ishell, v8:8875): When pointer compression is enabled the
@ -50,7 +44,7 @@ class Foreign : public HeapObject {
inline void set_foreign_address(Isolate* isolate, Address value);
OBJECT_CONSTRUCTORS(Foreign, HeapObject);
TQ_OBJECT_CONSTRUCTORS(Foreign)
};
} // namespace internal

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
@apiExposedInstanceTypeValue(0x46)
@generateCppClass
extern class Foreign extends HeapObject {
foreign_address: ExternalPointer;
}

View File

@ -18,9 +18,8 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(FreeSpace, HeapObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(FreeSpace)
SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
RELAXED_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
int FreeSpace::Size() { return size(); }

View File

@ -6,7 +6,7 @@
#define V8_OBJECTS_FREE_SPACE_H_
#include "src/objects/heap-object.h"
#include "torque-generated/field-offsets-tq.h"
#include "torque-generated/class-definitions-tq.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
@ -19,12 +19,9 @@ namespace internal {
// the heap remains iterable. They have a size and a next pointer.
// The next pointer is the raw address of the next FreeSpace object (or NULL)
// in the free list.
class FreeSpace : public HeapObject {
class FreeSpace : public TorqueGeneratedFreeSpace<FreeSpace, HeapObject> {
public:
// [size]: size of the free space including the header.
inline int size() const;
inline void set_size(int value);
inline int relaxed_read_size() const;
inline void relaxed_write_size(int value);
@ -39,15 +36,11 @@ class FreeSpace : public HeapObject {
// Dispatched behavior.
DECL_PRINTER(FreeSpace)
DECL_VERIFIER(FreeSpace)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_FREE_SPACE_FIELDS)
private:
inline bool IsValid();
OBJECT_CONSTRUCTORS(FreeSpace, HeapObject);
TQ_OBJECT_CONSTRUCTORS(FreeSpace)
};
} // namespace internal

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class FreeSpace extends HeapObject {
size: Smi;
next: FreeSpace|Uninitialized;

View File

@ -16,15 +16,7 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(HeapNumber, PrimitiveHeapObject)
CAST_ACCESSOR(HeapNumber)
double HeapNumber::value() const { return ReadField<double>(kValueOffset); }
void HeapNumber::set_value(double value) {
WriteField<double>(kValueOffset, value);
}
TQ_OBJECT_CONSTRUCTORS_IMPL(HeapNumber)
uint64_t HeapNumber::value_as_bits() const {
// Bug(v8:8875): HeapNumber's double may be unaligned.

View File

@ -15,12 +15,9 @@ namespace internal {
// The HeapNumber class describes heap allocated numbers that cannot be
// represented in a Smi (small integer).
class HeapNumber : public PrimitiveHeapObject {
class HeapNumber
: public TorqueGeneratedHeapNumber<HeapNumber, PrimitiveHeapObject> {
public:
// [value]: number value.
inline double value() const;
inline void set_value(double value);
inline uint64_t value_as_bits() const;
inline void set_value_as_bits(uint64_t bits);
@ -28,7 +25,6 @@ class HeapNumber : public PrimitiveHeapObject {
inline int get_sign();
// Layout description.
static const int kValueOffset = PrimitiveHeapObject::kHeaderSize;
// IEEE doubles are two 32 bit words. The first is just mantissa, the second
// is a mixture of sign, exponent and mantissa. The offsets of two 32 bit
// words within double numbers are endian dependent and they are set
@ -43,7 +39,6 @@ class HeapNumber : public PrimitiveHeapObject {
#error Unknown byte ordering
#endif
static const int kSize = kValueOffset + kDoubleSize;
static const uint32_t kSignMask = 0x80000000u;
static const uint32_t kExponentMask = 0x7ff00000u;
static const uint32_t kMantissaMask = 0xfffffu;
@ -56,12 +51,10 @@ class HeapNumber : public PrimitiveHeapObject {
static const int kMantissaBitsInTopWord = 20;
static const int kNonMantissaBitsInTopWord = 12;
DECL_CAST(HeapNumber)
DECL_VERIFIER(HeapNumber)
DECL_PRINTER(HeapNumber)
V8_EXPORT_PRIVATE void HeapNumberShortPrint(std::ostream& os);
OBJECT_CONSTRUCTORS(HeapNumber, PrimitiveHeapObject);
TQ_OBJECT_CONSTRUCTORS(HeapNumber)
};
} // namespace internal

View File

@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
extern class HeapNumber extends PrimitiveHeapObject { value: float64; }
@generateCppClass
extern class HeapNumber extends PrimitiveHeapObject {
value: float64;
}
// The HeapNumber value NaN
type NaN extends HeapNumber;

View File

@ -23,6 +23,7 @@ bitfield struct JSDateTimeFormatFlags extends uint31 {
time_style: DateTimeStyle: 3 bit;
}
@generateCppClass
extern class JSDateTimeFormat extends JSObject {
locale: String;
icu_locale: Foreign; // Managed<icu::Locale>
@ -40,6 +41,7 @@ bitfield struct JSDisplayNamesFlags extends uint31 {
fallback: JSDisplayNamesFallback: 1 bit;
}
@generateCppClass
extern class JSDisplayNames extends JSObject {
internal: Foreign; // Managed<DisplayNamesInternal>
flags: SmiTagged<JSDisplayNamesFlags>;
@ -52,12 +54,14 @@ bitfield struct JSListFormatFlags extends uint31 {
Type: JSListFormatType: 2 bit; // "type" is a reserved word.
}
@generateCppClass
extern class JSListFormat extends JSObject {
locale: String;
icu_formatter: Foreign; // Managed<icu::ListFormatter>
flags: SmiTagged<JSListFormatFlags>;
}
@generateCppClass
extern class JSNumberFormat extends JSObject {
locale: String;
icu_number_formatter:
@ -70,6 +74,7 @@ bitfield struct JSPluralRulesFlags extends uint31 {
Type: JSPluralRulesType: 1 bit; // "type" is a reserved word.
}
@generateCppClass
extern class JSPluralRules extends JSObject {
locale: String;
flags: SmiTagged<JSPluralRulesFlags>;
@ -84,6 +89,7 @@ bitfield struct JSRelativeTimeFormatFlags extends uint31 {
numeric: JSRelativeTimeFormatNumeric: 1 bit;
}
@generateCppClass
extern class JSRelativeTimeFormat extends JSObject {
locale: String;
numberingSystem: String;
@ -91,6 +97,7 @@ extern class JSRelativeTimeFormat extends JSObject {
flags: SmiTagged<JSRelativeTimeFormatFlags>;
}
@generateCppClass
extern class JSLocale extends JSObject {
icu_locale: Foreign; // Managed<icu::Locale>
}
@ -101,6 +108,7 @@ bitfield struct JSSegmenterFlags extends uint31 {
granularity: JSSegmenterGranularity: 2 bit;
}
@generateCppClass
extern class JSSegmenter extends JSObject {
locale: String;
icu_break_iterator: Foreign; // Managed<icu::BreakIterator>
@ -112,12 +120,14 @@ bitfield struct JSSegmentIteratorFlags extends uint31 {
break_type_set: bool: 1 bit;
}
@generateCppClass
extern class JSSegmentIterator extends JSObject {
icu_break_iterator: Foreign; // Managed<icu::BreakIterator>
unicode_string: Foreign; // Managed<icu::UnicodeString>
flags: SmiTagged<JSSegmentIteratorFlags>;
}
@generateCppClass
extern class JSV8BreakIterator extends JSObject {
locale: String;
break_iterator: Foreign; // Managed<icu::BreakIterator>;
@ -129,6 +139,7 @@ extern class JSV8BreakIterator extends JSObject {
bound_break_type: Undefined|JSFunction;
}
@generateCppClass
extern class JSCollator extends JSObject {
icu_collator: Foreign; // Managed<icu::Collator>
bound_compare: Undefined|JSFunction;

View File

@ -15,7 +15,6 @@
namespace v8 {
namespace internal {
CAST_ACCESSOR(JSAggregateError)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSAggregateError)
} // namespace internal

View File

@ -17,7 +17,6 @@ namespace internal {
class JSAggregateError
: public TorqueGeneratedJSAggregateError<JSAggregateError, JSObject> {
public:
DECL_CAST(JSAggregateError)
DECL_PRINTER(JSAggregateError)
TQ_OBJECT_CONSTRUCTORS(JSAggregateError)
};

View File

@ -20,15 +20,10 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSArrayBuffer, JSObject)
OBJECT_CONSTRUCTORS_IMPL(JSArrayBufferView, JSObject)
OBJECT_CONSTRUCTORS_IMPL(JSTypedArray, JSArrayBufferView)
OBJECT_CONSTRUCTORS_IMPL(JSDataView, JSArrayBufferView)
CAST_ACCESSOR(JSArrayBuffer)
CAST_ACCESSOR(JSArrayBufferView)
CAST_ACCESSOR(JSTypedArray)
CAST_ACCESSOR(JSDataView)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSArrayBuffer)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSArrayBufferView)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSTypedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSDataView)
size_t JSArrayBuffer::byte_length() const {
return ReadField<size_t>(kByteLengthOffset);
@ -190,8 +185,6 @@ void JSArrayBufferView::set_byte_length(size_t value) {
WriteField<size_t>(kByteLengthOffset, value);
}
ACCESSORS(JSArrayBufferView, buffer, Object, kBufferOffset)
bool JSArrayBufferView::WasDetached() const {
return JSArrayBuffer::cast(buffer()).was_detached();
}
@ -247,8 +240,6 @@ void JSTypedArray::RemoveExternalPointerCompensationForSerialization(
external_pointer() - ExternalPointerCompensationForOnHeapArray(isolate));
}
ACCESSORS(JSTypedArray, base_pointer, Object, kBasePointerOffset)
void* JSTypedArray::DataPtr() {
// Zero-extend Tagged_t to Address according to current compression scheme
// so that the addition with |external_pointer| (which already contains

View File

@ -17,7 +17,8 @@ namespace internal {
class ArrayBufferExtension;
class JSArrayBuffer : public JSObject {
class JSArrayBuffer
: public TorqueGeneratedJSArrayBuffer<JSArrayBuffer, JSObject> {
public:
// The maximum length for JSArrayBuffer's supported by V8.
// On 32-bit architectures we limit this to 2GiB, so that
@ -71,8 +72,6 @@ class JSArrayBuffer : public JSObject {
// [is_shared]: tells whether this is an ArrayBuffer or a SharedArrayBuffer.
DECL_BOOLEAN_ACCESSORS(is_shared)
DECL_CAST(JSArrayBuffer)
// Initializes the fields of the ArrayBuffer. The provided backing_store can
// be nullptr. If it is not nullptr, then the function registers it with
// src/heap/array-buffer-tracker.h.
@ -126,9 +125,6 @@ class JSArrayBuffer : public JSObject {
DECL_PRINTER(JSArrayBuffer)
DECL_VERIFIER(JSArrayBuffer)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_ARRAY_BUFFER_FIELDS)
static constexpr int kEndOfTaggedFieldsOffset = JSObject::kHeaderSize;
static const int kSizeWithEmbedderFields =
@ -137,8 +133,6 @@ class JSArrayBuffer : public JSObject {
class BodyDescriptor;
OBJECT_CONSTRUCTORS(JSArrayBuffer, JSObject);
private:
inline ArrayBufferExtension** extension_location() const;
@ -148,6 +142,8 @@ class JSArrayBuffer : public JSObject {
inline uint32_t* extension_lo() const;
inline uint32_t* extension_hi() const;
#endif
TQ_OBJECT_CONSTRUCTORS(JSArrayBuffer)
};
// Each JSArrayBuffer (with a backing store) has a corresponding native-heap
@ -221,44 +217,29 @@ class ArrayBufferExtension : public Malloced {
void set_next(ArrayBufferExtension* extension) { next_ = extension; }
};
class JSArrayBufferView : public JSObject {
class JSArrayBufferView
: public TorqueGeneratedJSArrayBufferView<JSArrayBufferView, JSObject> {
public:
// [buffer]: ArrayBuffer that this typed array views.
DECL_ACCESSORS(buffer, Object)
// [byte_offset]: offset of typed array in bytes.
DECL_PRIMITIVE_ACCESSORS(byte_offset, size_t)
// [byte_length]: length of typed array in bytes.
DECL_PRIMITIVE_ACCESSORS(byte_length, size_t)
DECL_CAST(JSArrayBufferView)
DECL_VERIFIER(JSArrayBufferView)
inline bool WasDetached() const;
// Layout description.
#define JS_ARRAY_BUFFER_VIEW_FIELDS(V) \
V(kBufferOffset, kTaggedSize) \
V(kEndOfTaggedFieldsOffset, 0) \
/* Raw data fields. */ \
V(kByteOffsetOffset, kUIntptrSize) \
V(kByteLengthOffset, kUIntptrSize) \
/* Header size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JS_ARRAY_BUFFER_VIEW_FIELDS)
#undef JS_ARRAY_BUFFER_VIEW_FIELDS
static constexpr int kEndOfTaggedFieldsOffset = kByteOffsetOffset;
STATIC_ASSERT(IsAligned(kByteOffsetOffset, kUIntptrSize));
STATIC_ASSERT(IsAligned(kByteLengthOffset, kUIntptrSize));
OBJECT_CONSTRUCTORS(JSArrayBufferView, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSArrayBufferView)
};
class JSTypedArray : public JSArrayBufferView {
class JSTypedArray
: public TorqueGeneratedJSTypedArray<JSTypedArray, JSArrayBufferView> {
public:
// TODO(v8:4153): This should be equal to JSArrayBuffer::kMaxByteLength
// eventually.
@ -272,8 +253,6 @@ class JSTypedArray : public JSArrayBufferView {
Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
PropertyDescriptor* desc, Maybe<ShouldThrow> should_throw);
DECL_CAST(JSTypedArray)
ExternalArrayType type();
V8_EXPORT_PRIVATE size_t element_size();
@ -325,19 +304,6 @@ class JSTypedArray : public JSArrayBufferView {
DECL_PRINTER(JSTypedArray)
DECL_VERIFIER(JSTypedArray)
// Layout description.
#define JS_TYPED_ARRAY_FIELDS(V) \
/* Raw data fields. */ \
V(kLengthOffset, kUIntptrSize) \
V(kExternalPointerOffset, kExternalPointerSize) \
V(kBasePointerOffset, kTaggedSize) \
/* Header size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSArrayBufferView::kHeaderSize,
JS_TYPED_ARRAY_FIELDS)
#undef JS_TYPED_ARRAY_FIELDS
STATIC_ASSERT(IsAligned(kLengthOffset, kUIntptrSize));
STATIC_ASSERT(IsAligned(kExternalPointerOffset, kSystemPointerSize));
@ -356,39 +322,24 @@ class JSTypedArray : public JSArrayBufferView {
private:
friend class Deserializer;
// [base_pointer]: TODO(v8:4153)
DECL_ACCESSORS(base_pointer, Object)
// [external_pointer]: TODO(v8:4153)
DECL_GETTER(external_pointer, Address)
inline void set_external_pointer(Isolate* isolate, Address value);
OBJECT_CONSTRUCTORS(JSTypedArray, JSArrayBufferView);
TQ_OBJECT_CONSTRUCTORS(JSTypedArray)
};
class JSDataView : public JSArrayBufferView {
class JSDataView
: public TorqueGeneratedJSDataView<JSDataView, JSArrayBufferView> {
public:
// [data_pointer]: pointer to the actual data.
DECL_GETTER(data_pointer, void*)
inline void set_data_pointer(Isolate* isolate, void* value);
DECL_CAST(JSDataView)
// Dispatched behavior.
DECL_PRINTER(JSDataView)
DECL_VERIFIER(JSDataView)
// Layout description.
#define JS_DATA_VIEW_FIELDS(V) \
/* Raw data fields. */ \
V(kDataPointerOffset, kIntptrSize) \
/* Header size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSArrayBufferView::kHeaderSize,
JS_DATA_VIEW_FIELDS)
#undef JS_DATA_VIEW_FIELDS
STATIC_ASSERT(IsAligned(kDataPointerOffset, kUIntptrSize));
static const int kSizeWithEmbedderFields =
@ -397,7 +348,7 @@ class JSDataView : public JSArrayBufferView {
class BodyDescriptor;
OBJECT_CONSTRUCTORS(JSDataView, JSArrayBufferView);
TQ_OBJECT_CONSTRUCTORS(JSDataView)
};
} // namespace internal

View File

@ -10,6 +10,7 @@ bitfield struct JSArrayBufferFlags extends uint32 {
is_shared: bool: 1 bit;
}
@generateCppClass
extern class JSArrayBuffer extends JSObject {
byte_length: uintptr;
backing_store: ExternalPointer;
@ -34,18 +35,22 @@ macro IsSharedArrayBuffer(buffer: JSArrayBuffer): bool {
}
@abstract
@generateCppClass
extern class JSArrayBufferView extends JSObject {
buffer: JSArrayBuffer;
byte_offset: uintptr;
byte_length: uintptr;
}
@generateCppClass
extern class JSTypedArray extends JSArrayBufferView {
length: uintptr;
external_pointer: ExternalPointer;
// [base_pointer]: TODO(v8:4153)
base_pointer: ByteArray|Smi;
}
@generateCppClass
extern class JSDataView extends JSArrayBufferView {
data_pointer: ExternalPointer;
}

View File

@ -18,20 +18,12 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSV8BreakIterator, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSV8BreakIterator)
ACCESSORS(JSV8BreakIterator, locale, String, kLocaleOffset)
ACCESSORS(JSV8BreakIterator, break_iterator, Managed<icu::BreakIterator>,
kBreakIteratorOffset)
ACCESSORS(JSV8BreakIterator, unicode_string, Managed<icu::UnicodeString>,
kUnicodeStringOffset)
ACCESSORS(JSV8BreakIterator, bound_adopt_text, Object, kBoundAdoptTextOffset)
ACCESSORS(JSV8BreakIterator, bound_first, Object, kBoundFirstOffset)
ACCESSORS(JSV8BreakIterator, bound_next, Object, kBoundNextOffset)
ACCESSORS(JSV8BreakIterator, bound_current, Object, kBoundCurrentOffset)
ACCESSORS(JSV8BreakIterator, bound_break_type, Object, kBoundBreakTypeOffset)
CAST_ACCESSOR(JSV8BreakIterator)
} // namespace internal
} // namespace v8

View File

@ -27,7 +27,8 @@ class BreakIterator;
namespace v8 {
namespace internal {
class JSV8BreakIterator : public JSObject {
class JSV8BreakIterator
: public TorqueGeneratedJSV8BreakIterator<JSV8BreakIterator, JSObject> {
public:
V8_WARN_UNUSED_RESULT static MaybeHandle<JSV8BreakIterator> New(
Isolate* isolate, Handle<Map> map, Handle<Object> input_locales,
@ -51,25 +52,12 @@ class JSV8BreakIterator : public JSObject {
static String BreakType(Isolate* isolate,
Handle<JSV8BreakIterator> break_iterator);
DECL_CAST(JSV8BreakIterator)
DECL_PRINTER(JSV8BreakIterator)
DECL_VERIFIER(JSV8BreakIterator)
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(break_iterator, Managed<icu::BreakIterator>)
DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>)
DECL_ACCESSORS(bound_adopt_text, Object)
DECL_ACCESSORS(bound_first, Object)
DECL_ACCESSORS(bound_next, Object)
DECL_ACCESSORS(bound_current, Object)
DECL_ACCESSORS(bound_break_type, Object)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_V8_BREAK_ITERATOR_FIELDS)
private:
OBJECT_CONSTRUCTORS(JSV8BreakIterator, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSV8BreakIterator)
};
} // namespace internal

View File

@ -18,12 +18,9 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSCollator, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSCollator)
ACCESSORS(JSCollator, icu_collator, Managed<icu::Collator>, kIcuCollatorOffset)
ACCESSORS(JSCollator, bound_compare, Object, kBoundCompareOffset)
CAST_ACCESSOR(JSCollator)
} // namespace internal
} // namespace v8

View File

@ -29,7 +29,7 @@ class Collator;
namespace v8 {
namespace internal {
class JSCollator : public JSObject {
class JSCollator : public TorqueGeneratedJSCollator<JSCollator, JSObject> {
public:
// ecma402/#sec-initializecollator
V8_WARN_UNUSED_RESULT static MaybeHandle<JSCollator> New(
@ -42,18 +42,11 @@ class JSCollator : public JSObject {
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
DECL_CAST(JSCollator)
DECL_PRINTER(JSCollator)
DECL_VERIFIER(JSCollator)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_COLLATOR_FIELDS)
DECL_ACCESSORS(icu_collator, Managed<icu::Collator>)
DECL_ACCESSORS(bound_compare, Object)
OBJECT_CONSTRUCTORS(JSCollator, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSCollator)
};
} // namespace internal

View File

@ -18,16 +18,13 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSDateTimeFormat, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSDateTimeFormat)
ACCESSORS(JSDateTimeFormat, locale, String, kLocaleOffset)
ACCESSORS(JSDateTimeFormat, icu_locale, Managed<icu::Locale>, kIcuLocaleOffset)
ACCESSORS(JSDateTimeFormat, icu_simple_date_format,
Managed<icu::SimpleDateFormat>, kIcuSimpleDateFormatOffset)
ACCESSORS(JSDateTimeFormat, icu_date_interval_format,
Managed<icu::DateIntervalFormat>, kIcuDateIntervalFormatOffset)
ACCESSORS(JSDateTimeFormat, bound_format, Object, kBoundFormatOffset)
SMI_ACCESSORS(JSDateTimeFormat, flags, kFlagsOffset)
inline void JSDateTimeFormat::set_hour_cycle(HourCycle hour_cycle) {
int hints = flags();
@ -61,8 +58,6 @@ inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::time_style() const {
return TimeStyleBits::decode(flags());
}
CAST_ACCESSOR(JSDateTimeFormat)
} // namespace internal
} // namespace v8

View File

@ -31,7 +31,8 @@ class SimpleDateFormat;
namespace v8 {
namespace internal {
class JSDateTimeFormat : public JSObject {
class JSDateTimeFormat
: public TorqueGeneratedJSDateTimeFormat<JSDateTimeFormat, JSObject> {
public:
V8_WARN_UNUSED_RESULT static MaybeHandle<JSDateTimeFormat> New(
Isolate* isolate, Handle<Map> map, Handle<Object> locales,
@ -84,15 +85,10 @@ class JSDateTimeFormat : public JSObject {
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
Handle<String> HourCycleAsString() const;
DECL_CAST(JSDateTimeFormat)
// ecma-402/#sec-properties-of-intl-datetimeformat-instances
enum class DateTimeStyle { kUndefined, kFull, kLong, kMedium, kShort };
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_DATE_TIME_FORMAT_FIELDS)
// enum for "hourCycle" option.
enum class HourCycle { kUndefined, kH11, kH12, kH23, kH24 };
@ -126,17 +122,13 @@ class JSDateTimeFormat : public JSObject {
STATIC_ASSERT(DateTimeStyle::kMedium <= TimeStyleBits::kMax);
STATIC_ASSERT(DateTimeStyle::kShort <= TimeStyleBits::kMax);
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_locale, Managed<icu::Locale>)
DECL_ACCESSORS(icu_simple_date_format, Managed<icu::SimpleDateFormat>)
DECL_ACCESSORS(icu_date_interval_format, Managed<icu::DateIntervalFormat>)
DECL_ACCESSORS(bound_format, Object)
DECL_INT_ACCESSORS(flags)
DECL_PRINTER(JSDateTimeFormat)
DECL_VERIFIER(JSDateTimeFormat)
OBJECT_CONSTRUCTORS(JSDateTimeFormat, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSDateTimeFormat)
};
} // namespace internal

View File

@ -20,12 +20,7 @@ namespace internal {
ACCESSORS(JSDisplayNames, internal, Managed<DisplayNamesInternal>,
kInternalOffset)
OBJECT_CONSTRUCTORS_IMPL(JSDisplayNames, JSObject)
// Base display names accessors.
SMI_ACCESSORS(JSDisplayNames, flags, kFlagsOffset)
CAST_ACCESSOR(JSDisplayNames)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSDisplayNames)
inline void JSDisplayNames::set_style(Style style) {
DCHECK_GE(StyleBits::kMax, style);

View File

@ -25,7 +25,8 @@ namespace internal {
class DisplayNamesInternal;
class JSDisplayNames : public JSObject {
class JSDisplayNames
: public TorqueGeneratedJSDisplayNames<JSDisplayNames, JSObject> {
public:
// Creates display names object with properties derived from input
// locales and options.
@ -65,8 +66,6 @@ class JSDisplayNames : public JSObject {
inline void set_fallback(Fallback fallback);
inline Fallback fallback() const;
DECL_CAST(JSDisplayNames)
// Bit positions in |flags|.
DEFINE_TORQUE_GENERATED_JS_DISPLAY_NAMES_FLAGS()
@ -76,19 +75,11 @@ class JSDisplayNames : public JSObject {
STATIC_ASSERT(Fallback::kCode <= FallbackBit::kMax);
STATIC_ASSERT(Fallback::kNone <= FallbackBit::kMax);
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
DECL_ACCESSORS(internal, Managed<DisplayNamesInternal>)
DECL_PRINTER(JSDisplayNames)
DECL_VERIFIER(JSDisplayNames)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_DISPLAY_NAMES_FIELDS)
OBJECT_CONSTRUCTORS(JSDisplayNames, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSDisplayNames)
};
} // namespace internal

View File

@ -18,13 +18,11 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSListFormat, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSListFormat)
// Base list format accessors.
ACCESSORS(JSListFormat, locale, String, kLocaleOffset)
ACCESSORS(JSListFormat, icu_formatter, Managed<icu::ListFormatter>,
kIcuFormatterOffset)
SMI_ACCESSORS(JSListFormat, flags, kFlagsOffset)
inline void JSListFormat::set_style(Style style) {
DCHECK_GE(StyleBits::kMax, style);
@ -48,8 +46,6 @@ inline JSListFormat::Type JSListFormat::type() const {
return TypeBits::decode(flags());
}
CAST_ACCESSOR(JSListFormat)
} // namespace internal
} // namespace v8

View File

@ -29,7 +29,8 @@ class ListFormatter;
namespace v8 {
namespace internal {
class JSListFormat : public JSObject {
class JSListFormat
: public TorqueGeneratedJSListFormat<JSListFormat, JSObject> {
public:
// Creates relative time format object with properties derived from input
// locales and options.
@ -55,10 +56,7 @@ class JSListFormat : public JSObject {
Handle<String> StyleAsString() const;
Handle<String> TypeAsString() const;
DECL_CAST(JSListFormat)
// ListFormat accessors.
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_formatter, Managed<icu::ListFormatter>)
// Style: identifying the relative time format style used.
@ -93,17 +91,9 @@ class JSListFormat : public JSObject {
STATIC_ASSERT(Type::DISJUNCTION <= TypeBits::kMax);
STATIC_ASSERT(Type::UNIT <= TypeBits::kMax);
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
DECL_PRINTER(JSListFormat)
DECL_VERIFIER(JSListFormat)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_LIST_FORMAT_FIELDS)
OBJECT_CONSTRUCTORS(JSListFormat, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSListFormat)
};
} // namespace internal

View File

@ -19,12 +19,10 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSLocale, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSLocale)
ACCESSORS(JSLocale, icu_locale, Managed<icu::Locale>, kIcuLocaleOffset)
CAST_ACCESSOR(JSLocale)
} // namespace internal
} // namespace v8

View File

@ -25,7 +25,7 @@ class Locale;
namespace v8 {
namespace internal {
class JSLocale : public JSObject {
class JSLocale : public TorqueGeneratedJSLocale<JSLocale, JSObject> {
public:
// Creates locale object with properties derived from input locale string
// and options.
@ -62,18 +62,11 @@ class JSLocale : public JSObject {
// Help function to check well-formed "3alpha"
static bool Is3Alpha(const std::string& value);
DECL_CAST(JSLocale)
DECL_ACCESSORS(icu_locale, Managed<icu::Locale>)
DECL_PRINTER(JSLocale)
DECL_VERIFIER(JSLocale)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_LOCALE_FIELDS)
OBJECT_CONSTRUCTORS(JSLocale, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSLocale)
};
} // namespace internal

View File

@ -18,15 +18,11 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSNumberFormat, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSNumberFormat)
ACCESSORS(JSNumberFormat, locale, String, kLocaleOffset)
ACCESSORS(JSNumberFormat, icu_number_formatter,
Managed<icu::number::LocalizedNumberFormatter>,
kIcuNumberFormatterOffset)
ACCESSORS(JSNumberFormat, bound_format, Object, kBoundFormatOffset)
CAST_ACCESSOR(JSNumberFormat)
} // namespace internal
} // namespace v8

View File

@ -32,7 +32,8 @@ class LocalizedNumberFormatter;
namespace v8 {
namespace internal {
class JSNumberFormat : public JSObject {
class JSNumberFormat
: public TorqueGeneratedJSNumberFormat<JSNumberFormat, JSObject> {
public:
// ecma402/#sec-initializenumberformat
V8_WARN_UNUSED_RESULT static MaybeHandle<JSNumberFormat> New(
@ -69,21 +70,12 @@ class JSNumberFormat : public JSObject {
const icu::number::LocalizedNumberFormatter& icu_number_formatter,
const Intl::NumberFormatDigitOptions& digit_options);
DECL_CAST(JSNumberFormat)
DECL_PRINTER(JSNumberFormat)
DECL_VERIFIER(JSNumberFormat)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_NUMBER_FORMAT_FIELDS)
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_number_formatter,
Managed<icu::number::LocalizedNumberFormatter>)
DECL_ACCESSORS(bound_format, Object)
DECL_INT_ACCESSORS(flags)
OBJECT_CONSTRUCTORS(JSNumberFormat, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSNumberFormat)
};
struct NumberFormatSpan {

View File

@ -19,10 +19,8 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSPluralRules, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSPluralRules)
ACCESSORS(JSPluralRules, locale, String, kLocaleOffset)
SMI_ACCESSORS(JSPluralRules, flags, kFlagsOffset)
ACCESSORS(JSPluralRules, icu_plural_rules, Managed<icu::PluralRules>,
kIcuPluralRulesOffset)
ACCESSORS(JSPluralRules, icu_number_formatter,
@ -40,8 +38,6 @@ inline JSPluralRules::Type JSPluralRules::type() const {
return TypeBit::decode(flags());
}
CAST_ACCESSOR(JSPluralRules)
} // namespace internal
} // namespace v8

View File

@ -32,7 +32,8 @@ class LocalizedNumberFormatter;
namespace v8 {
namespace internal {
class JSPluralRules : public JSObject {
class JSPluralRules
: public TorqueGeneratedJSPluralRules<JSPluralRules, JSObject> {
public:
V8_WARN_UNUSED_RESULT static MaybeHandle<JSPluralRules> New(
Isolate* isolate, Handle<Map> map, Handle<Object> locales,
@ -54,9 +55,7 @@ class JSPluralRules : public JSObject {
Handle<String> TypeAsString() const;
DECL_CAST(JSPluralRules)
DECL_PRINTER(JSPluralRules)
DECL_VERIFIER(JSPluralRules)
// Bit positions in |flags|.
DEFINE_TORQUE_GENERATED_JS_PLURAL_RULES_FLAGS()
@ -64,17 +63,11 @@ class JSPluralRules : public JSObject {
STATIC_ASSERT(Type::CARDINAL <= TypeBit::kMax);
STATIC_ASSERT(Type::ORDINAL <= TypeBit::kMax);
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_PLURAL_RULES_FIELDS)
DECL_ACCESSORS(locale, String)
DECL_INT_ACCESSORS(flags)
DECL_ACCESSORS(icu_plural_rules, Managed<icu::PluralRules>)
DECL_ACCESSORS(icu_number_formatter,
Managed<icu::number::LocalizedNumberFormatter>)
OBJECT_CONSTRUCTORS(JSPluralRules, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSPluralRules)
};
} // namespace internal

View File

@ -18,14 +18,11 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSRelativeTimeFormat, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSRelativeTimeFormat)
// Base relative time format accessors.
ACCESSORS(JSRelativeTimeFormat, locale, String, kLocaleOffset)
ACCESSORS(JSRelativeTimeFormat, numberingSystem, String, kNumberingSystemOffset)
ACCESSORS(JSRelativeTimeFormat, icu_formatter,
Managed<icu::RelativeDateTimeFormatter>, kIcuFormatterOffset)
SMI_ACCESSORS(JSRelativeTimeFormat, flags, kFlagsOffset)
inline void JSRelativeTimeFormat::set_numeric(Numeric numeric) {
DCHECK_GE(NumericBit::kMax, numeric);
@ -38,8 +35,6 @@ inline JSRelativeTimeFormat::Numeric JSRelativeTimeFormat::numeric() const {
return NumericBit::decode(flags());
}
CAST_ACCESSOR(JSRelativeTimeFormat)
} // namespace internal
} // namespace v8

View File

@ -29,7 +29,9 @@ class RelativeDateTimeFormatter;
namespace v8 {
namespace internal {
class JSRelativeTimeFormat : public JSObject {
class JSRelativeTimeFormat
: public TorqueGeneratedJSRelativeTimeFormat<JSRelativeTimeFormat,
JSObject> {
public:
// Creates relative time format object with properties derived from input
// locales and options.
@ -54,12 +56,7 @@ class JSRelativeTimeFormat : public JSObject {
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
DECL_CAST(JSRelativeTimeFormat)
// RelativeTimeFormat accessors.
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(numberingSystem, String)
DECL_ACCESSORS(icu_formatter, Managed<icu::RelativeDateTimeFormatter>)
// Numeric: identifying whether numerical descriptions are always used, or
@ -81,18 +78,9 @@ class JSRelativeTimeFormat : public JSObject {
STATIC_ASSERT(Numeric::AUTO <= NumericBit::kMax);
STATIC_ASSERT(Numeric::ALWAYS <= NumericBit::kMax);
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
DECL_PRINTER(JSRelativeTimeFormat)
DECL_VERIFIER(JSRelativeTimeFormat)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_RELATIVE_TIME_FORMAT_FIELDS)
private:
OBJECT_CONSTRUCTORS(JSRelativeTimeFormat, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSRelativeTimeFormat)
};
} // namespace internal

View File

@ -18,7 +18,7 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator)
// Base segment iterator accessors.
ACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>,
@ -29,10 +29,6 @@ ACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>,
BIT_FIELD_ACCESSORS(JSSegmentIterator, flags, is_break_type_set,
JSSegmentIterator::BreakTypeSetBit)
SMI_ACCESSORS(JSSegmentIterator, flags, kFlagsOffset)
CAST_ACCESSOR(JSSegmentIterator)
inline void JSSegmentIterator::set_granularity(
JSSegmenter::Granularity granularity) {
DCHECK_GE(GranularityBits::kMax, granularity);

View File

@ -28,7 +28,8 @@ class UnicodeString;
namespace v8 {
namespace internal {
class JSSegmentIterator : public JSObject {
class JSSegmentIterator
: public TorqueGeneratedJSSegmentIterator<JSSegmentIterator, JSObject> {
public:
// ecma402 #sec-CreateSegmentIterator
V8_WARN_UNUSED_RESULT static MaybeHandle<JSSegmentIterator> Create(
@ -64,14 +65,11 @@ class JSSegmentIterator : public JSObject {
int32_t start,
int32_t end) const;
DECL_CAST(JSSegmentIterator)
// SegmentIterator accessors.
DECL_ACCESSORS(icu_break_iterator, Managed<icu::BreakIterator>)
DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>)
DECL_PRINTER(JSSegmentIterator)
DECL_VERIFIER(JSSegmentIterator)
inline void set_granularity(JSSegmenter::Granularity granularity);
inline JSSegmenter::Granularity granularity() const;
@ -83,14 +81,7 @@ class JSSegmentIterator : public JSObject {
STATIC_ASSERT(JSSegmenter::Granularity::WORD <= GranularityBits::kMax);
STATIC_ASSERT(JSSegmenter::Granularity::SENTENCE <= GranularityBits::kMax);
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_SEGMENT_ITERATOR_FIELDS)
OBJECT_CONSTRUCTORS(JSSegmentIterator, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSSegmentIterator)
};
} // namespace internal

View File

@ -18,13 +18,11 @@
namespace v8 {
namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSSegmenter, JSObject)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmenter)
// Base segmenter accessors.
ACCESSORS(JSSegmenter, locale, String, kLocaleOffset)
ACCESSORS(JSSegmenter, icu_break_iterator, Managed<icu::BreakIterator>,
kIcuBreakIteratorOffset)
SMI_ACCESSORS(JSSegmenter, flags, kFlagsOffset)
inline void JSSegmenter::set_granularity(Granularity granularity) {
DCHECK_GE(GranularityBits::kMax, granularity);
@ -37,8 +35,6 @@ inline JSSegmenter::Granularity JSSegmenter::granularity() const {
return GranularityBits::decode(flags());
}
CAST_ACCESSOR(JSSegmenter)
} // namespace internal
} // namespace v8

View File

@ -29,7 +29,7 @@ class BreakIterator;
namespace v8 {
namespace internal {
class JSSegmenter : public JSObject {
class JSSegmenter : public TorqueGeneratedJSSegmenter<JSSegmenter, JSObject> {
public:
// Creates segmenter object with properties derived from input locales and
// options.
@ -44,11 +44,7 @@ class JSSegmenter : public JSObject {
Handle<String> GranularityAsString() const;
DECL_CAST(JSSegmenter)
// Segmenter accessors.
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_break_iterator, Managed<icu::BreakIterator>)
// Granularity: identifying the segmenter used.
@ -69,18 +65,9 @@ class JSSegmenter : public JSObject {
STATIC_ASSERT(Granularity::WORD <= GranularityBits::kMax);
STATIC_ASSERT(Granularity::SENTENCE <= GranularityBits::kMax);
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
DECL_PRINTER(JSSegmenter)
DECL_VERIFIER(JSSegmenter)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_SEGMENTER_FIELDS)
private:
OBJECT_CONSTRUCTORS(JSSegmenter, JSObject);
TQ_OBJECT_CONSTRUCTORS(JSSegmenter)
};
} // namespace internal

View File

@ -3636,6 +3636,11 @@ void CppClassGenerator::GenerateFieldAccessor(const Field& f) {
// TODO(danno): Support generation of struct accessors
if (f.name_and_type.type->IsStructType()) return;
// TODO(v8:10391) Generate accessors for external pointers
if (f.name_and_type.type->IsSubtypeOf(TypeOracle::GetExternalPointerType())) {
return;
}
if (!f.name_and_type.type->IsSubtypeOf(TypeOracle::GetTaggedType())) {
return GenerateFieldAccessorForUntagged(f);
}
@ -3997,24 +4002,8 @@ void ImplementationVisitor::GenerateClassDefinitions(
implementation
<< "#include \"torque-generated/class-definitions-tq.h\"\n\n";
implementation << "#include \"torque-generated/class-verifiers-tq.h\"\n\n";
implementation << "#include \"src/objects/arguments-inl.h\"\n";
implementation << "#include \"src/objects/js-aggregate-error-inl.h\"\n";
implementation << "#include \"src/objects/js-collection-inl.h\"\n";
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";
implementation << "#include \"src/objects/microtask-inl.h\"\n";
implementation << "#include \"src/objects/module-inl.h\"\n";
implementation << "#include \"src/objects/promise-inl.h\"\n";
implementation
<< "#include \"src/objects/property-descriptor-object-inl.h\"\n";
implementation << "#include \"src/objects/stack-frame-info-inl.h\"\n";
implementation << "#include \"src/objects/struct-inl.h\"\n";
implementation << "#include \"src/objects/template-objects-inl.h\"\n\n";
<< "#include \"src/objects/class-definitions-tq-deps-inl.h\"\n\n";
implementation
<< "#include "
"\"torque-generated/internal-class-definitions-tq-inl.h\"\n\n";

View File

@ -179,6 +179,9 @@ TEST(ReduceJSLoadContext0) {
CHECK(match.HasValue());
CHECK_EQ(*expected, *match.Value());
}
// Clean up so that verifiers don't complain.
native->set(slot, Smi::zero());
}
TEST(ReduceJSLoadContext1) {
@ -477,6 +480,9 @@ TEST(ReduceJSStoreContext0) {
CHECK_EQ(0, static_cast<int>(access.depth()));
CHECK_EQ(false, access.immutable());
}
// Clean up so that verifiers don't complain.
native->set(slot, Smi::zero());
}
TEST(ReduceJSStoreContext1) {