From 52fc155254ef8516760cbbb1023a9840ad314682 Mon Sep 17 00:00:00 2001 From: Benedikt Meurer Date: Fri, 14 Sep 2018 09:26:45 +0200 Subject: [PATCH] [turbofan] Remove Truncation::Word64(). This truncation doesn't have a proper meaning anyways and has never been used inside the representation selection. For pointer fields we also don't need to pass on a truncation anyways. Bug: v8:8015 Change-Id: I5ff49e20b70fa70d6bcf7401a357cd7ad9f1a938 Reviewed-on: https://chromium-review.googlesource.com/1226870 Commit-Queue: Benedikt Meurer Reviewed-by: Jaroslav Sevcik Cr-Commit-Position: refs/heads/master@{#55885} --- src/compiler/representation-change.cc | 34 +++++++++++---------------- src/compiler/representation-change.h | 18 ++++---------- src/compiler/simplified-lowering.cc | 19 +++++++-------- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc index cdfcae0e31..455d980796 100644 --- a/src/compiler/representation-change.cc +++ b/src/compiler/representation-change.cc @@ -24,8 +24,6 @@ const char* Truncation::description() const { return "truncate-to-bool"; case TruncationKind::kWord32: return "truncate-to-word32"; - case TruncationKind::kWord64: - return "truncate-to-word64"; case TruncationKind::kFloat64: switch (identify_zeros()) { case kIdentifyZeros: @@ -44,23 +42,22 @@ const char* Truncation::description() const { UNREACHABLE(); } - // Partial order for truncations: // -// kWord64 kAny <-------+ -// ^ ^ | -// \ | | -// \ kFloat64 | -// \ ^ | -// \ / | -// kWord32 kBool -// ^ ^ -// \ / -// \ / -// \ / -// \ / -// \ / -// kNone +// kAny <-------+ +// ^ | +// | | +// kFloat64 | +// ^ | +// / | +// kWord32 kBool +// ^ ^ +// \ / +// \ / +// \ / +// \ / +// \ / +// kNone // // TODO(jarin) We might consider making kBool < kFloat64. @@ -103,10 +100,7 @@ bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) { return rep2 == TruncationKind::kBool || rep2 == TruncationKind::kAny; case TruncationKind::kWord32: return rep2 == TruncationKind::kWord32 || - rep2 == TruncationKind::kWord64 || rep2 == TruncationKind::kFloat64 || rep2 == TruncationKind::kAny; - case TruncationKind::kWord64: - return rep2 == TruncationKind::kWord64; case TruncationKind::kFloat64: return rep2 == TruncationKind::kFloat64 || rep2 == TruncationKind::kAny; case TruncationKind::kAny: diff --git a/src/compiler/representation-change.h b/src/compiler/representation-change.h index 989895eef9..8d43800baf 100644 --- a/src/compiler/representation-change.h +++ b/src/compiler/representation-change.h @@ -26,9 +26,6 @@ class Truncation final { static Truncation Word32() { return Truncation(TruncationKind::kWord32, kIdentifyZeros); } - static Truncation Word64() { - return Truncation(TruncationKind::kWord64, kIdentifyZeros); - } static Truncation Float64(IdentifyZeros identify_zeros = kDistinguishZeros) { return Truncation(TruncationKind::kFloat64, identify_zeros); } @@ -57,10 +54,6 @@ class Truncation final { return LessGeneral(kind_, TruncationKind::kWord32) || LessGeneral(kind_, TruncationKind::kBool); } - bool IdentifiesUndefinedAndNaN() { - return LessGeneral(kind_, TruncationKind::kFloat64) || - LessGeneral(kind_, TruncationKind::kWord64); - } bool IdentifiesZeroAndMinusZero() const { return identify_zeros() == kIdentifyZeros; } @@ -85,7 +78,6 @@ class Truncation final { kNone, kBool, kWord32, - kWord64, kFloat64, kAny }; @@ -162,8 +154,11 @@ class UseInfo { static UseInfo TruncatingWord32() { return UseInfo(MachineRepresentation::kWord32, Truncation::Word32()); } - static UseInfo TruncatingWord64() { - return UseInfo(MachineRepresentation::kWord64, Truncation::Word64()); + static UseInfo Word64() { + return UseInfo(MachineRepresentation::kWord64, Truncation::Any()); + } + static UseInfo Word() { + return UseInfo(MachineType::PointerRepresentation(), Truncation::Any()); } static UseInfo Bool() { return UseInfo(MachineRepresentation::kBit, Truncation::Bool()); @@ -174,9 +169,6 @@ class UseInfo { static UseInfo TruncatingFloat64() { return UseInfo(MachineRepresentation::kFloat64, Truncation::Float64()); } - static UseInfo PointerInt() { - return kPointerSize == 4 ? TruncatingWord32() : TruncatingWord64(); - } static UseInfo AnyTagged() { return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); } diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 9900d82afc..465f73ae35 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -140,7 +140,7 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { case MachineRepresentation::kWord32: return UseInfo::TruncatingWord32(); case MachineRepresentation::kWord64: - return UseInfo::TruncatingWord64(); + return UseInfo::Word64(); case MachineRepresentation::kBit: return UseInfo::Bool(); case MachineRepresentation::kSimd128: @@ -151,11 +151,11 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { } UseInfo UseInfoForBasePointer(const FieldAccess& access) { - return access.tag() != 0 ? UseInfo::AnyTagged() : UseInfo::PointerInt(); + return access.tag() != 0 ? UseInfo::AnyTagged() : UseInfo::Word(); } UseInfo UseInfoForBasePointer(const ElementAccess& access) { - return access.tag() != 0 ? UseInfo::AnyTagged() : UseInfo::PointerInt(); + return access.tag() != 0 ? UseInfo::AnyTagged() : UseInfo::Word(); } void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) { @@ -2637,7 +2637,7 @@ class RepresentationSelector { MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op())); ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer ProcessInput(node, 1, UseInfo::AnyTagged()); // base pointer - ProcessInput(node, 2, UseInfo::PointerInt()); // external pointer + ProcessInput(node, 2, UseInfo::Word()); // external pointer ProcessInput(node, 3, UseInfo::TruncatingWord32()); // index ProcessRemainingInputs(node, 4); SetOutput(node, rep); @@ -2647,7 +2647,7 @@ class RepresentationSelector { MachineRepresentation const rep = MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op())); ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer - ProcessInput(node, 1, UseInfo::PointerInt()); // external pointer + ProcessInput(node, 1, UseInfo::Word()); // external pointer ProcessInput(node, 2, UseInfo::TruncatingWord32()); // index ProcessInput(node, 3, UseInfo::Bool()); // little-endian ProcessRemainingInputs(node, 4); @@ -2659,7 +2659,7 @@ class RepresentationSelector { MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op())); ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer ProcessInput(node, 1, UseInfo::AnyTagged()); // base pointer - ProcessInput(node, 2, UseInfo::PointerInt()); // external pointer + ProcessInput(node, 2, UseInfo::Word()); // external pointer ProcessInput(node, 3, UseInfo::TruncatingWord32()); // index ProcessInput(node, 4, TruncatingUseInfoFromRepresentation(rep)); // value @@ -2671,7 +2671,7 @@ class RepresentationSelector { MachineRepresentation const rep = MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op())); ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer - ProcessInput(node, 1, UseInfo::PointerInt()); // external pointer + ProcessInput(node, 1, UseInfo::Word()); // external pointer ProcessInput(node, 2, UseInfo::TruncatingWord32()); // index ProcessInput(node, 3, TruncatingUseInfoFromRepresentation(rep)); // value @@ -2961,8 +2961,7 @@ class RepresentationSelector { return; } case IrOpcode::kArgumentsLength: { - VisitUnop(node, UseInfo::PointerInt(), - MachineRepresentation::kTaggedSigned); + VisitUnop(node, UseInfo::Word(), MachineRepresentation::kTaggedSigned); return; } case IrOpcode::kNewDoubleElements: @@ -2972,7 +2971,7 @@ class RepresentationSelector { return; } case IrOpcode::kNewArgumentsElements: { - VisitBinop(node, UseInfo::PointerInt(), UseInfo::TaggedSigned(), + VisitBinop(node, UseInfo::Word(), UseInfo::TaggedSigned(), MachineRepresentation::kTaggedPointer); return; }