Commit d5625e35 authored by Seth Brenith's avatar Seth Brenith Committed by V8 LUCI CQ

[torque] Remove unused field offset macros

Nobody uses the generated *_FIELDS macros anymore, so we can remove
them. I also renamed the generated file to represent its content better.

Bug: v8:7793
Change-Id: I49ab39e363d6961e7210cd67018b6fb83b65a162
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3192191Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#77151}
parent 5a505fc0
...@@ -2916,11 +2916,11 @@ v8_torque( ...@@ -2916,11 +2916,11 @@ v8_torque(
"exported-macros-assembler.h", "exported-macros-assembler.h",
"factory.cc", "factory.cc",
"factory.inc", "factory.inc",
"field-offsets.h",
"instance-types.h", "instance-types.h",
"interface-descriptors.inc", "interface-descriptors.inc",
"objects-body-descriptors-inl.inc", "objects-body-descriptors-inl.inc",
"objects-printer.cc", "objects-printer.cc",
"visitor-lists.h",
], ],
args = select({ args = select({
":is_v8_annotate_torque_ir": [ "-annotate-ir" ], ":is_v8_annotate_torque_ir": [ "-annotate-ir" ],
......
...@@ -1701,11 +1701,11 @@ template("run_torque") { ...@@ -1701,11 +1701,11 @@ template("run_torque") {
"$destination_folder/exported-macros-assembler.h", "$destination_folder/exported-macros-assembler.h",
"$destination_folder/factory.cc", "$destination_folder/factory.cc",
"$destination_folder/factory.inc", "$destination_folder/factory.inc",
"$destination_folder/field-offsets.h",
"$destination_folder/instance-types.h", "$destination_folder/instance-types.h",
"$destination_folder/interface-descriptors.inc", "$destination_folder/interface-descriptors.inc",
"$destination_folder/objects-body-descriptors-inl.inc", "$destination_folder/objects-body-descriptors-inl.inc",
"$destination_folder/objects-printer.cc", "$destination_folder/objects-printer.cc",
"$destination_folder/visitor-lists.h",
] ]
foreach(file, torque_files) { foreach(file, torque_files) {
......
...@@ -14,6 +14,5 @@ ...@@ -14,6 +14,5 @@
#include "src/compiler/code-assembler.h" #include "src/compiler/code-assembler.h"
#include "src/utils/utils.h" #include "src/utils/utils.h"
#include "torque-generated/csa-types.h" #include "torque-generated/csa-types.h"
#include "torque-generated/field-offsets.h"
#endif // V8_BUILTINS_TORQUE_CSA_HEADER_INCLUDES_H_ #endif // V8_BUILTINS_TORQUE_CSA_HEADER_INCLUDES_H_
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "src/objects/map.h" #include "src/objects/map.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "src/objects/visitors.h" #include "src/objects/visitors.h"
#include "torque-generated/field-offsets.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "src/objects/fixed-array.h" #include "src/objects/fixed-array.h"
#include "src/objects/js-objects.h" #include "src/objects/js-objects.h"
#include "src/objects/struct.h" #include "src/objects/struct.h"
#include "torque-generated/field-offsets.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"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "src/objects/function-kind.h" #include "src/objects/function-kind.h"
#include "src/objects/ordered-hash-table.h" #include "src/objects/ordered-hash-table.h"
#include "src/objects/osr-optimized-code-cache.h" #include "src/objects/osr-optimized-code-cache.h"
#include "torque-generated/field-offsets.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"
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define V8_OBJECTS_DATA_HANDLER_H_ #define V8_OBJECTS_DATA_HANDLER_H_
#include "src/objects/struct.h" #include "src/objects/struct.h"
#include "torque-generated/field-offsets.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"
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "src/objects/allocation-site.h" #include "src/objects/allocation-site.h"
#include "src/objects/fixed-array.h" #include "src/objects/fixed-array.h"
#include "src/objects/js-objects.h" #include "src/objects/js-objects.h"
#include "torque-generated/field-offsets.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,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "src/objects/intl-objects.h" #include "src/objects/intl-objects.h"
#include "src/objects/managed.h" #include "src/objects/managed.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "torque-generated/field-offsets.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"
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "src/execution/isolate.h" #include "src/execution/isolate.h"
#include "src/objects/intl-objects.h" #include "src/objects/intl-objects.h"
#include "src/objects/managed.h" #include "src/objects/managed.h"
#include "torque-generated/field-offsets.h"
#include "unicode/uversion.h" #include "unicode/uversion.h"
// Has to be the last include (doesn't have include guards): // Has to be the last include (doesn't have include guards):
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "src/objects/code-kind.h" #include "src/objects/code-kind.h"
#include "src/objects/js-objects.h" #include "src/objects/js-objects.h"
#include "torque-generated/field-offsets.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"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "src/objects/internal-index.h" #include "src/objects/internal-index.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "src/objects/property-array.h" #include "src/objects/property-array.h"
#include "torque-generated/field-offsets.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"
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "src/roots/roots.h" #include "src/roots/roots.h"
#include "src/utils/ostreams.h" #include "src/utils/ostreams.h"
#include "src/zone/zone-containers.h" #include "src/zone/zone-containers.h"
#include "torque-generated/field-offsets.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "src/objects/internal-index.h" #include "src/objects/internal-index.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "torque-generated/bit-fields.h" #include "torque-generated/bit-fields.h"
#include "torque-generated/field-offsets.h" #include "torque-generated/visitor-lists.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"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "src/objects/js-objects.h" #include "src/objects/js-objects.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "src/objects/struct.h" #include "src/objects/struct.h"
#include "torque-generated/field-offsets.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"
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define V8_OBJECTS_PROPERTY_ARRAY_H_ #define V8_OBJECTS_PROPERTY_ARRAY_H_
#include "src/objects/heap-object.h" #include "src/objects/heap-object.h"
#include "torque-generated/field-offsets.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"
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define V8_OBJECTS_PROPERTY_CELL_H_ #define V8_OBJECTS_PROPERTY_CELL_H_
#include "src/objects/heap-object.h" #include "src/objects/heap-object.h"
#include "torque-generated/field-offsets.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"
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "src/base/compiler-specific.h" #include "src/base/compiler-specific.h"
#include "src/objects/fixed-array.h" #include "src/objects/fixed-array.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "torque-generated/field-offsets.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"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "src/roots/roots.h" #include "src/roots/roots.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck #include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck
#include "torque-generated/bit-fields.h" #include "torque-generated/bit-fields.h"
#include "torque-generated/field-offsets.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,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "src/objects/name.h" #include "src/objects/name.h"
#include "src/objects/smi.h" #include "src/objects/smi.h"
#include "src/strings/unicode-decoder.h" #include "src/strings/unicode-decoder.h"
#include "torque-generated/field-offsets.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"
......
...@@ -3767,30 +3767,6 @@ class FieldOffsetsGenerator { ...@@ -3767,30 +3767,6 @@ class FieldOffsetsGenerator {
bool header_size_emitted_ = false; bool header_size_emitted_ = false;
}; };
class MacroFieldOffsetsGenerator : public FieldOffsetsGenerator {
public:
MacroFieldOffsetsGenerator(std::ostream& out, const ClassType* type)
: FieldOffsetsGenerator(type), out_(out) {
out_ << "#define ";
out_ << "TORQUE_GENERATED_" << CapifyStringWithUnderscores(type_->name())
<< "_FIELDS(V) \\\n";
}
void WriteField(const Field& f, const std::string& size_string) override {
out_ << "/* " << PositionAsString(f.pos) << " */ \\\n";
out_ << "V(k" << CamelifyString(f.name_and_type.name) << "Offset, "
<< size_string << ") \\\n";
}
void WriteFieldOffsetGetter(const Field& f) override {
// Can't do anything here.
}
void WriteMarker(const std::string& marker) override {
out_ << "V(" << marker << ", 0) \\\n";
}
private:
std::ostream& out_;
};
void GenerateClassExport(const ClassType* type, std::ostream& header, void GenerateClassExport(const ClassType* type, std::ostream& header,
std::ostream& inl_header) { std::ostream& inl_header) {
const ClassType* super = type->GetSuperClass(); const ClassType* super = type->GetSuperClass();
...@@ -3808,27 +3784,13 @@ void GenerateClassExport(const ClassType* type, std::ostream& header, ...@@ -3808,27 +3784,13 @@ void GenerateClassExport(const ClassType* type, std::ostream& header,
} // namespace } // namespace
void ImplementationVisitor::GenerateClassFieldOffsets( void ImplementationVisitor::GenerateVisitorLists(
const std::string& output_directory) { const std::string& output_directory) {
std::stringstream header; std::stringstream header;
std::string file_name = "field-offsets.h"; std::string file_name = "visitor-lists.h";
{ {
IncludeGuardScope include_guard(header, file_name); IncludeGuardScope include_guard(header, file_name);
for (const ClassType* type : TypeOracle::GetClasses()) {
// TODO(danno): Remove this once all classes use ClassFieldOffsetGenerator
// to generate field offsets without the use of macros.
if (!type->GenerateCppClassDefinitions() && !type->HasUndefinedLayout()) {
MacroFieldOffsetsGenerator g(header, type);
for (auto f : type->fields()) {
CurrentSourcePosition::Scope scope(f.pos);
g.RecordOffsetFor(f);
}
g.Finish();
header << "\n";
}
}
header << "#define TORQUE_INSTANCE_TYPE_TO_BODY_DESCRIPTOR_LIST(V)\\\n"; header << "#define TORQUE_INSTANCE_TYPE_TO_BODY_DESCRIPTOR_LIST(V)\\\n";
for (const ClassType* type : TypeOracle::GetClasses()) { for (const ClassType* type : TypeOracle::GetClasses()) {
if (type->ShouldGenerateBodyDescriptor() && type->OwnInstanceType()) { if (type->ShouldGenerateBodyDescriptor() && type->OwnInstanceType()) {
......
...@@ -443,7 +443,7 @@ class ImplementationVisitor { ...@@ -443,7 +443,7 @@ class ImplementationVisitor {
public: public:
void GenerateBuiltinDefinitionsAndInterfaceDescriptors( void GenerateBuiltinDefinitionsAndInterfaceDescriptors(
const std::string& output_directory); const std::string& output_directory);
void GenerateClassFieldOffsets(const std::string& output_directory); void GenerateVisitorLists(const std::string& output_directory);
void GenerateBitFields(const std::string& output_directory); void GenerateBitFields(const std::string& output_directory);
void GeneratePrintDefinitions(const std::string& output_directory); void GeneratePrintDefinitions(const std::string& output_directory);
void GenerateClassDefinitions(const std::string& output_directory); void GenerateClassDefinitions(const std::string& output_directory);
......
...@@ -90,7 +90,7 @@ void CompileCurrentAst(TorqueCompilerOptions options) { ...@@ -90,7 +90,7 @@ void CompileCurrentAst(TorqueCompilerOptions options) {
implementation_visitor.GenerateBuiltinDefinitionsAndInterfaceDescriptors( implementation_visitor.GenerateBuiltinDefinitionsAndInterfaceDescriptors(
output_directory); output_directory);
implementation_visitor.GenerateClassFieldOffsets(output_directory); implementation_visitor.GenerateVisitorLists(output_directory);
implementation_visitor.GenerateBitFields(output_directory); implementation_visitor.GenerateBitFields(output_directory);
implementation_visitor.GeneratePrintDefinitions(output_directory); implementation_visitor.GeneratePrintDefinitions(output_directory);
implementation_visitor.GenerateClassDefinitions(output_directory); implementation_visitor.GenerateClassDefinitions(output_directory);
......
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