Commit 243665c6 authored by Ross McIlroy's avatar Ross McIlroy Committed by V8 LUCI CQ

[compiler] Better packing of fields for RepresentationSelector::NodeInfo

Move a field and pack enums in Truncation to save 2 word for
each NodeInfo.

BUG=v8:9684

Change-Id: Ib470019b13a1cb8586c1bc585ff1aff6a88267ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2892664
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74597}
parent 6d99f933
...@@ -16,7 +16,11 @@ namespace compiler { ...@@ -16,7 +16,11 @@ namespace compiler {
// Foward declarations. // Foward declarations.
class TypeCache; class TypeCache;
enum IdentifyZeros { kIdentifyZeros, kDistinguishZeros }; enum IdentifyZeros : uint8_t { kIdentifyZeros, kDistinguishZeros };
constexpr int kIdentifyZerosBits = 1;
static_assert(static_cast<int>(IdentifyZeros::kDistinguishZeros) <
1 << kIdentifyZerosBits,
"kIdentifyZeros must fit into kIdentifyZerosBits");
class Truncation final { class Truncation final {
public: public:
...@@ -94,6 +98,10 @@ class Truncation final { ...@@ -94,6 +98,10 @@ class Truncation final {
kOddballAndBigIntToNumber, kOddballAndBigIntToNumber,
kAny kAny
}; };
static constexpr int kTruncationKindBits = 4;
static_assert(static_cast<int>(TruncationKind::kAny) <
1 << kTruncationKindBits,
"TransactionKind must fit into kTruncationKindBits");
explicit Truncation(TruncationKind kind, IdentifyZeros identify_zeros) explicit Truncation(TruncationKind kind, IdentifyZeros identify_zeros)
: kind_(kind), identify_zeros_(identify_zeros) { : kind_(kind), identify_zeros_(identify_zeros) {
...@@ -103,8 +111,8 @@ class Truncation final { ...@@ -103,8 +111,8 @@ class Truncation final {
} }
TruncationKind kind() const { return kind_; } TruncationKind kind() const { return kind_; }
TruncationKind kind_; TruncationKind kind_ : kTruncationKindBits;
IdentifyZeros identify_zeros_; IdentifyZeros identify_zeros_ : kIdentifyZerosBits;
static TruncationKind Generalize(TruncationKind rep1, TruncationKind rep2); static TruncationKind Generalize(TruncationKind rep1, TruncationKind rep2);
static IdentifyZeros GeneralizeIdentifyZeros(IdentifyZeros i1, static IdentifyZeros GeneralizeIdentifyZeros(IdentifyZeros i1,
......
...@@ -294,15 +294,17 @@ class RepresentationSelector { ...@@ -294,15 +294,17 @@ class RepresentationSelector {
Type restriction_type() const { return restriction_type_; } Type restriction_type() const { return restriction_type_; }
private: private:
// Fields are ordered to avoid mixing byte and word size fields to minimize
// padding.
enum State : uint8_t { kUnvisited, kPushed, kVisited, kQueued }; enum State : uint8_t { kUnvisited, kPushed, kVisited, kQueued };
State state_ = kUnvisited; State state_ = kUnvisited;
MachineRepresentation representation_ = MachineRepresentation representation_ =
MachineRepresentation::kNone; // Output representation. MachineRepresentation::kNone; // Output representation.
Truncation truncation_ = Truncation::None(); // Information about uses. Truncation truncation_ = Truncation::None(); // Information about uses.
bool weakened_ = false;
Type restriction_type_ = Type::Any(); Type restriction_type_ = Type::Any();
Type feedback_type_; Type feedback_type_;
bool weakened_ = false;
}; };
RepresentationSelector(JSGraph* jsgraph, JSHeapBroker* broker, Zone* zone, RepresentationSelector(JSGraph* jsgraph, JSHeapBroker* broker, Zone* zone,
......
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