From c6af9bb358caa0fb95c1a66eec4bdb4e26e75993 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Fri, 3 May 2019 13:46:25 +0100 Subject: [PATCH] [cleanup][turbofan] Updated representation checks Started as a cleanup of my own CLs but I noticed there were some checks that I could update as well. Cq-Include-Trybots: luci.v8.try:v8_linux64_pointer_compression_rel_ng Cq-Include-Trybots: luci.v8.try:v8_linux64_arm64_pointer_compression_rel_ng Bug: v8:8977, v8:7703, v8:9183 Change-Id: I19092347e33324c24ff4396fa35c40a311c45799 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1594557 Commit-Queue: Santiago Aboy Solanes Reviewed-by: Jaroslav Sevcik Cr-Commit-Position: refs/heads/master@{#61380} --- src/code-stub-assembler.cc | 4 +--- src/compiler/machine-graph-verifier.cc | 8 ++------ src/compiler/representation-change.cc | 4 +--- src/compiler/simplified-lowering.cc | 6 ++---- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc index ad598951a7..36b00f0dad 100644 --- a/src/code-stub-assembler.cc +++ b/src/code-stub-assembler.cc @@ -8137,9 +8137,7 @@ void CodeStubAssembler::Increment(Variable* variable, int value, ParameterMode mode) { DCHECK_IMPLIES(mode == INTPTR_PARAMETERS, variable->rep() == MachineType::PointerRepresentation()); - DCHECK_IMPLIES(mode == SMI_PARAMETERS, - variable->rep() == MachineRepresentation::kTagged || - variable->rep() == MachineRepresentation::kTaggedSigned); + DCHECK_IMPLIES(mode == SMI_PARAMETERS, CanBeTaggedSigned(variable->rep())); variable->Bind(IntPtrOrSmiAdd(variable->value(), IntPtrOrSmiConstant(value, mode), mode)); } diff --git a/src/compiler/machine-graph-verifier.cc b/src/compiler/machine-graph-verifier.cc index e1e7e80310..6783249bf8 100644 --- a/src/compiler/machine-graph-verifier.cc +++ b/src/compiler/machine-graph-verifier.cc @@ -926,13 +926,9 @@ class MachineRepresentationChecker { MachineRepresentation actual) { switch (expected) { case MachineRepresentation::kTagged: - return (actual == MachineRepresentation::kTagged || - actual == MachineRepresentation::kTaggedSigned || - actual == MachineRepresentation::kTaggedPointer); + return IsAnyTagged(actual); case MachineRepresentation::kCompressed: - return (actual == MachineRepresentation::kCompressed || - actual == MachineRepresentation::kCompressedSigned || - actual == MachineRepresentation::kCompressedPointer); + return IsAnyCompressed(actual); case MachineRepresentation::kTaggedSigned: case MachineRepresentation::kTaggedPointer: case MachineRepresentation::kCompressedSigned: diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc index 3210054b2f..b62cf3a212 100644 --- a/src/compiler/representation-change.cc +++ b/src/compiler/representation-change.cc @@ -855,9 +855,7 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( jsgraph()->common()->DeadValue(MachineRepresentation::kFloat64), unreachable); } - } else if (output_rep == MachineRepresentation::kTagged || - output_rep == MachineRepresentation::kTaggedSigned || - output_rep == MachineRepresentation::kTaggedPointer) { + } else if (IsAnyTagged(output_rep)) { if (output_type.Is(Type::Undefined())) { return jsgraph()->Float64Constant( std::numeric_limits::quiet_NaN()); diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 453dc4967b..9329fc4f6b 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -2791,8 +2791,7 @@ class RepresentationSelector { access.machine_type.representation(); // Convert to Smi if possible, such that we can avoid a write barrier. - if ((field_representation == MachineRepresentation::kTagged || - field_representation == MachineRepresentation::kCompressed) && + if (field_representation == MachineType::RepCompressedTagged() && TypeOf(value_node).Is(Type::SignedSmall())) { field_representation = MachineType::RepCompressedTaggedSigned(); } @@ -2829,8 +2828,7 @@ class RepresentationSelector { access.machine_type.representation(); // Convert to Smi if possible, such that we can avoid a write barrier. - if ((element_representation == MachineRepresentation::kTagged || - element_representation == MachineRepresentation::kCompressed) && + if (element_representation == MachineType::RepCompressedTagged() && TypeOf(value_node).Is(Type::SignedSmall())) { element_representation = MachineType::RepCompressedTaggedSigned(); }