Commit af2a52bb authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr] Add Smi tag test case to DecompressionOptimizer

Bug: v8:7703
Change-Id: I06c47aa4057362d52e53b6a45d4e8a5febb92c82
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1876055
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64643}
parent 24c4b32b
......@@ -55,14 +55,16 @@ void DecompressionOptimizer::MarkNodes() {
void DecompressionOptimizer::MarkNodeInputs(Node* node) {
// Mark the value inputs.
switch (node->opcode()) {
// TODO(v8:7703): To be removed when the TaggedEqual implementation stops
// using ChangeTaggedToCompressed.
// UNOPS.
// TODO(v8:7703): ChangeTaggedToCompressed case to be removed when the
// TaggedEqual implementation stops using ChangeTaggedToCompressed.
case IrOpcode::kChangeTaggedToCompressed:
case IrOpcode::kTruncateInt64ToInt32:
DCHECK_EQ(node->op()->ValueInputCount(), 1);
MaybeMarkAndQueueForRevisit(node->InputAt(0),
State::kOnly32BitsObserved); // value
break;
// BINOPS.
case IrOpcode::kWord32And:
case IrOpcode::kWord32Equal:
DCHECK_EQ(node->op()->ValueInputCount(), 2);
......@@ -71,6 +73,7 @@ void DecompressionOptimizer::MarkNodeInputs(Node* node) {
MaybeMarkAndQueueForRevisit(node->InputAt(1),
State::kOnly32BitsObserved); // value_1
break;
// SPECIAL CASES.
case IrOpcode::kStore:
case IrOpcode::kProtectedStore:
case IrOpcode::kUnalignedStore:
......
......@@ -204,6 +204,34 @@ TEST_F(DecompressionOptimizerTest, Word32AndSmiCheck) {
}
}
TEST_F(DecompressionOptimizerTest, Word32ShlSmiTag) {
// Skip test if decompression elimination is enabled.
if (FLAG_turbo_decompression_elimination) {
return;
}
// Define variables.
Node* const control = graph()->start();
Node* object = Parameter(Type::Any(), 0);
Node* effect = graph()->start();
Node* index = Parameter(Type::UnsignedSmall(), 1);
// Test only for AnyTagged, since TaggedPointer can't be Smi tagged.
// Create the graph.
Node* load = graph()->NewNode(machine()->Load(MachineType::AnyTagged()),
object, index, effect, control);
Node* truncation = graph()->NewNode(machine()->TruncateInt64ToInt32(), load);
Node* smi_shift_bits =
graph()->NewNode(common()->Int32Constant(kSmiShiftSize + kSmiTagSize));
Node* word32_shl =
graph()->NewNode(machine()->Word32Shl(), truncation, smi_shift_bits);
graph()->SetEnd(
graph()->NewNode(machine()->ChangeInt32ToInt64(), word32_shl));
// Change the nodes, and test the change.
Reduce();
EXPECT_EQ(LoadMachRep(load), CompressedMachRep(MachineType::AnyTagged()));
}
} // namespace compiler
} // namespace internal
} // namespace v8
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