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