Commit 73be7554 authored by Suraj Sharma's avatar Suraj Sharma Committed by Commit Bot

[torque] Derive TemplateObjectDescription directly from Struct.

Bug: v8:8952
Change-Id: I36ee0d6793a4a9715360c155636f6e19db2119bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1616015
Commit-Queue: Suraj Sharma <surshar@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61673}
parent 0dc9b63e
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include 'src/objects/stack-frame-info.h' #include 'src/objects/stack-frame-info.h'
#include 'src/objects/template-objects.h' #include 'src/objects/template-objects.h'
#include 'src/builtins/builtins-regexp-gen.h' #include 'src/builtins/builtins-regexp-gen.h'
#include 'src/objects/template-objects.h'
type void; type void;
type never; type never;
...@@ -729,6 +730,12 @@ extern class TemplateInfo extends Struct { ...@@ -729,6 +730,12 @@ extern class TemplateInfo extends Struct {
property_accessors: Object; property_accessors: Object;
} }
@generatePrint
extern class TemplateObjectDescription extends Struct {
raw_strings: FixedArray;
cooked_strings: FixedArray;
}
extern class FunctionTemplateRareData extends Struct { extern class FunctionTemplateRareData extends Struct {
prototype_template: Object; prototype_template: Object;
prototype_provider_template: Object; prototype_provider_template: Object;
......
...@@ -348,6 +348,7 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) { ...@@ -348,6 +348,7 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) {
case SMALL_ORDERED_NAME_DICTIONARY_TYPE: case SMALL_ORDERED_NAME_DICTIONARY_TYPE:
case PROTOTYPE_INFO_TYPE: case PROTOTYPE_INFO_TYPE:
case INTERPRETER_DATA_TYPE: case INTERPRETER_DATA_TYPE:
case TEMPLATE_OBJECT_DESCRIPTION_TYPE:
case TUPLE2_TYPE: case TUPLE2_TYPE:
case TUPLE3_TYPE: case TUPLE3_TYPE:
case ENUM_CACHE_TYPE: case ENUM_CACHE_TYPE:
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "src/objects/promise-inl.h" #include "src/objects/promise-inl.h"
#include "src/objects/stack-frame-info-inl.h" #include "src/objects/stack-frame-info-inl.h"
#include "src/objects/struct-inl.h" #include "src/objects/struct-inl.h"
#include "src/objects/template-objects-inl.h"
#include "src/objects/transitions-inl.h" #include "src/objects/transitions-inl.h"
#include "src/ostreams.h" #include "src/ostreams.h"
#include "src/regexp/jsregexp.h" #include "src/regexp/jsregexp.h"
...@@ -1645,6 +1646,8 @@ void PrototypeUsers::Verify(WeakArrayList array) { ...@@ -1645,6 +1646,8 @@ void PrototypeUsers::Verify(WeakArrayList array) {
CHECK_EQ(weak_maps_count + empty_slots_count + 1, array->length()); CHECK_EQ(weak_maps_count + empty_slots_count + 1, array->length());
} }
USE_TORQUE_VERIFIER(TemplateObjectDescription)
void EnumCache::EnumCacheVerify(Isolate* isolate) { void EnumCache::EnumCacheVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::EnumCacheVerify(*this, isolate); TorqueGeneratedClassVerifiers::EnumCacheVerify(*this, isolate);
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "src/objects/promise-inl.h" #include "src/objects/promise-inl.h"
#include "src/objects/stack-frame-info-inl.h" #include "src/objects/stack-frame-info-inl.h"
#include "src/objects/struct-inl.h" #include "src/objects/struct-inl.h"
#include "src/objects/template-objects-inl.h"
#include "src/objects/transitions-inl.h" #include "src/objects/transitions-inl.h"
#include "src/ostreams.h" #include "src/ostreams.h"
#include "src/regexp/jsregexp.h" #include "src/regexp/jsregexp.h"
......
...@@ -349,7 +349,7 @@ Handle<TemplateObjectDescription> Factory::NewTemplateObjectDescription( ...@@ -349,7 +349,7 @@ Handle<TemplateObjectDescription> Factory::NewTemplateObjectDescription(
DCHECK_LT(0, raw_strings->length()); DCHECK_LT(0, raw_strings->length());
Handle<TemplateObjectDescription> result = Handle<TemplateObjectDescription> result =
Handle<TemplateObjectDescription>::cast( Handle<TemplateObjectDescription>::cast(
NewStruct(TUPLE2_TYPE, AllocationType::kOld)); NewStruct(TEMPLATE_OBJECT_DESCRIPTION_TYPE, AllocationType::kOld));
result->set_raw_strings(*raw_strings); result->set_raw_strings(*raw_strings);
result->set_cooked_strings(*cooked_strings); result->set_cooked_strings(*cooked_strings);
return result; return result;
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "src/objects/smi.h" #include "src/objects/smi.h"
#include "src/objects/stack-frame-info.h" #include "src/objects/stack-frame-info.h"
#include "src/objects/string.h" #include "src/objects/string.h"
#include "src/objects/template-objects-inl.h"
#include "src/regexp/jsregexp.h" #include "src/regexp/jsregexp.h"
#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-objects.h"
......
...@@ -111,6 +111,7 @@ namespace internal { ...@@ -111,6 +111,7 @@ namespace internal {
V(SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE) \ V(SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE) \
V(STACK_FRAME_INFO_TYPE) \ V(STACK_FRAME_INFO_TYPE) \
V(STACK_TRACE_FRAME_TYPE) \ V(STACK_TRACE_FRAME_TYPE) \
V(TEMPLATE_OBJECT_DESCRIPTION_TYPE) \
V(TUPLE2_TYPE) \ V(TUPLE2_TYPE) \
V(TUPLE3_TYPE) \ V(TUPLE3_TYPE) \
V(ARRAY_BOILERPLATE_DESCRIPTION_TYPE) \ V(ARRAY_BOILERPLATE_DESCRIPTION_TYPE) \
...@@ -329,6 +330,8 @@ namespace internal { ...@@ -329,6 +330,8 @@ namespace internal {
SourcePositionTableWithFrameCache, source_position_table_with_frame_cache) \ SourcePositionTableWithFrameCache, source_position_table_with_frame_cache) \
V(_, STACK_FRAME_INFO_TYPE, StackFrameInfo, stack_frame_info) \ V(_, STACK_FRAME_INFO_TYPE, StackFrameInfo, stack_frame_info) \
V(_, STACK_TRACE_FRAME_TYPE, StackTraceFrame, stack_trace_frame) \ V(_, STACK_TRACE_FRAME_TYPE, StackTraceFrame, stack_trace_frame) \
V(_, TEMPLATE_OBJECT_DESCRIPTION_TYPE, TemplateObjectDescription, \
template_object_description) \
V(_, TUPLE2_TYPE, Tuple2, tuple2) \ V(_, TUPLE2_TYPE, Tuple2, tuple2) \
V(_, TUPLE3_TYPE, Tuple3, tuple3) \ V(_, TUPLE3_TYPE, Tuple3, tuple3) \
V(_, ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ArrayBoilerplateDescription, \ V(_, ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ArrayBoilerplateDescription, \
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
#include "src/objects/stack-frame-info-inl.h" #include "src/objects/stack-frame-info-inl.h"
#include "src/objects/string-comparator.h" #include "src/objects/string-comparator.h"
#include "src/objects/struct-inl.h" #include "src/objects/struct-inl.h"
#include "src/objects/template-objects-inl.h"
#include "src/objects/transitions-inl.h" #include "src/objects/transitions-inl.h"
#include "src/ostreams.h" #include "src/ostreams.h"
#include "src/parsing/preparse-data.h" #include "src/parsing/preparse-data.h"
......
...@@ -171,6 +171,7 @@ enum InstanceType : uint16_t { ...@@ -171,6 +171,7 @@ enum InstanceType : uint16_t {
SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE, SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE,
STACK_FRAME_INFO_TYPE, STACK_FRAME_INFO_TYPE,
STACK_TRACE_FRAME_TYPE, STACK_TRACE_FRAME_TYPE,
TEMPLATE_OBJECT_DESCRIPTION_TYPE,
TUPLE2_TYPE, TUPLE2_TYPE,
TUPLE3_TYPE, TUPLE3_TYPE,
ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
...@@ -480,7 +481,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, ...@@ -480,7 +481,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
V(StoreHandler, STORE_HANDLER_TYPE) \ V(StoreHandler, STORE_HANDLER_TYPE) \
V(StringTable, STRING_TABLE_TYPE) \ V(StringTable, STRING_TABLE_TYPE) \
V(Symbol, SYMBOL_TYPE) \ V(Symbol, SYMBOL_TYPE) \
V(TemplateObjectDescription, TUPLE2_TYPE) \
V(TransitionArray, TRANSITION_ARRAY_TYPE) \ V(TransitionArray, TRANSITION_ARRAY_TYPE) \
V(UncompiledDataWithoutPreparseData, \ V(UncompiledDataWithoutPreparseData, \
UNCOMPILED_DATA_WITHOUT_PREPARSE_DATA_TYPE) \ UNCOMPILED_DATA_WITHOUT_PREPARSE_DATA_TYPE) \
......
...@@ -224,7 +224,6 @@ class ZoneForwardList; ...@@ -224,7 +224,6 @@ class ZoneForwardList;
V(SymbolWrapper) \ V(SymbolWrapper) \
V(TemplateInfo) \ V(TemplateInfo) \
V(TemplateList) \ V(TemplateList) \
V(TemplateObjectDescription) \
V(ThinString) \ V(ThinString) \
V(TransitionArray) \ V(TransitionArray) \
V(UncompiledData) \ V(UncompiledData) \
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
OBJECT_CONSTRUCTORS_IMPL(TemplateObjectDescription, Tuple2) OBJECT_CONSTRUCTORS_IMPL(TemplateObjectDescription, Struct)
OBJECT_CONSTRUCTORS_IMPL(CachedTemplateObject, Tuple3) OBJECT_CONSTRUCTORS_IMPL(CachedTemplateObject, Tuple3)
CAST_ACCESSOR(TemplateObjectDescription) CAST_ACCESSOR(TemplateObjectDescription)
......
...@@ -39,22 +39,25 @@ class CachedTemplateObject final : public Tuple3 { ...@@ -39,22 +39,25 @@ class CachedTemplateObject final : public Tuple3 {
// TemplateObjectDescription is a tuple of raw strings and cooked strings for // TemplateObjectDescription is a tuple of raw strings and cooked strings for
// tagged template literals. Used to communicate with the runtime for template // tagged template literals. Used to communicate with the runtime for template
// object creation within the {Runtime_GetTemplateObject} method. // object creation within the {Runtime_GetTemplateObject} method.
class TemplateObjectDescription final : public Tuple2 { class TemplateObjectDescription final : public Struct {
public: public:
DECL_ACCESSORS(raw_strings, FixedArray) DECL_ACCESSORS(raw_strings, FixedArray)
DECL_ACCESSORS(cooked_strings, FixedArray) DECL_ACCESSORS(cooked_strings, FixedArray)
DECL_CAST(TemplateObjectDescription)
static Handle<JSArray> GetTemplateObject( static Handle<JSArray> GetTemplateObject(
Isolate* isolate, Handle<Context> native_context, Isolate* isolate, Handle<Context> native_context,
Handle<TemplateObjectDescription> description, Handle<TemplateObjectDescription> description,
Handle<SharedFunctionInfo> shared_info, int slot_id); Handle<SharedFunctionInfo> shared_info, int slot_id);
DECL_CAST(TemplateObjectDescription) DECL_PRINTER(TemplateObjectDescription)
DECL_VERIFIER(TemplateObjectDescription)
static constexpr int kRawStringsOffset = kValue1Offset; DEFINE_FIELD_OFFSET_CONSTANTS(
static constexpr int kCookedStringsOffset = kValue2Offset; Struct::kHeaderSize, TORQUE_GENERATED_TEMPLATE_OBJECT_DESCRIPTION_FIELDS)
OBJECT_CONSTRUCTORS(TemplateObjectDescription, Tuple2); OBJECT_CONSTRUCTORS(TemplateObjectDescription, Struct);
}; };
} // namespace internal } // namespace internal
......
...@@ -3164,6 +3164,7 @@ void ImplementationVisitor::GeneratePrintDefinitions( ...@@ -3164,6 +3164,7 @@ void ImplementationVisitor::GeneratePrintDefinitions(
impl << "#include \"src/objects.h\"\n\n"; impl << "#include \"src/objects.h\"\n\n";
impl << "#include <iosfwd>\n\n"; impl << "#include <iosfwd>\n\n";
impl << "#include \"src/objects/struct-inl.h\"\n\n"; impl << "#include \"src/objects/struct-inl.h\"\n\n";
impl << "#include \"src/objects/template-objects-inl.h\"\n\n";
NamespaceScope impl_namespaces(impl, {"v8", "internal"}); NamespaceScope impl_namespaces(impl, {"v8", "internal"});
......
This diff is collapsed.
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