Make torque emit structs in classes in order

Torque compiler emits a C++ class definition header
class-definitions-tq.h. Unfortunately it does so in a manner that
introduces randomness into the ordering of some structs. This means that
every full build of V8 may yield a different header.
Since this header is included in a lot of files in V8, it causes a lot
of ccache misses (over a 1000).

This commit makes sure that the structs are emitted in lexical order.

Bug: v8:10310
Change-Id: Ie39066d36e41583ff990bc639f7f241462351585
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2093500
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66645}
This commit is contained in:
Janusz Majnert 2020-03-10 12:38:47 +01:00 committed by Commit Bot
parent 9d3cca1cd3
commit 5a04c5cea2
2 changed files with 2 additions and 1 deletions

View File

@ -104,6 +104,7 @@ Isiah Meadows <impinball@gmail.com>
Jaime Bernardo <jaime@janeasystems.com>
Jan de Mooij <jandemooij@gmail.com>
Jan Krems <jan.krems@gmail.com>
Janusz Majnert <jmajnert@gmail.com>
Jay Freeman <saurik@saurik.com>
James Pike <g00gle@chilon.net>
James M Snell <jasnell@gmail.com>

View File

@ -3888,7 +3888,7 @@ void ImplementationVisitor::GenerateClassDefinitions(
NamespaceScope implementation_namespaces(implementation,
{"v8", "internal"});
std::unordered_set<const StructType*> structs_used_in_classes;
std::set<const StructType*, TypeLess> structs_used_in_classes;
for (const ClassType* type : TypeOracle::GetClasses()) {
std::stringstream& header = (type->IsExtern() || type->ShouldExport())