Commit e7693985 authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[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/+/2185824Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#67719}
parent 2d2b45cd
...@@ -296,10 +296,6 @@ void BytecodeArray::BytecodeArrayVerify(Isolate* isolate) { ...@@ -296,10 +296,6 @@ void BytecodeArray::BytecodeArrayVerify(Isolate* isolate) {
CHECK(handler_table().IsByteArray()); CHECK(handler_table().IsByteArray());
} }
USE_TORQUE_VERIFIER(FreeSpace)
USE_TORQUE_VERIFIER(HeapNumber)
USE_TORQUE_VERIFIER(FeedbackVector) USE_TORQUE_VERIFIER(FeedbackVector)
USE_TORQUE_VERIFIER(JSReceiver) USE_TORQUE_VERIFIER(JSReceiver)
...@@ -1304,8 +1300,6 @@ void JSDataView::JSDataViewVerify(Isolate* isolate) { ...@@ -1304,8 +1300,6 @@ void JSDataView::JSDataViewVerify(Isolate* isolate) {
} }
} }
USE_TORQUE_VERIFIER(Foreign)
void AsyncGeneratorRequest::AsyncGeneratorRequestVerify(Isolate* isolate) { void AsyncGeneratorRequest::AsyncGeneratorRequestVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::AsyncGeneratorRequestVerify(*this, isolate); TorqueGeneratedClassVerifiers::AsyncGeneratorRequestVerify(*this, isolate);
CHECK_GE(resume_mode(), JSGeneratorObject::kNext); CHECK_GE(resume_mode(), JSGeneratorObject::kNext);
...@@ -1488,8 +1482,6 @@ void StoreHandler::StoreHandlerVerify(Isolate* isolate) { ...@@ -1488,8 +1482,6 @@ void StoreHandler::StoreHandlerVerify(Isolate* isolate) {
// TODO(ishell): check handler integrity // TODO(ishell): check handler integrity
} }
USE_TORQUE_VERIFIER(AccessorInfo)
void CallHandlerInfo::CallHandlerInfoVerify(Isolate* isolate) { void CallHandlerInfo::CallHandlerInfoVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::CallHandlerInfoVerify(*this, isolate); TorqueGeneratedClassVerifiers::CallHandlerInfoVerify(*this, isolate);
CHECK(map() == ReadOnlyRoots(isolate).side_effect_call_handler_info_map() || CHECK(map() == ReadOnlyRoots(isolate).side_effect_call_handler_info_map() ||
...@@ -1513,8 +1505,6 @@ void AllocationSite::AllocationSiteVerify(Isolate* isolate) { ...@@ -1513,8 +1505,6 @@ void AllocationSite::AllocationSiteVerify(Isolate* isolate) {
CHECK(nested_site().IsAllocationSite() || nested_site() == Smi::zero()); CHECK(nested_site().IsAllocationSite() || nested_site() == Smi::zero());
} }
USE_TORQUE_VERIFIER(AllocationMemento)
void Script::ScriptVerify(Isolate* isolate) { void Script::ScriptVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::ScriptVerify(*this, isolate); TorqueGeneratedClassVerifiers::ScriptVerify(*this, isolate);
for (int i = 0; i < shared_function_infos().length(); ++i) { for (int i = 0; i < shared_function_infos().length(); ++i) {
...@@ -1558,32 +1548,6 @@ void PreparseData::PreparseDataVerify(Isolate* isolate) { ...@@ -1558,32 +1548,6 @@ void PreparseData::PreparseDataVerify(Isolate* isolate) {
USE_TORQUE_VERIFIER(InterpreterData) 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 #endif // VERIFY_HEAP
#ifdef DEBUG #ifdef DEBUG
......
...@@ -715,12 +715,6 @@ void DescriptorArray::DescriptorArrayPrint(std::ostream& os) { ...@@ -715,12 +715,6 @@ void DescriptorArray::DescriptorArrayPrint(std::ostream& os) {
PrintDescriptors(os); PrintDescriptors(os);
} }
void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(
std::ostream& os) { // NOLINT
PrintHeader(os, "AliasedArgumentsEntry");
os << "\n - aliased_context_slot: " << aliased_context_slot();
}
namespace { namespace {
void PrintFixedArrayWithHeader(std::ostream& os, FixedArray array, void PrintFixedArrayWithHeader(std::ostream& os, FixedArray array,
const char* type) { const char* type) {
...@@ -1436,12 +1430,6 @@ void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT ...@@ -1436,12 +1430,6 @@ void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT
JSObjectPrintBody(os, *this); 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 void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "PropertyCell"); PrintHeader(os, "PropertyCell");
os << "\n - name: "; os << "\n - name: ";
...@@ -1514,17 +1502,6 @@ void Foreign::ForeignPrint(std::ostream& os) { // NOLINT ...@@ -1514,17 +1502,6 @@ void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
os << "\n"; 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 void CallbackTask::CallbackTaskPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "CallbackTask"); PrintHeader(os, "CallbackTask");
os << "\n - callback: " << Brief(callback()); os << "\n - callback: " << Brief(callback());
...@@ -1938,15 +1915,6 @@ void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT ...@@ -1938,15 +1915,6 @@ void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT
os << "\n"; 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 void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
PrintHeader(os, "CallHandlerInfo"); PrintHeader(os, "CallHandlerInfo");
os << "\n - callback: " << Brief(callback()); os << "\n - callback: " << Brief(callback());
...@@ -1957,17 +1925,6 @@ void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT ...@@ -1957,17 +1925,6 @@ void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
os << "\n"; 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( void FunctionTemplateInfo::FunctionTemplateInfoPrint(
std::ostream& os) { // NOLINT std::ostream& os) { // NOLINT
PrintHeader(os, "FunctionTemplateInfo"); PrintHeader(os, "FunctionTemplateInfo");
...@@ -2274,27 +2231,6 @@ void ScopeInfo::ScopeInfoPrint(std::ostream& os) { // NOLINT ...@@ -2274,27 +2231,6 @@ void ScopeInfo::ScopeInfoPrint(std::ostream& os) { // NOLINT
os << "\n"; 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 void StackTraceFrame::StackTraceFramePrint(std::ostream& os) { // NOLINT
PrintHeader(os, "StackTraceFrame"); PrintHeader(os, "StackTraceFrame");
os << "\n - frame_index: " << frame_index(); os << "\n - frame_index: " << frame_index();
......
...@@ -16,12 +16,11 @@ ...@@ -16,12 +16,11 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(AllocationMemento, Struct) TQ_OBJECT_CONSTRUCTORS_IMPL(AllocationMemento)
OBJECT_CONSTRUCTORS_IMPL(AllocationSite, Struct) OBJECT_CONSTRUCTORS_IMPL(AllocationSite, Struct)
NEVER_READ_ONLY_SPACE_IMPL(AllocationSite) NEVER_READ_ONLY_SPACE_IMPL(AllocationSite)
CAST_ACCESSOR(AllocationMemento)
CAST_ACCESSOR(AllocationSite) CAST_ACCESSOR(AllocationSite)
ACCESSORS(AllocationSite, transition_info_or_boilerplate, Object, ACCESSORS(AllocationSite, transition_info_or_boilerplate, Object,
......
...@@ -162,12 +162,9 @@ class AllocationSite : public Struct { ...@@ -162,12 +162,9 @@ class AllocationSite : public Struct {
OBJECT_CONSTRUCTORS(AllocationSite, Struct); OBJECT_CONSTRUCTORS(AllocationSite, Struct);
}; };
class AllocationMemento : public Struct { class AllocationMemento
: public TorqueGeneratedAllocationMemento<AllocationMemento, Struct> {
public: public:
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ALLOCATION_MEMENTO_FIELDS)
DECL_ACCESSORS(allocation_site, Object) DECL_ACCESSORS(allocation_site, Object)
inline bool IsValid() const; inline bool IsValid() const;
...@@ -175,11 +172,8 @@ class AllocationMemento : public Struct { ...@@ -175,11 +172,8 @@ class AllocationMemento : public Struct {
inline Address GetAllocationSiteUnchecked() const; inline Address GetAllocationSiteUnchecked() const;
DECL_PRINTER(AllocationMemento) DECL_PRINTER(AllocationMemento)
DECL_VERIFIER(AllocationMemento)
DECL_CAST(AllocationMemento)
OBJECT_CONSTRUCTORS(AllocationMemento, Struct); TQ_OBJECT_CONSTRUCTORS(AllocationMemento)
}; };
} // namespace internal } // namespace internal
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
extern class AllocationSite extends Struct; extern class AllocationSite extends Struct;
@generateCppClass
extern class AllocationMemento extends Struct { extern class AllocationMemento extends Struct {
allocation_site: AllocationSite; allocation_site: AllocationSite;
} }
...@@ -22,24 +22,15 @@ namespace v8 { ...@@ -22,24 +22,15 @@ namespace v8 {
namespace internal { namespace internal {
TQ_OBJECT_CONSTRUCTORS_IMPL(AccessCheckInfo) TQ_OBJECT_CONSTRUCTORS_IMPL(AccessCheckInfo)
OBJECT_CONSTRUCTORS_IMPL(AccessorInfo, Struct) TQ_OBJECT_CONSTRUCTORS_IMPL(AccessorInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(InterceptorInfo) TQ_OBJECT_CONSTRUCTORS_IMPL(InterceptorInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(CallHandlerInfo) 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, ACCESSORS_CHECKED2(AccessorInfo, getter, Object, kGetterOffset, true,
Foreign::IsNormalized(value)) Foreign::IsNormalized(value))
ACCESSORS_CHECKED2(AccessorInfo, setter, Object, kSetterOffset, true, ACCESSORS_CHECKED2(AccessorInfo, setter, Object, kSetterOffset, true,
Foreign::IsNormalized(value)) Foreign::IsNormalized(value))
ACCESSORS(AccessorInfo, js_getter, Object, kJsGetterOffset)
ACCESSORS(AccessorInfo, data, Object, kDataOffset)
bool AccessorInfo::has_getter() { bool AccessorInfo::has_getter() {
bool result = getter() != Smi::zero(); bool result = getter() != Smi::zero();
...@@ -97,12 +88,12 @@ bool AccessorInfo::HasExpectedReceiverType() { ...@@ -97,12 +88,12 @@ bool AccessorInfo::HasExpectedReceiverType() {
} }
BOOL_ACCESSORS(InterceptorInfo, flags, can_intercept_symbols, BOOL_ACCESSORS(InterceptorInfo, flags, can_intercept_symbols,
kCanInterceptSymbolsBit) CanInterceptSymbolsBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, all_can_read, kAllCanReadBit) BOOL_ACCESSORS(InterceptorInfo, flags, all_can_read, AllCanReadBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, non_masking, kNonMasking) BOOL_ACCESSORS(InterceptorInfo, flags, non_masking, NonMaskingBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, is_named, kNamed) BOOL_ACCESSORS(InterceptorInfo, flags, is_named, NamedBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, has_no_side_effect, kHasNoSideEffect) BOOL_ACCESSORS(InterceptorInfo, flags, has_no_side_effect,
HasNoSideEffectBit::kShift)
bool CallHandlerInfo::IsSideEffectFreeCallHandlerInfo() const { bool CallHandlerInfo::IsSideEffectFreeCallHandlerInfo() const {
ReadOnlyRoots roots = GetReadOnlyRoots(); ReadOnlyRoots roots = GetReadOnlyRoots();
......
...@@ -24,27 +24,17 @@ namespace internal { ...@@ -24,27 +24,17 @@ namespace internal {
// If the accessor in the prototype has the READ_ONLY property attribute, then // 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. // a new value is added to the derived object when the property is set.
// This shadows the accessor in the prototype. // This shadows the accessor in the prototype.
class AccessorInfo : public Struct { class AccessorInfo : public TorqueGeneratedAccessorInfo<AccessorInfo, Struct> {
public: 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. // This directly points at a foreign C function to be used from the runtime.
DECL_ACCESSORS(getter, Object) DECL_ACCESSORS(getter, Object)
inline bool has_getter(); inline bool has_getter();
DECL_ACCESSORS(setter, Object) DECL_ACCESSORS(setter, Object)
inline bool has_setter(); 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); static Address redirect(Address address, AccessorComponent component);
Address redirected_getter() const; Address redirected_getter() const;
// Dispatched behavior.
DECL_PRINTER(AccessorInfo)
DECL_BOOLEAN_ACCESSORS(all_can_read) DECL_BOOLEAN_ACCESSORS(all_can_read)
DECL_BOOLEAN_ACCESSORS(all_can_write) DECL_BOOLEAN_ACCESSORS(all_can_write)
DECL_BOOLEAN_ACCESSORS(is_special_data_property) DECL_BOOLEAN_ACCESSORS(is_special_data_property)
...@@ -68,35 +58,23 @@ class AccessorInfo : public Struct { ...@@ -68,35 +58,23 @@ class AccessorInfo : public Struct {
Handle<Map> map); Handle<Map> map);
inline bool IsCompatibleReceiver(Object receiver); inline bool IsCompatibleReceiver(Object receiver);
DECL_CAST(AccessorInfo)
// Dispatched behavior.
DECL_VERIFIER(AccessorInfo)
// Append all descriptors to the array that are not already there. // Append all descriptors to the array that are not already there.
// Return number added. // Return number added.
static int AppendUnique(Isolate* isolate, Handle<Object> descriptors, static int AppendUnique(Isolate* isolate, Handle<Object> descriptors,
Handle<FixedArray> array, int valid_descriptors); Handle<FixedArray> array, int valid_descriptors);
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ACCESSOR_INFO_FIELDS)
private: private:
inline bool HasExpectedReceiverType(); inline bool HasExpectedReceiverType();
// Bit positions in |flags|. // Bit positions in |flags|.
DEFINE_TORQUE_GENERATED_ACCESSOR_INFO_FLAGS() DEFINE_TORQUE_GENERATED_ACCESSOR_INFO_FLAGS()
OBJECT_CONSTRUCTORS(AccessorInfo, Struct); TQ_OBJECT_CONSTRUCTORS(AccessorInfo)
}; };
class AccessCheckInfo class AccessCheckInfo
: public TorqueGeneratedAccessCheckInfo<AccessCheckInfo, Struct> { : public TorqueGeneratedAccessCheckInfo<AccessCheckInfo, Struct> {
public: public:
// Dispatched behavior.
DECL_PRINTER(AccessCheckInfo)
static AccessCheckInfo Get(Isolate* isolate, Handle<JSObject> receiver); static AccessCheckInfo Get(Isolate* isolate, Handle<JSObject> receiver);
TQ_OBJECT_CONSTRUCTORS(AccessCheckInfo) TQ_OBJECT_CONSTRUCTORS(AccessCheckInfo)
...@@ -111,14 +89,7 @@ class InterceptorInfo ...@@ -111,14 +89,7 @@ class InterceptorInfo
DECL_BOOLEAN_ACCESSORS(is_named) DECL_BOOLEAN_ACCESSORS(is_named)
DECL_BOOLEAN_ACCESSORS(has_no_side_effect) DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
// Dispatched behavior. DEFINE_TORQUE_GENERATED_INTERCEPTOR_INFO_FLAGS()
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;
TQ_OBJECT_CONSTRUCTORS(InterceptorInfo) TQ_OBJECT_CONSTRUCTORS(InterceptorInfo)
}; };
......
...@@ -9,7 +9,16 @@ extern class CallHandlerInfo extends Struct { ...@@ -9,7 +9,16 @@ extern class CallHandlerInfo extends Struct {
data: Object; 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 @generateCppClass
@generatePrint
extern class InterceptorInfo extends Struct { extern class InterceptorInfo extends Struct {
getter: NonNullForeign|Zero|Undefined; getter: NonNullForeign|Zero|Undefined;
setter: NonNullForeign|Zero|Undefined; setter: NonNullForeign|Zero|Undefined;
...@@ -19,10 +28,11 @@ extern class InterceptorInfo extends Struct { ...@@ -19,10 +28,11 @@ extern class InterceptorInfo extends Struct {
enumerator: NonNullForeign|Zero|Undefined; enumerator: NonNullForeign|Zero|Undefined;
definer: NonNullForeign|Zero|Undefined; definer: NonNullForeign|Zero|Undefined;
data: Object; data: Object;
flags: Smi; flags: SmiTagged<InterceptorInfoFlags>;
} }
@generateCppClass @generateCppClass
@generatePrint
extern class AccessCheckInfo extends Struct { extern class AccessCheckInfo extends Struct {
callback: Foreign|Zero|Undefined; callback: Foreign|Zero|Undefined;
named_interceptor: InterceptorInfo|Zero|Undefined; named_interceptor: InterceptorInfo|Zero|Undefined;
...@@ -44,12 +54,16 @@ bitfield struct AccessorInfoFlags extends uint31 { ...@@ -44,12 +54,16 @@ bitfield struct AccessorInfoFlags extends uint31 {
initial_attributes: PropertyAttributes: 3 bit; initial_attributes: PropertyAttributes: 3 bit;
} }
@generateCppClass
@generatePrint
extern class AccessorInfo extends Struct { extern class AccessorInfo extends Struct {
name: Object; name: Name;
flags: SmiTagged<AccessorInfoFlags>; flags: SmiTagged<AccessorInfoFlags>;
expected_receiver_type: Object; expected_receiver_type: Object;
setter: NonNullForeign|Zero; setter: NonNullForeign|Zero;
getter: 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; js_getter: NonNullForeign|Zero;
data: Object; data: Object;
} }
...@@ -113,9 +113,6 @@ class AliasedArgumentsEntry ...@@ -113,9 +113,6 @@ class AliasedArgumentsEntry
: public TorqueGeneratedAliasedArgumentsEntry<AliasedArgumentsEntry, : public TorqueGeneratedAliasedArgumentsEntry<AliasedArgumentsEntry,
Struct> { Struct> {
public: public:
// Dispatched behavior.
DECL_PRINTER(AliasedArgumentsEntry)
TQ_OBJECT_CONSTRUCTORS(AliasedArgumentsEntry) TQ_OBJECT_CONSTRUCTORS(AliasedArgumentsEntry)
}; };
......
...@@ -29,6 +29,7 @@ extern shape JSStrictArgumentsObject extends JSArgumentsObject { ...@@ -29,6 +29,7 @@ extern shape JSStrictArgumentsObject extends JSArgumentsObject {
type SloppyArgumentsElements extends FixedArray; type SloppyArgumentsElements extends FixedArray;
@generateCppClass @generateCppClass
@generatePrint
extern class AliasedArgumentsEntry extends Struct { extern class AliasedArgumentsEntry extends Struct {
aliased_context_slot: Smi; aliased_context_slot: Smi;
} }
......
...@@ -20,9 +20,6 @@ class Cell : public TorqueGeneratedCell<Cell, HeapObject> { ...@@ -20,9 +20,6 @@ class Cell : public TorqueGeneratedCell<Cell, HeapObject> {
inline Address ValueAddress() { return address() + kValueOffset; } inline Address ValueAddress() { return address() + kValueOffset; }
// Dispatched behavior.
DECL_PRINTER(Cell)
using BodyDescriptor = FixedBodyDescriptor<kValueOffset, kSize, kSize>; using BodyDescriptor = FixedBodyDescriptor<kValueOffset, kSize, kSize>;
TQ_OBJECT_CONSTRUCTORS(Cell) TQ_OBJECT_CONSTRUCTORS(Cell)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
@generateCppClass @generateCppClass
@generatePrint
extern class Cell extends HeapObject { extern class Cell extends HeapObject {
value: Object; value: Object;
} }
// 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_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
extern class Context extends HeapObject { extern class Context extends HeapObject {
length: Smi; length: Smi;
scope_info: ScopeInfo; scope_info: ScopeInfo;
previous: Object; previous: Context|Zero|Undefined;
} }
extern class AwaitContext extends Context generates 'TNode<Context>'; extern class AwaitContext extends Context generates 'TNode<Context>';
extern class BlockContext extends Context generates 'TNode<Context>'; extern class BlockContext extends Context generates 'TNode<Context>';
......
...@@ -126,9 +126,6 @@ class DebugInfo : public TorqueGeneratedDebugInfo<DebugInfo, Struct> { ...@@ -126,9 +126,6 @@ class DebugInfo : public TorqueGeneratedDebugInfo<DebugInfo, Struct> {
// Clears all fields related to block coverage. // Clears all fields related to block coverage.
void ClearCoverageInfo(Isolate* isolate); void ClearCoverageInfo(Isolate* isolate);
// Dispatched behavior.
DECL_PRINTER(DebugInfo)
static const int kEstimatedNofBreakPointsInFunction = 4; static const int kEstimatedNofBreakPointsInFunction = 4;
private: private:
...@@ -206,7 +203,6 @@ class BreakPoint : public TorqueGeneratedBreakPoint<BreakPoint, Struct> { ...@@ -206,7 +203,6 @@ class BreakPoint : public TorqueGeneratedBreakPoint<BreakPoint, Struct> {
class WasmValue : public TorqueGeneratedWasmValue<WasmValue, Struct> { class WasmValue : public TorqueGeneratedWasmValue<WasmValue, Struct> {
public: public:
NEVER_READ_ONLY_SPACE NEVER_READ_ONLY_SPACE
DECL_PRINTER(WasmValue)
TQ_OBJECT_CONSTRUCTORS(WasmValue) TQ_OBJECT_CONSTRUCTORS(WasmValue)
}; };
......
...@@ -35,6 +35,7 @@ bitfield struct DebuggerHints extends uint31 { ...@@ -35,6 +35,7 @@ bitfield struct DebuggerHints extends uint31 {
} }
@generateCppClass @generateCppClass
@generatePrint
extern class DebugInfo extends Struct { extern class DebugInfo extends Struct {
shared: SharedFunctionInfo; shared: SharedFunctionInfo;
// Bit field containing various information collected for debugging. // Bit field containing various information collected for debugging.
...@@ -71,9 +72,10 @@ extern class CoverageInfo extends HeapObject { ...@@ -71,9 +72,10 @@ extern class CoverageInfo extends HeapObject {
} }
@generateCppClass @generateCppClass
@generatePrint
extern class WasmValue extends Struct { extern class WasmValue extends Struct {
// The type, should map to ValueType::Kind values in value-type.h. // 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 // 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 // be of length 4, for s128, it will have length 16. These values are
// represented by the respective C++ types, and memcpy-ed in. // represented by the respective C++ types, and memcpy-ed in.
......
...@@ -24,12 +24,9 @@ ...@@ -24,12 +24,9 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(DescriptorArray, HeapObject) TQ_OBJECT_CONSTRUCTORS_IMPL(DescriptorArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(EnumCache) TQ_OBJECT_CONSTRUCTORS_IMPL(EnumCache)
CAST_ACCESSOR(DescriptorArray)
ACCESSORS(DescriptorArray, enum_cache, EnumCache, kEnumCacheOffset)
RELAXED_INT16_ACCESSORS(DescriptorArray, number_of_all_descriptors, RELAXED_INT16_ACCESSORS(DescriptorArray, number_of_all_descriptors,
kNumberOfAllDescriptorsOffset) kNumberOfAllDescriptorsOffset)
RELAXED_INT16_ACCESSORS(DescriptorArray, number_of_descriptors, RELAXED_INT16_ACCESSORS(DescriptorArray, number_of_descriptors,
......
...@@ -50,13 +50,13 @@ class EnumCache : public TorqueGeneratedEnumCache<EnumCache, Struct> { ...@@ -50,13 +50,13 @@ class EnumCache : public TorqueGeneratedEnumCache<EnumCache, Struct> {
// The "value" fields store either values or field types. A field type is either // 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 // FieldType::None(), FieldType::Any() or a weak reference to a Map. All other
// references are strong. // references are strong.
class DescriptorArray : public HeapObject { class DescriptorArray
: public TorqueGeneratedDescriptorArray<DescriptorArray, HeapObject> {
public: public:
DECL_INT16_ACCESSORS(number_of_all_descriptors) DECL_INT16_ACCESSORS(number_of_all_descriptors)
DECL_INT16_ACCESSORS(number_of_descriptors) DECL_INT16_ACCESSORS(number_of_descriptors)
inline int16_t number_of_slack_descriptors() const; inline int16_t number_of_slack_descriptors() const;
inline int number_of_entries() const; inline int number_of_entries() const;
DECL_ACCESSORS(enum_cache, EnumCache)
void ClearEnumCache(); void ClearEnumCache();
inline void CopyEnumCacheFrom(DescriptorArray array); inline void CopyEnumCacheFrom(DescriptorArray array);
...@@ -135,14 +135,9 @@ class DescriptorArray : public HeapObject { ...@@ -135,14 +135,9 @@ class DescriptorArray : public HeapObject {
void Initialize(EnumCache enum_cache, HeapObject undefined_value, void Initialize(EnumCache enum_cache, HeapObject undefined_value,
int nof_descriptors, int slack); int nof_descriptors, int slack);
DECL_CAST(DescriptorArray)
// Constant for denoting key was not found. // Constant for denoting key was not found.
static const int kNotFound = -1; 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(kStartOfWeakFieldsOffset, kTaggedSize));
STATIC_ASSERT(IsAligned(kHeaderSize, kTaggedSize)); STATIC_ASSERT(IsAligned(kHeaderSize, kTaggedSize));
...@@ -234,7 +229,7 @@ class DescriptorArray : public HeapObject { ...@@ -234,7 +229,7 @@ class DescriptorArray : public HeapObject {
// Swap first and second descriptor. // Swap first and second descriptor.
inline void SwapSortedKeys(int first, int second); inline void SwapSortedKeys(int first, int second);
OBJECT_CONSTRUCTORS(DescriptorArray, HeapObject); TQ_OBJECT_CONSTRUCTORS(DescriptorArray)
}; };
class NumberOfMarkedDescriptors { class NumberOfMarkedDescriptors {
......
...@@ -16,6 +16,7 @@ struct DescriptorEntry { ...@@ -16,6 +16,7 @@ struct DescriptorEntry {
value: JSAny|Weak<Map>|AccessorInfo|AccessorPair|ClassPositions; value: JSAny|Weak<Map>|AccessorInfo|AccessorPair|ClassPositions;
} }
@generateCppClass
extern class DescriptorArray extends HeapObject { extern class DescriptorArray extends HeapObject {
const number_of_all_descriptors: uint16; const number_of_all_descriptors: uint16;
number_of_descriptors: uint16; number_of_descriptors: uint16;
......
...@@ -35,19 +35,16 @@ FixedArrayBase::FixedArrayBase(Address ptr, ...@@ -35,19 +35,16 @@ FixedArrayBase::FixedArrayBase(Address ptr,
: TorqueGeneratedFixedArrayBase(ptr, allow_smi) {} : TorqueGeneratedFixedArrayBase(ptr, allow_smi) {}
TQ_OBJECT_CONSTRUCTORS_IMPL(FixedArray) TQ_OBJECT_CONSTRUCTORS_IMPL(FixedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(FixedDoubleArray) TQ_OBJECT_CONSTRUCTORS_IMPL(FixedDoubleArray)
OBJECT_CONSTRUCTORS_IMPL(ArrayList, FixedArray) TQ_OBJECT_CONSTRUCTORS_IMPL(ArrayList)
TQ_OBJECT_CONSTRUCTORS_IMPL(ByteArray) TQ_OBJECT_CONSTRUCTORS_IMPL(ByteArray)
ByteArray::ByteArray(Address ptr, HeapObject::AllowInlineSmiStorage allow_smi) ByteArray::ByteArray(Address ptr, HeapObject::AllowInlineSmiStorage allow_smi)
: TorqueGeneratedByteArray(ptr, 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(WeakFixedArray)
TQ_OBJECT_CONSTRUCTORS_IMPL(WeakArrayList) TQ_OBJECT_CONSTRUCTORS_IMPL(WeakArrayList)
NEVER_READ_ONLY_SPACE_IMPL(WeakArrayList) NEVER_READ_ONLY_SPACE_IMPL(WeakArrayList)
CAST_ACCESSOR(ArrayList)
CAST_ACCESSOR(TemplateList)
SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
SYNCHRONIZED_SMI_ACCESSORS(WeakFixedArray, length, kLengthOffset) SYNCHRONIZED_SMI_ACCESSORS(WeakFixedArray, length, kLengthOffset)
......
...@@ -419,7 +419,7 @@ class WeakArrayList::Iterator { ...@@ -419,7 +419,7 @@ class WeakArrayList::Iterator {
// the allocated size. The number of elements is stored at kLengthIndex and is // 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 // updated with every insertion. The elements of the ArrayList are stored in the
// underlying FixedArray starting at kFirstIndex. // underlying FixedArray starting at kFirstIndex.
class ArrayList : public FixedArray { class ArrayList : public TorqueGeneratedArrayList<ArrayList, FixedArray> {
public: public:
V8_EXPORT_PRIVATE static Handle<ArrayList> Add(Isolate* isolate, V8_EXPORT_PRIVATE static Handle<ArrayList> Add(Isolate* isolate,
Handle<ArrayList> array, Handle<ArrayList> array,
...@@ -452,14 +452,13 @@ class ArrayList : public FixedArray { ...@@ -452,14 +452,13 @@ class ArrayList : public FixedArray {
// Return a copy of the list of size Length() without the first entry. The // Return a copy of the list of size Length() without the first entry. The
// number returned by Length() is stored in the first entry. // number returned by Length() is stored in the first entry.
static Handle<FixedArray> Elements(Isolate* isolate, Handle<ArrayList> array); static Handle<FixedArray> Elements(Isolate* isolate, Handle<ArrayList> array);
DECL_CAST(ArrayList)
private: private:
static Handle<ArrayList> EnsureSpace(Isolate* isolate, static Handle<ArrayList> EnsureSpace(Isolate* isolate,
Handle<ArrayList> array, int length); Handle<ArrayList> array, int length);
static const int kLengthIndex = 0; static const int kLengthIndex = 0;
static const int kFirstIndex = 1; static const int kFirstIndex = 1;
OBJECT_CONSTRUCTORS(ArrayList, FixedArray); TQ_OBJECT_CONSTRUCTORS(ArrayList)
}; };
enum SearchMode { ALL_ENTRIES, VALID_ENTRIES }; enum SearchMode { ALL_ENTRIES, VALID_ENTRIES };
...@@ -575,7 +574,8 @@ class PodArray : public ByteArray { ...@@ -575,7 +574,8 @@ class PodArray : public ByteArray {
OBJECT_CONSTRUCTORS(PodArray<T>, ByteArray); OBJECT_CONSTRUCTORS(PodArray<T>, ByteArray);
}; };
class TemplateList : public FixedArray { class TemplateList
: public TorqueGeneratedTemplateList<TemplateList, FixedArray> {
public: public:
static Handle<TemplateList> New(Isolate* isolate, int size); static Handle<TemplateList> New(Isolate* isolate, int size);
inline int length() const; inline int length() const;
...@@ -584,12 +584,11 @@ class TemplateList : public FixedArray { ...@@ -584,12 +584,11 @@ class TemplateList : public FixedArray {
inline void set(int index, Object value); inline void set(int index, Object value);
static Handle<TemplateList> Add(Isolate* isolate, Handle<TemplateList> list, static Handle<TemplateList> Add(Isolate* isolate, Handle<TemplateList> list,
Handle<Object> value); Handle<Object> value);
DECL_CAST(TemplateList)
private: private:
static const int kLengthIndex = 0; static const int kLengthIndex = 0;
static const int kFirstElementIndex = kLengthIndex + 1; static const int kFirstElementIndex = kLengthIndex + 1;
OBJECT_CONSTRUCTORS(TemplateList, FixedArray); TQ_OBJECT_CONSTRUCTORS(TemplateList)
}; };
} // namespace internal } // namespace internal
......
...@@ -35,11 +35,12 @@ extern class ByteArray extends FixedArrayBase { ...@@ -35,11 +35,12 @@ extern class ByteArray extends FixedArrayBase {
} }
@hasSameInstanceTypeAsParent @hasSameInstanceTypeAsParent
@generateCppClass
extern class ArrayList extends FixedArray { extern class ArrayList extends FixedArray {
} }
@hasSameInstanceTypeAsParent @hasSameInstanceTypeAsParent
@noVerifier @generateCppClass
extern class TemplateList extends FixedArray { extern class TemplateList extends FixedArray {
} }
......
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(Foreign, HeapObject) TQ_OBJECT_CONSTRUCTORS_IMPL(Foreign)
CAST_ACCESSOR(Foreign)
// static // static
bool Foreign::IsNormalized(Object value) { bool Foreign::IsNormalized(Object value) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define V8_OBJECTS_FOREIGN_H_ #define V8_OBJECTS_FOREIGN_H_
#include "src/objects/heap-object.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): // Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h" #include "src/objects/object-macros.h"
...@@ -15,21 +15,15 @@ namespace v8 { ...@@ -15,21 +15,15 @@ namespace v8 {
namespace internal { namespace internal {
// Foreign describes objects pointing from JavaScript to C structures. // Foreign describes objects pointing from JavaScript to C structures.
class Foreign : public HeapObject { class Foreign : public TorqueGeneratedForeign<Foreign, HeapObject> {
public: public:
// [address]: field containing the address. // [address]: field containing the address.
DECL_GETTER(foreign_address, Address) DECL_GETTER(foreign_address, Address)
static inline bool IsNormalized(Object object); static inline bool IsNormalized(Object object);
DECL_CAST(Foreign)
// Dispatched behavior. // Dispatched behavior.
DECL_PRINTER(Foreign) DECL_PRINTER(Foreign)
DECL_VERIFIER(Foreign)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_FOREIGN_FIELDS)
#ifdef V8_COMPRESS_POINTERS #ifdef V8_COMPRESS_POINTERS
// TODO(ishell, v8:8875): When pointer compression is enabled the // TODO(ishell, v8:8875): When pointer compression is enabled the
...@@ -50,7 +44,7 @@ class Foreign : public HeapObject { ...@@ -50,7 +44,7 @@ class Foreign : public HeapObject {
inline void set_foreign_address(Isolate* isolate, Address value); inline void set_foreign_address(Isolate* isolate, Address value);
OBJECT_CONSTRUCTORS(Foreign, HeapObject); TQ_OBJECT_CONSTRUCTORS(Foreign)
}; };
} // namespace internal } // namespace internal
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
@apiExposedInstanceTypeValue(0x46) @apiExposedInstanceTypeValue(0x46)
@generateCppClass
extern class Foreign extends HeapObject { extern class Foreign extends HeapObject {
foreign_address: ExternalPointer; foreign_address: ExternalPointer;
} }
...@@ -18,9 +18,8 @@ ...@@ -18,9 +18,8 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(FreeSpace, HeapObject) TQ_OBJECT_CONSTRUCTORS_IMPL(FreeSpace)
SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
RELAXED_SMI_ACCESSORS(FreeSpace, size, kSizeOffset) RELAXED_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
int FreeSpace::Size() { return size(); } int FreeSpace::Size() { return size(); }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define V8_OBJECTS_FREE_SPACE_H_ #define V8_OBJECTS_FREE_SPACE_H_
#include "src/objects/heap-object.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): // Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h" #include "src/objects/object-macros.h"
...@@ -19,12 +19,9 @@ namespace internal { ...@@ -19,12 +19,9 @@ namespace internal {
// the heap remains iterable. They have a size and a next pointer. // 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) // The next pointer is the raw address of the next FreeSpace object (or NULL)
// in the free list. // in the free list.
class FreeSpace : public HeapObject { class FreeSpace : public TorqueGeneratedFreeSpace<FreeSpace, HeapObject> {
public: public:
// [size]: size of the free space including the header. // [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 int relaxed_read_size() const;
inline void relaxed_write_size(int value); inline void relaxed_write_size(int value);
...@@ -39,15 +36,11 @@ class FreeSpace : public HeapObject { ...@@ -39,15 +36,11 @@ class FreeSpace : public HeapObject {
// Dispatched behavior. // Dispatched behavior.
DECL_PRINTER(FreeSpace) DECL_PRINTER(FreeSpace)
DECL_VERIFIER(FreeSpace)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_FREE_SPACE_FIELDS)
private: private:
inline bool IsValid(); inline bool IsValid();
OBJECT_CONSTRUCTORS(FreeSpace, HeapObject); TQ_OBJECT_CONSTRUCTORS(FreeSpace)
}; };
} // namespace internal } // namespace internal
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@generateCppClass
extern class FreeSpace extends HeapObject { extern class FreeSpace extends HeapObject {
size: Smi; size: Smi;
next: FreeSpace|Uninitialized; next: FreeSpace|Uninitialized;
......
...@@ -16,15 +16,7 @@ ...@@ -16,15 +16,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(HeapNumber, PrimitiveHeapObject) TQ_OBJECT_CONSTRUCTORS_IMPL(HeapNumber)
CAST_ACCESSOR(HeapNumber)
double HeapNumber::value() const { return ReadField<double>(kValueOffset); }
void HeapNumber::set_value(double value) {
WriteField<double>(kValueOffset, value);
}
uint64_t HeapNumber::value_as_bits() const { uint64_t HeapNumber::value_as_bits() const {
// Bug(v8:8875): HeapNumber's double may be unaligned. // Bug(v8:8875): HeapNumber's double may be unaligned.
......
...@@ -15,12 +15,9 @@ namespace internal { ...@@ -15,12 +15,9 @@ namespace internal {
// The HeapNumber class describes heap allocated numbers that cannot be // The HeapNumber class describes heap allocated numbers that cannot be
// represented in a Smi (small integer). // represented in a Smi (small integer).
class HeapNumber : public PrimitiveHeapObject { class HeapNumber
: public TorqueGeneratedHeapNumber<HeapNumber, PrimitiveHeapObject> {
public: public:
// [value]: number value.
inline double value() const;
inline void set_value(double value);
inline uint64_t value_as_bits() const; inline uint64_t value_as_bits() const;
inline void set_value_as_bits(uint64_t bits); inline void set_value_as_bits(uint64_t bits);
...@@ -28,7 +25,6 @@ class HeapNumber : public PrimitiveHeapObject { ...@@ -28,7 +25,6 @@ class HeapNumber : public PrimitiveHeapObject {
inline int get_sign(); inline int get_sign();
// Layout description. // Layout description.
static const int kValueOffset = PrimitiveHeapObject::kHeaderSize;
// IEEE doubles are two 32 bit words. The first is just mantissa, the second // 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 // 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 // words within double numbers are endian dependent and they are set
...@@ -43,7 +39,6 @@ class HeapNumber : public PrimitiveHeapObject { ...@@ -43,7 +39,6 @@ class HeapNumber : public PrimitiveHeapObject {
#error Unknown byte ordering #error Unknown byte ordering
#endif #endif
static const int kSize = kValueOffset + kDoubleSize;
static const uint32_t kSignMask = 0x80000000u; static const uint32_t kSignMask = 0x80000000u;
static const uint32_t kExponentMask = 0x7ff00000u; static const uint32_t kExponentMask = 0x7ff00000u;
static const uint32_t kMantissaMask = 0xfffffu; static const uint32_t kMantissaMask = 0xfffffu;
...@@ -56,12 +51,10 @@ class HeapNumber : public PrimitiveHeapObject { ...@@ -56,12 +51,10 @@ class HeapNumber : public PrimitiveHeapObject {
static const int kMantissaBitsInTopWord = 20; static const int kMantissaBitsInTopWord = 20;
static const int kNonMantissaBitsInTopWord = 12; static const int kNonMantissaBitsInTopWord = 12;
DECL_CAST(HeapNumber)
DECL_VERIFIER(HeapNumber)
DECL_PRINTER(HeapNumber) DECL_PRINTER(HeapNumber)
V8_EXPORT_PRIVATE void HeapNumberShortPrint(std::ostream& os); V8_EXPORT_PRIVATE void HeapNumberShortPrint(std::ostream& os);
OBJECT_CONSTRUCTORS(HeapNumber, PrimitiveHeapObject); TQ_OBJECT_CONSTRUCTORS(HeapNumber)
}; };
} // namespace internal } // namespace internal
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
extern class HeapNumber extends PrimitiveHeapObject { value: float64; } @generateCppClass
extern class HeapNumber extends PrimitiveHeapObject {
value: float64;
}
// The HeapNumber value NaN // The HeapNumber value NaN
type NaN extends HeapNumber; type NaN extends HeapNumber;
...@@ -23,6 +23,7 @@ bitfield struct JSDateTimeFormatFlags extends uint31 { ...@@ -23,6 +23,7 @@ bitfield struct JSDateTimeFormatFlags extends uint31 {
time_style: DateTimeStyle: 3 bit; time_style: DateTimeStyle: 3 bit;
} }
@generateCppClass
extern class JSDateTimeFormat extends JSObject { extern class JSDateTimeFormat extends JSObject {
locale: String; locale: String;
icu_locale: Foreign; // Managed<icu::Locale> icu_locale: Foreign; // Managed<icu::Locale>
...@@ -40,6 +41,7 @@ bitfield struct JSDisplayNamesFlags extends uint31 { ...@@ -40,6 +41,7 @@ bitfield struct JSDisplayNamesFlags extends uint31 {
fallback: JSDisplayNamesFallback: 1 bit; fallback: JSDisplayNamesFallback: 1 bit;
} }
@generateCppClass
extern class JSDisplayNames extends JSObject { extern class JSDisplayNames extends JSObject {
internal: Foreign; // Managed<DisplayNamesInternal> internal: Foreign; // Managed<DisplayNamesInternal>
flags: SmiTagged<JSDisplayNamesFlags>; flags: SmiTagged<JSDisplayNamesFlags>;
...@@ -52,12 +54,14 @@ bitfield struct JSListFormatFlags extends uint31 { ...@@ -52,12 +54,14 @@ bitfield struct JSListFormatFlags extends uint31 {
Type: JSListFormatType: 2 bit; // "type" is a reserved word. Type: JSListFormatType: 2 bit; // "type" is a reserved word.
} }
@generateCppClass
extern class JSListFormat extends JSObject { extern class JSListFormat extends JSObject {
locale: String; locale: String;
icu_formatter: Foreign; // Managed<icu::ListFormatter> icu_formatter: Foreign; // Managed<icu::ListFormatter>
flags: SmiTagged<JSListFormatFlags>; flags: SmiTagged<JSListFormatFlags>;
} }
@generateCppClass
extern class JSNumberFormat extends JSObject { extern class JSNumberFormat extends JSObject {
locale: String; locale: String;
icu_number_formatter: icu_number_formatter:
...@@ -70,6 +74,7 @@ bitfield struct JSPluralRulesFlags extends uint31 { ...@@ -70,6 +74,7 @@ bitfield struct JSPluralRulesFlags extends uint31 {
Type: JSPluralRulesType: 1 bit; // "type" is a reserved word. Type: JSPluralRulesType: 1 bit; // "type" is a reserved word.
} }
@generateCppClass
extern class JSPluralRules extends JSObject { extern class JSPluralRules extends JSObject {
locale: String; locale: String;
flags: SmiTagged<JSPluralRulesFlags>; flags: SmiTagged<JSPluralRulesFlags>;
...@@ -84,6 +89,7 @@ bitfield struct JSRelativeTimeFormatFlags extends uint31 { ...@@ -84,6 +89,7 @@ bitfield struct JSRelativeTimeFormatFlags extends uint31 {
numeric: JSRelativeTimeFormatNumeric: 1 bit; numeric: JSRelativeTimeFormatNumeric: 1 bit;
} }
@generateCppClass
extern class JSRelativeTimeFormat extends JSObject { extern class JSRelativeTimeFormat extends JSObject {
locale: String; locale: String;
numberingSystem: String; numberingSystem: String;
...@@ -91,6 +97,7 @@ extern class JSRelativeTimeFormat extends JSObject { ...@@ -91,6 +97,7 @@ extern class JSRelativeTimeFormat extends JSObject {
flags: SmiTagged<JSRelativeTimeFormatFlags>; flags: SmiTagged<JSRelativeTimeFormatFlags>;
} }
@generateCppClass
extern class JSLocale extends JSObject { extern class JSLocale extends JSObject {
icu_locale: Foreign; // Managed<icu::Locale> icu_locale: Foreign; // Managed<icu::Locale>
} }
...@@ -101,6 +108,7 @@ bitfield struct JSSegmenterFlags extends uint31 { ...@@ -101,6 +108,7 @@ bitfield struct JSSegmenterFlags extends uint31 {
granularity: JSSegmenterGranularity: 2 bit; granularity: JSSegmenterGranularity: 2 bit;
} }
@generateCppClass
extern class JSSegmenter extends JSObject { extern class JSSegmenter extends JSObject {
locale: String; locale: String;
icu_break_iterator: Foreign; // Managed<icu::BreakIterator> icu_break_iterator: Foreign; // Managed<icu::BreakIterator>
...@@ -112,12 +120,14 @@ bitfield struct JSSegmentIteratorFlags extends uint31 { ...@@ -112,12 +120,14 @@ bitfield struct JSSegmentIteratorFlags extends uint31 {
break_type_set: bool: 1 bit; break_type_set: bool: 1 bit;
} }
@generateCppClass
extern class JSSegmentIterator extends JSObject { extern class JSSegmentIterator extends JSObject {
icu_break_iterator: Foreign; // Managed<icu::BreakIterator> icu_break_iterator: Foreign; // Managed<icu::BreakIterator>
unicode_string: Foreign; // Managed<icu::UnicodeString> unicode_string: Foreign; // Managed<icu::UnicodeString>
flags: SmiTagged<JSSegmentIteratorFlags>; flags: SmiTagged<JSSegmentIteratorFlags>;
} }
@generateCppClass
extern class JSV8BreakIterator extends JSObject { extern class JSV8BreakIterator extends JSObject {
locale: String; locale: String;
break_iterator: Foreign; // Managed<icu::BreakIterator>; break_iterator: Foreign; // Managed<icu::BreakIterator>;
...@@ -129,6 +139,7 @@ extern class JSV8BreakIterator extends JSObject { ...@@ -129,6 +139,7 @@ extern class JSV8BreakIterator extends JSObject {
bound_break_type: Undefined|JSFunction; bound_break_type: Undefined|JSFunction;
} }
@generateCppClass
extern class JSCollator extends JSObject { extern class JSCollator extends JSObject {
icu_collator: Foreign; // Managed<icu::Collator> icu_collator: Foreign; // Managed<icu::Collator>
bound_compare: Undefined|JSFunction; bound_compare: Undefined|JSFunction;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
CAST_ACCESSOR(JSAggregateError)
TQ_OBJECT_CONSTRUCTORS_IMPL(JSAggregateError) TQ_OBJECT_CONSTRUCTORS_IMPL(JSAggregateError)
} // namespace internal } // namespace internal
......
...@@ -17,7 +17,6 @@ namespace internal { ...@@ -17,7 +17,6 @@ namespace internal {
class JSAggregateError class JSAggregateError
: public TorqueGeneratedJSAggregateError<JSAggregateError, JSObject> { : public TorqueGeneratedJSAggregateError<JSAggregateError, JSObject> {
public: public:
DECL_CAST(JSAggregateError)
DECL_PRINTER(JSAggregateError) DECL_PRINTER(JSAggregateError)
TQ_OBJECT_CONSTRUCTORS(JSAggregateError) TQ_OBJECT_CONSTRUCTORS(JSAggregateError)
}; };
......
...@@ -20,15 +20,10 @@ ...@@ -20,15 +20,10 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSArrayBuffer, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSArrayBuffer)
OBJECT_CONSTRUCTORS_IMPL(JSArrayBufferView, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSArrayBufferView)
OBJECT_CONSTRUCTORS_IMPL(JSTypedArray, JSArrayBufferView) TQ_OBJECT_CONSTRUCTORS_IMPL(JSTypedArray)
OBJECT_CONSTRUCTORS_IMPL(JSDataView, JSArrayBufferView) TQ_OBJECT_CONSTRUCTORS_IMPL(JSDataView)
CAST_ACCESSOR(JSArrayBuffer)
CAST_ACCESSOR(JSArrayBufferView)
CAST_ACCESSOR(JSTypedArray)
CAST_ACCESSOR(JSDataView)
size_t JSArrayBuffer::byte_length() const { size_t JSArrayBuffer::byte_length() const {
return ReadField<size_t>(kByteLengthOffset); return ReadField<size_t>(kByteLengthOffset);
...@@ -190,8 +185,6 @@ void JSArrayBufferView::set_byte_length(size_t value) { ...@@ -190,8 +185,6 @@ void JSArrayBufferView::set_byte_length(size_t value) {
WriteField<size_t>(kByteLengthOffset, value); WriteField<size_t>(kByteLengthOffset, value);
} }
ACCESSORS(JSArrayBufferView, buffer, Object, kBufferOffset)
bool JSArrayBufferView::WasDetached() const { bool JSArrayBufferView::WasDetached() const {
return JSArrayBuffer::cast(buffer()).was_detached(); return JSArrayBuffer::cast(buffer()).was_detached();
} }
...@@ -247,8 +240,6 @@ void JSTypedArray::RemoveExternalPointerCompensationForSerialization( ...@@ -247,8 +240,6 @@ void JSTypedArray::RemoveExternalPointerCompensationForSerialization(
external_pointer() - ExternalPointerCompensationForOnHeapArray(isolate)); external_pointer() - ExternalPointerCompensationForOnHeapArray(isolate));
} }
ACCESSORS(JSTypedArray, base_pointer, Object, kBasePointerOffset)
void* JSTypedArray::DataPtr() { void* JSTypedArray::DataPtr() {
// Zero-extend Tagged_t to Address according to current compression scheme // Zero-extend Tagged_t to Address according to current compression scheme
// so that the addition with |external_pointer| (which already contains // so that the addition with |external_pointer| (which already contains
......
...@@ -17,7 +17,8 @@ namespace internal { ...@@ -17,7 +17,8 @@ namespace internal {
class ArrayBufferExtension; class ArrayBufferExtension;
class JSArrayBuffer : public JSObject { class JSArrayBuffer
: public TorqueGeneratedJSArrayBuffer<JSArrayBuffer, JSObject> {
public: public:
// The maximum length for JSArrayBuffer's supported by V8. // The maximum length for JSArrayBuffer's supported by V8.
// On 32-bit architectures we limit this to 2GiB, so that // On 32-bit architectures we limit this to 2GiB, so that
...@@ -71,8 +72,6 @@ class JSArrayBuffer : public JSObject { ...@@ -71,8 +72,6 @@ class JSArrayBuffer : public JSObject {
// [is_shared]: tells whether this is an ArrayBuffer or a SharedArrayBuffer. // [is_shared]: tells whether this is an ArrayBuffer or a SharedArrayBuffer.
DECL_BOOLEAN_ACCESSORS(is_shared) DECL_BOOLEAN_ACCESSORS(is_shared)
DECL_CAST(JSArrayBuffer)
// Initializes the fields of the ArrayBuffer. The provided backing_store can // Initializes the fields of the ArrayBuffer. The provided backing_store can
// be nullptr. If it is not nullptr, then the function registers it with // be nullptr. If it is not nullptr, then the function registers it with
// src/heap/array-buffer-tracker.h. // src/heap/array-buffer-tracker.h.
...@@ -126,9 +125,6 @@ class JSArrayBuffer : public JSObject { ...@@ -126,9 +125,6 @@ class JSArrayBuffer : public JSObject {
DECL_PRINTER(JSArrayBuffer) DECL_PRINTER(JSArrayBuffer)
DECL_VERIFIER(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 constexpr int kEndOfTaggedFieldsOffset = JSObject::kHeaderSize;
static const int kSizeWithEmbedderFields = static const int kSizeWithEmbedderFields =
...@@ -137,8 +133,6 @@ class JSArrayBuffer : public JSObject { ...@@ -137,8 +133,6 @@ class JSArrayBuffer : public JSObject {
class BodyDescriptor; class BodyDescriptor;
OBJECT_CONSTRUCTORS(JSArrayBuffer, JSObject);
private: private:
inline ArrayBufferExtension** extension_location() const; inline ArrayBufferExtension** extension_location() const;
...@@ -148,6 +142,8 @@ class JSArrayBuffer : public JSObject { ...@@ -148,6 +142,8 @@ class JSArrayBuffer : public JSObject {
inline uint32_t* extension_lo() const; inline uint32_t* extension_lo() const;
inline uint32_t* extension_hi() const; inline uint32_t* extension_hi() const;
#endif #endif
TQ_OBJECT_CONSTRUCTORS(JSArrayBuffer)
}; };
// Each JSArrayBuffer (with a backing store) has a corresponding native-heap // Each JSArrayBuffer (with a backing store) has a corresponding native-heap
...@@ -221,44 +217,29 @@ class ArrayBufferExtension : public Malloced { ...@@ -221,44 +217,29 @@ class ArrayBufferExtension : public Malloced {
void set_next(ArrayBufferExtension* extension) { next_ = extension; } void set_next(ArrayBufferExtension* extension) { next_ = extension; }
}; };
class JSArrayBufferView : public JSObject { class JSArrayBufferView
: public TorqueGeneratedJSArrayBufferView<JSArrayBufferView, JSObject> {
public: public:
// [buffer]: ArrayBuffer that this typed array views.
DECL_ACCESSORS(buffer, Object)
// [byte_offset]: offset of typed array in bytes. // [byte_offset]: offset of typed array in bytes.
DECL_PRIMITIVE_ACCESSORS(byte_offset, size_t) DECL_PRIMITIVE_ACCESSORS(byte_offset, size_t)
// [byte_length]: length of typed array in bytes. // [byte_length]: length of typed array in bytes.
DECL_PRIMITIVE_ACCESSORS(byte_length, size_t) DECL_PRIMITIVE_ACCESSORS(byte_length, size_t)
DECL_CAST(JSArrayBufferView)
DECL_VERIFIER(JSArrayBufferView) DECL_VERIFIER(JSArrayBufferView)
inline bool WasDetached() const; inline bool WasDetached() const;
// Layout description. static constexpr int kEndOfTaggedFieldsOffset = kByteOffsetOffset;
#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_ASSERT(IsAligned(kByteOffsetOffset, kUIntptrSize)); STATIC_ASSERT(IsAligned(kByteOffsetOffset, kUIntptrSize));
STATIC_ASSERT(IsAligned(kByteLengthOffset, 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: public:
// TODO(v8:4153): This should be equal to JSArrayBuffer::kMaxByteLength // TODO(v8:4153): This should be equal to JSArrayBuffer::kMaxByteLength
// eventually. // eventually.
...@@ -272,8 +253,6 @@ class JSTypedArray : public JSArrayBufferView { ...@@ -272,8 +253,6 @@ class JSTypedArray : public JSArrayBufferView {
Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key, Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
PropertyDescriptor* desc, Maybe<ShouldThrow> should_throw); PropertyDescriptor* desc, Maybe<ShouldThrow> should_throw);
DECL_CAST(JSTypedArray)
ExternalArrayType type(); ExternalArrayType type();
V8_EXPORT_PRIVATE size_t element_size(); V8_EXPORT_PRIVATE size_t element_size();
...@@ -325,19 +304,6 @@ class JSTypedArray : public JSArrayBufferView { ...@@ -325,19 +304,6 @@ class JSTypedArray : public JSArrayBufferView {
DECL_PRINTER(JSTypedArray) DECL_PRINTER(JSTypedArray)
DECL_VERIFIER(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(kLengthOffset, kUIntptrSize));
STATIC_ASSERT(IsAligned(kExternalPointerOffset, kSystemPointerSize)); STATIC_ASSERT(IsAligned(kExternalPointerOffset, kSystemPointerSize));
...@@ -356,39 +322,24 @@ class JSTypedArray : public JSArrayBufferView { ...@@ -356,39 +322,24 @@ class JSTypedArray : public JSArrayBufferView {
private: private:
friend class Deserializer; friend class Deserializer;
// [base_pointer]: TODO(v8:4153)
DECL_ACCESSORS(base_pointer, Object)
// [external_pointer]: TODO(v8:4153) // [external_pointer]: TODO(v8:4153)
DECL_GETTER(external_pointer, Address) DECL_GETTER(external_pointer, Address)
inline void set_external_pointer(Isolate* isolate, Address value); 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: public:
// [data_pointer]: pointer to the actual data. // [data_pointer]: pointer to the actual data.
DECL_GETTER(data_pointer, void*) DECL_GETTER(data_pointer, void*)
inline void set_data_pointer(Isolate* isolate, void* value); inline void set_data_pointer(Isolate* isolate, void* value);
DECL_CAST(JSDataView)
// Dispatched behavior. // Dispatched behavior.
DECL_PRINTER(JSDataView) DECL_PRINTER(JSDataView)
DECL_VERIFIER(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_ASSERT(IsAligned(kDataPointerOffset, kUIntptrSize));
static const int kSizeWithEmbedderFields = static const int kSizeWithEmbedderFields =
...@@ -397,7 +348,7 @@ class JSDataView : public JSArrayBufferView { ...@@ -397,7 +348,7 @@ class JSDataView : public JSArrayBufferView {
class BodyDescriptor; class BodyDescriptor;
OBJECT_CONSTRUCTORS(JSDataView, JSArrayBufferView); TQ_OBJECT_CONSTRUCTORS(JSDataView)
}; };
} // namespace internal } // namespace internal
......
...@@ -10,6 +10,7 @@ bitfield struct JSArrayBufferFlags extends uint32 { ...@@ -10,6 +10,7 @@ bitfield struct JSArrayBufferFlags extends uint32 {
is_shared: bool: 1 bit; is_shared: bool: 1 bit;
} }
@generateCppClass
extern class JSArrayBuffer extends JSObject { extern class JSArrayBuffer extends JSObject {
byte_length: uintptr; byte_length: uintptr;
backing_store: ExternalPointer; backing_store: ExternalPointer;
...@@ -34,18 +35,22 @@ macro IsSharedArrayBuffer(buffer: JSArrayBuffer): bool { ...@@ -34,18 +35,22 @@ macro IsSharedArrayBuffer(buffer: JSArrayBuffer): bool {
} }
@abstract @abstract
@generateCppClass
extern class JSArrayBufferView extends JSObject { extern class JSArrayBufferView extends JSObject {
buffer: JSArrayBuffer; buffer: JSArrayBuffer;
byte_offset: uintptr; byte_offset: uintptr;
byte_length: uintptr; byte_length: uintptr;
} }
@generateCppClass
extern class JSTypedArray extends JSArrayBufferView { extern class JSTypedArray extends JSArrayBufferView {
length: uintptr; length: uintptr;
external_pointer: ExternalPointer; external_pointer: ExternalPointer;
// [base_pointer]: TODO(v8:4153)
base_pointer: ByteArray|Smi; base_pointer: ByteArray|Smi;
} }
@generateCppClass
extern class JSDataView extends JSArrayBufferView { extern class JSDataView extends JSArrayBufferView {
data_pointer: ExternalPointer; data_pointer: ExternalPointer;
} }
...@@ -18,20 +18,12 @@ ...@@ -18,20 +18,12 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSV8BreakIterator, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSV8BreakIterator)
ACCESSORS(JSV8BreakIterator, locale, String, kLocaleOffset)
ACCESSORS(JSV8BreakIterator, break_iterator, Managed<icu::BreakIterator>, ACCESSORS(JSV8BreakIterator, break_iterator, Managed<icu::BreakIterator>,
kBreakIteratorOffset) kBreakIteratorOffset)
ACCESSORS(JSV8BreakIterator, unicode_string, Managed<icu::UnicodeString>, ACCESSORS(JSV8BreakIterator, unicode_string, Managed<icu::UnicodeString>,
kUnicodeStringOffset) 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 internal
} // namespace v8 } // namespace v8
......
...@@ -27,7 +27,8 @@ class BreakIterator; ...@@ -27,7 +27,8 @@ class BreakIterator;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSV8BreakIterator : public JSObject { class JSV8BreakIterator
: public TorqueGeneratedJSV8BreakIterator<JSV8BreakIterator, JSObject> {
public: public:
V8_WARN_UNUSED_RESULT static MaybeHandle<JSV8BreakIterator> New( V8_WARN_UNUSED_RESULT static MaybeHandle<JSV8BreakIterator> New(
Isolate* isolate, Handle<Map> map, Handle<Object> input_locales, Isolate* isolate, Handle<Map> map, Handle<Object> input_locales,
...@@ -51,25 +52,12 @@ class JSV8BreakIterator : public JSObject { ...@@ -51,25 +52,12 @@ class JSV8BreakIterator : public JSObject {
static String BreakType(Isolate* isolate, static String BreakType(Isolate* isolate,
Handle<JSV8BreakIterator> break_iterator); Handle<JSV8BreakIterator> break_iterator);
DECL_CAST(JSV8BreakIterator)
DECL_PRINTER(JSV8BreakIterator) DECL_PRINTER(JSV8BreakIterator)
DECL_VERIFIER(JSV8BreakIterator)
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(break_iterator, Managed<icu::BreakIterator>) DECL_ACCESSORS(break_iterator, Managed<icu::BreakIterator>)
DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>) DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>)
DECL_ACCESSORS(bound_adopt_text, Object)
DECL_ACCESSORS(bound_first, Object) TQ_OBJECT_CONSTRUCTORS(JSV8BreakIterator)
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);
}; };
} // namespace internal } // namespace internal
......
...@@ -18,12 +18,9 @@ ...@@ -18,12 +18,9 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSCollator, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSCollator)
ACCESSORS(JSCollator, icu_collator, Managed<icu::Collator>, kIcuCollatorOffset) ACCESSORS(JSCollator, icu_collator, Managed<icu::Collator>, kIcuCollatorOffset)
ACCESSORS(JSCollator, bound_compare, Object, kBoundCompareOffset)
CAST_ACCESSOR(JSCollator)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -29,7 +29,7 @@ class Collator; ...@@ -29,7 +29,7 @@ class Collator;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSCollator : public JSObject { class JSCollator : public TorqueGeneratedJSCollator<JSCollator, JSObject> {
public: public:
// ecma402/#sec-initializecollator // ecma402/#sec-initializecollator
V8_WARN_UNUSED_RESULT static MaybeHandle<JSCollator> New( V8_WARN_UNUSED_RESULT static MaybeHandle<JSCollator> New(
...@@ -42,18 +42,11 @@ class JSCollator : public JSObject { ...@@ -42,18 +42,11 @@ class JSCollator : public JSObject {
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales(); V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
DECL_CAST(JSCollator)
DECL_PRINTER(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(icu_collator, Managed<icu::Collator>)
DECL_ACCESSORS(bound_compare, Object)
OBJECT_CONSTRUCTORS(JSCollator, JSObject); TQ_OBJECT_CONSTRUCTORS(JSCollator)
}; };
} // namespace internal } // namespace internal
......
...@@ -18,16 +18,13 @@ ...@@ -18,16 +18,13 @@
namespace v8 { namespace v8 {
namespace internal { 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_locale, Managed<icu::Locale>, kIcuLocaleOffset)
ACCESSORS(JSDateTimeFormat, icu_simple_date_format, ACCESSORS(JSDateTimeFormat, icu_simple_date_format,
Managed<icu::SimpleDateFormat>, kIcuSimpleDateFormatOffset) Managed<icu::SimpleDateFormat>, kIcuSimpleDateFormatOffset)
ACCESSORS(JSDateTimeFormat, icu_date_interval_format, ACCESSORS(JSDateTimeFormat, icu_date_interval_format,
Managed<icu::DateIntervalFormat>, kIcuDateIntervalFormatOffset) Managed<icu::DateIntervalFormat>, kIcuDateIntervalFormatOffset)
ACCESSORS(JSDateTimeFormat, bound_format, Object, kBoundFormatOffset)
SMI_ACCESSORS(JSDateTimeFormat, flags, kFlagsOffset)
inline void JSDateTimeFormat::set_hour_cycle(HourCycle hour_cycle) { inline void JSDateTimeFormat::set_hour_cycle(HourCycle hour_cycle) {
int hints = flags(); int hints = flags();
...@@ -61,8 +58,6 @@ inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::time_style() const { ...@@ -61,8 +58,6 @@ inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::time_style() const {
return TimeStyleBits::decode(flags()); return TimeStyleBits::decode(flags());
} }
CAST_ACCESSOR(JSDateTimeFormat)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -31,7 +31,8 @@ class SimpleDateFormat; ...@@ -31,7 +31,8 @@ class SimpleDateFormat;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSDateTimeFormat : public JSObject { class JSDateTimeFormat
: public TorqueGeneratedJSDateTimeFormat<JSDateTimeFormat, JSObject> {
public: public:
V8_WARN_UNUSED_RESULT static MaybeHandle<JSDateTimeFormat> New( V8_WARN_UNUSED_RESULT static MaybeHandle<JSDateTimeFormat> New(
Isolate* isolate, Handle<Map> map, Handle<Object> locales, Isolate* isolate, Handle<Map> map, Handle<Object> locales,
...@@ -84,15 +85,10 @@ class JSDateTimeFormat : public JSObject { ...@@ -84,15 +85,10 @@ class JSDateTimeFormat : public JSObject {
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales(); V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
Handle<String> HourCycleAsString() const; Handle<String> HourCycleAsString() const;
DECL_CAST(JSDateTimeFormat)
// ecma-402/#sec-properties-of-intl-datetimeformat-instances // ecma-402/#sec-properties-of-intl-datetimeformat-instances
enum class DateTimeStyle { kUndefined, kFull, kLong, kMedium, kShort }; 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 for "hourCycle" option.
enum class HourCycle { kUndefined, kH11, kH12, kH23, kH24 }; enum class HourCycle { kUndefined, kH11, kH12, kH23, kH24 };
...@@ -126,17 +122,13 @@ class JSDateTimeFormat : public JSObject { ...@@ -126,17 +122,13 @@ class JSDateTimeFormat : public JSObject {
STATIC_ASSERT(DateTimeStyle::kMedium <= TimeStyleBits::kMax); STATIC_ASSERT(DateTimeStyle::kMedium <= TimeStyleBits::kMax);
STATIC_ASSERT(DateTimeStyle::kShort <= TimeStyleBits::kMax); STATIC_ASSERT(DateTimeStyle::kShort <= TimeStyleBits::kMax);
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_locale, Managed<icu::Locale>) DECL_ACCESSORS(icu_locale, Managed<icu::Locale>)
DECL_ACCESSORS(icu_simple_date_format, Managed<icu::SimpleDateFormat>) DECL_ACCESSORS(icu_simple_date_format, Managed<icu::SimpleDateFormat>)
DECL_ACCESSORS(icu_date_interval_format, Managed<icu::DateIntervalFormat>) DECL_ACCESSORS(icu_date_interval_format, Managed<icu::DateIntervalFormat>)
DECL_ACCESSORS(bound_format, Object)
DECL_INT_ACCESSORS(flags)
DECL_PRINTER(JSDateTimeFormat) DECL_PRINTER(JSDateTimeFormat)
DECL_VERIFIER(JSDateTimeFormat)
OBJECT_CONSTRUCTORS(JSDateTimeFormat, JSObject); TQ_OBJECT_CONSTRUCTORS(JSDateTimeFormat)
}; };
} // namespace internal } // namespace internal
......
...@@ -20,12 +20,7 @@ namespace internal { ...@@ -20,12 +20,7 @@ namespace internal {
ACCESSORS(JSDisplayNames, internal, Managed<DisplayNamesInternal>, ACCESSORS(JSDisplayNames, internal, Managed<DisplayNamesInternal>,
kInternalOffset) kInternalOffset)
OBJECT_CONSTRUCTORS_IMPL(JSDisplayNames, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSDisplayNames)
// Base display names accessors.
SMI_ACCESSORS(JSDisplayNames, flags, kFlagsOffset)
CAST_ACCESSOR(JSDisplayNames)
inline void JSDisplayNames::set_style(Style style) { inline void JSDisplayNames::set_style(Style style) {
DCHECK_GE(StyleBits::kMax, style); DCHECK_GE(StyleBits::kMax, style);
......
...@@ -25,7 +25,8 @@ namespace internal { ...@@ -25,7 +25,8 @@ namespace internal {
class DisplayNamesInternal; class DisplayNamesInternal;
class JSDisplayNames : public JSObject { class JSDisplayNames
: public TorqueGeneratedJSDisplayNames<JSDisplayNames, JSObject> {
public: public:
// Creates display names object with properties derived from input // Creates display names object with properties derived from input
// locales and options. // locales and options.
...@@ -65,8 +66,6 @@ class JSDisplayNames : public JSObject { ...@@ -65,8 +66,6 @@ class JSDisplayNames : public JSObject {
inline void set_fallback(Fallback fallback); inline void set_fallback(Fallback fallback);
inline Fallback fallback() const; inline Fallback fallback() const;
DECL_CAST(JSDisplayNames)
// Bit positions in |flags|. // Bit positions in |flags|.
DEFINE_TORQUE_GENERATED_JS_DISPLAY_NAMES_FLAGS() DEFINE_TORQUE_GENERATED_JS_DISPLAY_NAMES_FLAGS()
...@@ -76,19 +75,11 @@ class JSDisplayNames : public JSObject { ...@@ -76,19 +75,11 @@ class JSDisplayNames : public JSObject {
STATIC_ASSERT(Fallback::kCode <= FallbackBit::kMax); STATIC_ASSERT(Fallback::kCode <= FallbackBit::kMax);
STATIC_ASSERT(Fallback::kNone <= 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_ACCESSORS(internal, Managed<DisplayNamesInternal>)
DECL_PRINTER(JSDisplayNames) 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 } // namespace internal
......
...@@ -18,13 +18,11 @@ ...@@ -18,13 +18,11 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSListFormat, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSListFormat)
// Base list format accessors. // Base list format accessors.
ACCESSORS(JSListFormat, locale, String, kLocaleOffset)
ACCESSORS(JSListFormat, icu_formatter, Managed<icu::ListFormatter>, ACCESSORS(JSListFormat, icu_formatter, Managed<icu::ListFormatter>,
kIcuFormatterOffset) kIcuFormatterOffset)
SMI_ACCESSORS(JSListFormat, flags, kFlagsOffset)
inline void JSListFormat::set_style(Style style) { inline void JSListFormat::set_style(Style style) {
DCHECK_GE(StyleBits::kMax, style); DCHECK_GE(StyleBits::kMax, style);
...@@ -48,8 +46,6 @@ inline JSListFormat::Type JSListFormat::type() const { ...@@ -48,8 +46,6 @@ inline JSListFormat::Type JSListFormat::type() const {
return TypeBits::decode(flags()); return TypeBits::decode(flags());
} }
CAST_ACCESSOR(JSListFormat)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -29,7 +29,8 @@ class ListFormatter; ...@@ -29,7 +29,8 @@ class ListFormatter;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSListFormat : public JSObject { class JSListFormat
: public TorqueGeneratedJSListFormat<JSListFormat, JSObject> {
public: public:
// Creates relative time format object with properties derived from input // Creates relative time format object with properties derived from input
// locales and options. // locales and options.
...@@ -55,10 +56,7 @@ class JSListFormat : public JSObject { ...@@ -55,10 +56,7 @@ class JSListFormat : public JSObject {
Handle<String> StyleAsString() const; Handle<String> StyleAsString() const;
Handle<String> TypeAsString() const; Handle<String> TypeAsString() const;
DECL_CAST(JSListFormat)
// ListFormat accessors. // ListFormat accessors.
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_formatter, Managed<icu::ListFormatter>) DECL_ACCESSORS(icu_formatter, Managed<icu::ListFormatter>)
// Style: identifying the relative time format style used. // Style: identifying the relative time format style used.
...@@ -93,17 +91,9 @@ class JSListFormat : public JSObject { ...@@ -93,17 +91,9 @@ class JSListFormat : public JSObject {
STATIC_ASSERT(Type::DISJUNCTION <= TypeBits::kMax); STATIC_ASSERT(Type::DISJUNCTION <= TypeBits::kMax);
STATIC_ASSERT(Type::UNIT <= 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_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 } // namespace internal
......
...@@ -19,12 +19,10 @@ ...@@ -19,12 +19,10 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSLocale, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSLocale)
ACCESSORS(JSLocale, icu_locale, Managed<icu::Locale>, kIcuLocaleOffset) ACCESSORS(JSLocale, icu_locale, Managed<icu::Locale>, kIcuLocaleOffset)
CAST_ACCESSOR(JSLocale)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -25,7 +25,7 @@ class Locale; ...@@ -25,7 +25,7 @@ class Locale;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSLocale : public JSObject { class JSLocale : public TorqueGeneratedJSLocale<JSLocale, JSObject> {
public: public:
// Creates locale object with properties derived from input locale string // Creates locale object with properties derived from input locale string
// and options. // and options.
...@@ -62,18 +62,11 @@ class JSLocale : public JSObject { ...@@ -62,18 +62,11 @@ class JSLocale : public JSObject {
// Help function to check well-formed "3alpha" // Help function to check well-formed "3alpha"
static bool Is3Alpha(const std::string& value); static bool Is3Alpha(const std::string& value);
DECL_CAST(JSLocale)
DECL_ACCESSORS(icu_locale, Managed<icu::Locale>) DECL_ACCESSORS(icu_locale, Managed<icu::Locale>)
DECL_PRINTER(JSLocale) 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 } // namespace internal
......
...@@ -18,15 +18,11 @@ ...@@ -18,15 +18,11 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSNumberFormat, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSNumberFormat)
ACCESSORS(JSNumberFormat, locale, String, kLocaleOffset)
ACCESSORS(JSNumberFormat, icu_number_formatter, ACCESSORS(JSNumberFormat, icu_number_formatter,
Managed<icu::number::LocalizedNumberFormatter>, Managed<icu::number::LocalizedNumberFormatter>,
kIcuNumberFormatterOffset) kIcuNumberFormatterOffset)
ACCESSORS(JSNumberFormat, bound_format, Object, kBoundFormatOffset)
CAST_ACCESSOR(JSNumberFormat)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -32,7 +32,8 @@ class LocalizedNumberFormatter; ...@@ -32,7 +32,8 @@ class LocalizedNumberFormatter;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSNumberFormat : public JSObject { class JSNumberFormat
: public TorqueGeneratedJSNumberFormat<JSNumberFormat, JSObject> {
public: public:
// ecma402/#sec-initializenumberformat // ecma402/#sec-initializenumberformat
V8_WARN_UNUSED_RESULT static MaybeHandle<JSNumberFormat> New( V8_WARN_UNUSED_RESULT static MaybeHandle<JSNumberFormat> New(
...@@ -69,21 +70,12 @@ class JSNumberFormat : public JSObject { ...@@ -69,21 +70,12 @@ class JSNumberFormat : public JSObject {
const icu::number::LocalizedNumberFormatter& icu_number_formatter, const icu::number::LocalizedNumberFormatter& icu_number_formatter,
const Intl::NumberFormatDigitOptions& digit_options); const Intl::NumberFormatDigitOptions& digit_options);
DECL_CAST(JSNumberFormat)
DECL_PRINTER(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, DECL_ACCESSORS(icu_number_formatter,
Managed<icu::number::LocalizedNumberFormatter>) Managed<icu::number::LocalizedNumberFormatter>)
DECL_ACCESSORS(bound_format, Object)
DECL_INT_ACCESSORS(flags)
OBJECT_CONSTRUCTORS(JSNumberFormat, JSObject); TQ_OBJECT_CONSTRUCTORS(JSNumberFormat)
}; };
struct NumberFormatSpan { struct NumberFormatSpan {
......
...@@ -19,10 +19,8 @@ ...@@ -19,10 +19,8 @@
namespace v8 { namespace v8 {
namespace internal { 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>, ACCESSORS(JSPluralRules, icu_plural_rules, Managed<icu::PluralRules>,
kIcuPluralRulesOffset) kIcuPluralRulesOffset)
ACCESSORS(JSPluralRules, icu_number_formatter, ACCESSORS(JSPluralRules, icu_number_formatter,
...@@ -40,8 +38,6 @@ inline JSPluralRules::Type JSPluralRules::type() const { ...@@ -40,8 +38,6 @@ inline JSPluralRules::Type JSPluralRules::type() const {
return TypeBit::decode(flags()); return TypeBit::decode(flags());
} }
CAST_ACCESSOR(JSPluralRules)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -32,7 +32,8 @@ class LocalizedNumberFormatter; ...@@ -32,7 +32,8 @@ class LocalizedNumberFormatter;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSPluralRules : public JSObject { class JSPluralRules
: public TorqueGeneratedJSPluralRules<JSPluralRules, JSObject> {
public: public:
V8_WARN_UNUSED_RESULT static MaybeHandle<JSPluralRules> New( V8_WARN_UNUSED_RESULT static MaybeHandle<JSPluralRules> New(
Isolate* isolate, Handle<Map> map, Handle<Object> locales, Isolate* isolate, Handle<Map> map, Handle<Object> locales,
...@@ -54,9 +55,7 @@ class JSPluralRules : public JSObject { ...@@ -54,9 +55,7 @@ class JSPluralRules : public JSObject {
Handle<String> TypeAsString() const; Handle<String> TypeAsString() const;
DECL_CAST(JSPluralRules)
DECL_PRINTER(JSPluralRules) DECL_PRINTER(JSPluralRules)
DECL_VERIFIER(JSPluralRules)
// Bit positions in |flags|. // Bit positions in |flags|.
DEFINE_TORQUE_GENERATED_JS_PLURAL_RULES_FLAGS() DEFINE_TORQUE_GENERATED_JS_PLURAL_RULES_FLAGS()
...@@ -64,17 +63,11 @@ class JSPluralRules : public JSObject { ...@@ -64,17 +63,11 @@ class JSPluralRules : public JSObject {
STATIC_ASSERT(Type::CARDINAL <= TypeBit::kMax); STATIC_ASSERT(Type::CARDINAL <= TypeBit::kMax);
STATIC_ASSERT(Type::ORDINAL <= 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_plural_rules, Managed<icu::PluralRules>)
DECL_ACCESSORS(icu_number_formatter, DECL_ACCESSORS(icu_number_formatter,
Managed<icu::number::LocalizedNumberFormatter>) Managed<icu::number::LocalizedNumberFormatter>)
OBJECT_CONSTRUCTORS(JSPluralRules, JSObject); TQ_OBJECT_CONSTRUCTORS(JSPluralRules)
}; };
} // namespace internal } // namespace internal
......
...@@ -18,14 +18,11 @@ ...@@ -18,14 +18,11 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSRelativeTimeFormat, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSRelativeTimeFormat)
// Base relative time format accessors. // Base relative time format accessors.
ACCESSORS(JSRelativeTimeFormat, locale, String, kLocaleOffset)
ACCESSORS(JSRelativeTimeFormat, numberingSystem, String, kNumberingSystemOffset)
ACCESSORS(JSRelativeTimeFormat, icu_formatter, ACCESSORS(JSRelativeTimeFormat, icu_formatter,
Managed<icu::RelativeDateTimeFormatter>, kIcuFormatterOffset) Managed<icu::RelativeDateTimeFormatter>, kIcuFormatterOffset)
SMI_ACCESSORS(JSRelativeTimeFormat, flags, kFlagsOffset)
inline void JSRelativeTimeFormat::set_numeric(Numeric numeric) { inline void JSRelativeTimeFormat::set_numeric(Numeric numeric) {
DCHECK_GE(NumericBit::kMax, numeric); DCHECK_GE(NumericBit::kMax, numeric);
...@@ -38,8 +35,6 @@ inline JSRelativeTimeFormat::Numeric JSRelativeTimeFormat::numeric() const { ...@@ -38,8 +35,6 @@ inline JSRelativeTimeFormat::Numeric JSRelativeTimeFormat::numeric() const {
return NumericBit::decode(flags()); return NumericBit::decode(flags());
} }
CAST_ACCESSOR(JSRelativeTimeFormat)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -29,7 +29,9 @@ class RelativeDateTimeFormatter; ...@@ -29,7 +29,9 @@ class RelativeDateTimeFormatter;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSRelativeTimeFormat : public JSObject { class JSRelativeTimeFormat
: public TorqueGeneratedJSRelativeTimeFormat<JSRelativeTimeFormat,
JSObject> {
public: public:
// Creates relative time format object with properties derived from input // Creates relative time format object with properties derived from input
// locales and options. // locales and options.
...@@ -54,12 +56,7 @@ class JSRelativeTimeFormat : public JSObject { ...@@ -54,12 +56,7 @@ class JSRelativeTimeFormat : public JSObject {
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales(); V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
DECL_CAST(JSRelativeTimeFormat)
// RelativeTimeFormat accessors. // RelativeTimeFormat accessors.
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(numberingSystem, String)
DECL_ACCESSORS(icu_formatter, Managed<icu::RelativeDateTimeFormatter>) DECL_ACCESSORS(icu_formatter, Managed<icu::RelativeDateTimeFormatter>)
// Numeric: identifying whether numerical descriptions are always used, or // Numeric: identifying whether numerical descriptions are always used, or
...@@ -81,18 +78,9 @@ class JSRelativeTimeFormat : public JSObject { ...@@ -81,18 +78,9 @@ class JSRelativeTimeFormat : public JSObject {
STATIC_ASSERT(Numeric::AUTO <= NumericBit::kMax); STATIC_ASSERT(Numeric::AUTO <= NumericBit::kMax);
STATIC_ASSERT(Numeric::ALWAYS <= 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_PRINTER(JSRelativeTimeFormat)
DECL_VERIFIER(JSRelativeTimeFormat)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_RELATIVE_TIME_FORMAT_FIELDS)
private: TQ_OBJECT_CONSTRUCTORS(JSRelativeTimeFormat)
OBJECT_CONSTRUCTORS(JSRelativeTimeFormat, JSObject);
}; };
} // namespace internal } // namespace internal
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator)
// Base segment iterator accessors. // Base segment iterator accessors.
ACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>, ACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>,
...@@ -29,10 +29,6 @@ ACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>, ...@@ -29,10 +29,6 @@ ACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>,
BIT_FIELD_ACCESSORS(JSSegmentIterator, flags, is_break_type_set, BIT_FIELD_ACCESSORS(JSSegmentIterator, flags, is_break_type_set,
JSSegmentIterator::BreakTypeSetBit) JSSegmentIterator::BreakTypeSetBit)
SMI_ACCESSORS(JSSegmentIterator, flags, kFlagsOffset)
CAST_ACCESSOR(JSSegmentIterator)
inline void JSSegmentIterator::set_granularity( inline void JSSegmentIterator::set_granularity(
JSSegmenter::Granularity granularity) { JSSegmenter::Granularity granularity) {
DCHECK_GE(GranularityBits::kMax, granularity); DCHECK_GE(GranularityBits::kMax, granularity);
......
...@@ -28,7 +28,8 @@ class UnicodeString; ...@@ -28,7 +28,8 @@ class UnicodeString;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSSegmentIterator : public JSObject { class JSSegmentIterator
: public TorqueGeneratedJSSegmentIterator<JSSegmentIterator, JSObject> {
public: public:
// ecma402 #sec-CreateSegmentIterator // ecma402 #sec-CreateSegmentIterator
V8_WARN_UNUSED_RESULT static MaybeHandle<JSSegmentIterator> Create( V8_WARN_UNUSED_RESULT static MaybeHandle<JSSegmentIterator> Create(
...@@ -64,14 +65,11 @@ class JSSegmentIterator : public JSObject { ...@@ -64,14 +65,11 @@ class JSSegmentIterator : public JSObject {
int32_t start, int32_t start,
int32_t end) const; int32_t end) const;
DECL_CAST(JSSegmentIterator)
// SegmentIterator accessors. // SegmentIterator accessors.
DECL_ACCESSORS(icu_break_iterator, Managed<icu::BreakIterator>) DECL_ACCESSORS(icu_break_iterator, Managed<icu::BreakIterator>)
DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>) DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>)
DECL_PRINTER(JSSegmentIterator) DECL_PRINTER(JSSegmentIterator)
DECL_VERIFIER(JSSegmentIterator)
inline void set_granularity(JSSegmenter::Granularity granularity); inline void set_granularity(JSSegmenter::Granularity granularity);
inline JSSegmenter::Granularity granularity() const; inline JSSegmenter::Granularity granularity() const;
...@@ -83,14 +81,7 @@ class JSSegmentIterator : public JSObject { ...@@ -83,14 +81,7 @@ class JSSegmentIterator : public JSObject {
STATIC_ASSERT(JSSegmenter::Granularity::WORD <= GranularityBits::kMax); STATIC_ASSERT(JSSegmenter::Granularity::WORD <= GranularityBits::kMax);
STATIC_ASSERT(JSSegmenter::Granularity::SENTENCE <= GranularityBits::kMax); STATIC_ASSERT(JSSegmenter::Granularity::SENTENCE <= GranularityBits::kMax);
// [flags] Bit field containing various flags about the function. TQ_OBJECT_CONSTRUCTORS(JSSegmentIterator)
DECL_INT_ACCESSORS(flags)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_SEGMENT_ITERATOR_FIELDS)
OBJECT_CONSTRUCTORS(JSSegmentIterator, JSObject);
}; };
} // namespace internal } // namespace internal
......
...@@ -18,13 +18,11 @@ ...@@ -18,13 +18,11 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(JSSegmenter, JSObject) TQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmenter)
// Base segmenter accessors. // Base segmenter accessors.
ACCESSORS(JSSegmenter, locale, String, kLocaleOffset)
ACCESSORS(JSSegmenter, icu_break_iterator, Managed<icu::BreakIterator>, ACCESSORS(JSSegmenter, icu_break_iterator, Managed<icu::BreakIterator>,
kIcuBreakIteratorOffset) kIcuBreakIteratorOffset)
SMI_ACCESSORS(JSSegmenter, flags, kFlagsOffset)
inline void JSSegmenter::set_granularity(Granularity granularity) { inline void JSSegmenter::set_granularity(Granularity granularity) {
DCHECK_GE(GranularityBits::kMax, granularity); DCHECK_GE(GranularityBits::kMax, granularity);
...@@ -37,8 +35,6 @@ inline JSSegmenter::Granularity JSSegmenter::granularity() const { ...@@ -37,8 +35,6 @@ inline JSSegmenter::Granularity JSSegmenter::granularity() const {
return GranularityBits::decode(flags()); return GranularityBits::decode(flags());
} }
CAST_ACCESSOR(JSSegmenter)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -29,7 +29,7 @@ class BreakIterator; ...@@ -29,7 +29,7 @@ class BreakIterator;
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class JSSegmenter : public JSObject { class JSSegmenter : public TorqueGeneratedJSSegmenter<JSSegmenter, JSObject> {
public: public:
// Creates segmenter object with properties derived from input locales and // Creates segmenter object with properties derived from input locales and
// options. // options.
...@@ -44,11 +44,7 @@ class JSSegmenter : public JSObject { ...@@ -44,11 +44,7 @@ class JSSegmenter : public JSObject {
Handle<String> GranularityAsString() const; Handle<String> GranularityAsString() const;
DECL_CAST(JSSegmenter)
// Segmenter accessors. // Segmenter accessors.
DECL_ACCESSORS(locale, String)
DECL_ACCESSORS(icu_break_iterator, Managed<icu::BreakIterator>) DECL_ACCESSORS(icu_break_iterator, Managed<icu::BreakIterator>)
// Granularity: identifying the segmenter used. // Granularity: identifying the segmenter used.
...@@ -69,18 +65,9 @@ class JSSegmenter : public JSObject { ...@@ -69,18 +65,9 @@ class JSSegmenter : public JSObject {
STATIC_ASSERT(Granularity::WORD <= GranularityBits::kMax); STATIC_ASSERT(Granularity::WORD <= GranularityBits::kMax);
STATIC_ASSERT(Granularity::SENTENCE <= 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_PRINTER(JSSegmenter)
DECL_VERIFIER(JSSegmenter)
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JS_SEGMENTER_FIELDS)
private: TQ_OBJECT_CONSTRUCTORS(JSSegmenter)
OBJECT_CONSTRUCTORS(JSSegmenter, JSObject);
}; };
} // namespace internal } // namespace internal
......
...@@ -3636,6 +3636,11 @@ void CppClassGenerator::GenerateFieldAccessor(const Field& f) { ...@@ -3636,6 +3636,11 @@ void CppClassGenerator::GenerateFieldAccessor(const Field& f) {
// TODO(danno): Support generation of struct accessors // TODO(danno): Support generation of struct accessors
if (f.name_and_type.type->IsStructType()) return; 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())) { if (!f.name_and_type.type->IsSubtypeOf(TypeOracle::GetTaggedType())) {
return GenerateFieldAccessorForUntagged(f); return GenerateFieldAccessorForUntagged(f);
} }
...@@ -3997,24 +4002,8 @@ void ImplementationVisitor::GenerateClassDefinitions( ...@@ -3997,24 +4002,8 @@ void ImplementationVisitor::GenerateClassDefinitions(
implementation implementation
<< "#include \"torque-generated/class-definitions-tq.h\"\n\n"; << "#include \"torque-generated/class-definitions-tq.h\"\n\n";
implementation << "#include \"torque-generated/class-verifiers-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 implementation
<< "#include \"src/objects/property-descriptor-object-inl.h\"\n"; << "#include \"src/objects/class-definitions-tq-deps-inl.h\"\n\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";
implementation implementation
<< "#include " << "#include "
"\"torque-generated/internal-class-definitions-tq-inl.h\"\n\n"; "\"torque-generated/internal-class-definitions-tq-inl.h\"\n\n";
......
...@@ -179,6 +179,9 @@ TEST(ReduceJSLoadContext0) { ...@@ -179,6 +179,9 @@ TEST(ReduceJSLoadContext0) {
CHECK(match.HasValue()); CHECK(match.HasValue());
CHECK_EQ(*expected, *match.Value()); CHECK_EQ(*expected, *match.Value());
} }
// Clean up so that verifiers don't complain.
native->set(slot, Smi::zero());
} }
TEST(ReduceJSLoadContext1) { TEST(ReduceJSLoadContext1) {
...@@ -477,6 +480,9 @@ TEST(ReduceJSStoreContext0) { ...@@ -477,6 +480,9 @@ TEST(ReduceJSStoreContext0) {
CHECK_EQ(0, static_cast<int>(access.depth())); CHECK_EQ(0, static_cast<int>(access.depth()));
CHECK_EQ(false, access.immutable()); CHECK_EQ(false, access.immutable());
} }
// Clean up so that verifiers don't complain.
native->set(slot, Smi::zero());
} }
TEST(ReduceJSStoreContext1) { TEST(ReduceJSStoreContext1) {
......
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