Commit 3ee5dbc0 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

Revert "[turbofan][64] Remove Smi Untagging extra nodes for 31 bit smis"

This reverts commit 4d1b7af7.

Reason for revert: Broke clusterfuzz asan build

Original change's description:
> [turbofan][64] Remove Smi Untagging extra nodes for 31 bit smis
>
> There are some cases where we can ignore some truncations or
> change nodes for Smi Untagging, when we are using 31 bit smis
> in 64 bit architectures.
>
> Updated DecompressionOptimizer to match the new pattern.
>
> Change-Id: I89d34407e6f780ec0399cd427cf9d3e24ee5669a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1889877
> Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#64909}

TBR=jgruber@chromium.org,tebbi@chromium.org,solanes@chromium.org

Bug: chromium:1023972
Change-Id: I7773455a970a11c345a020c1421c961314c8eb5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1914202
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64930}
parent d5dd2e66
......@@ -80,7 +80,6 @@ void DecompressionOptimizer::MarkNodeInputs(Node* node) {
case IrOpcode::kUint32LessThanOrEqual:
case IrOpcode::kWord32And:
case IrOpcode::kWord32Equal:
case IrOpcode::kWord32Shl:
DCHECK_EQ(node->op()->ValueInputCount(), 2);
MaybeMarkAndQueueForRevisit(node->InputAt(0),
State::kOnly32BitsObserved); // value_0
......
......@@ -4375,7 +4375,8 @@ Node* EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value) {
Node* EffectControlLinearizer::ChangeIntPtrToSmi(Node* value) {
// Do shift on 32bit values if Smis are stored in the lower word.
if (machine()->Is64() && SmiValuesAre31Bits()) {
return __ Word32Shl(value, SmiShiftBitsConstant());
return __ ChangeInt32ToInt64(
__ Word32Shl(__ TruncateInt64ToInt32(value), SmiShiftBitsConstant()));
}
return __ WordShl(value, SmiShiftBitsConstant());
}
......@@ -4397,7 +4398,7 @@ Node* EffectControlLinearizer::ChangeIntPtrToInt32(Node* value) {
Node* EffectControlLinearizer::ChangeInt32ToSmi(Node* value) {
// Do shift on 32bit values if Smis are stored in the lower word.
if (machine()->Is64() && SmiValuesAre31Bits()) {
return __ Word32Shl(value, SmiShiftBitsConstant());
return __ ChangeInt32ToInt64(__ Word32Shl(value, SmiShiftBitsConstant()));
}
return ChangeIntPtrToSmi(ChangeInt32ToIntPtr(value));
}
......@@ -4417,7 +4418,7 @@ Node* EffectControlLinearizer::ChangeUint32ToUintPtr(Node* value) {
Node* EffectControlLinearizer::ChangeUint32ToSmi(Node* value) {
// Do shift on 32bit values if Smis are stored in the lower word.
if (machine()->Is64() && SmiValuesAre31Bits()) {
return __ Word32Shl(value, SmiShiftBitsConstant());
return __ ChangeUint32ToUint64(__ Word32Shl(value, SmiShiftBitsConstant()));
} else {
return __ WordShl(ChangeUint32ToUintPtr(value), SmiShiftBitsConstant());
}
......
......@@ -195,10 +195,13 @@ TEST_F(DecompressionOptimizerTest, Word32ShlSmiTag) {
// 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()->Word32Shl(), load, smi_shift_bits));
graph()->NewNode(machine()->ChangeInt32ToInt64(), word32_shl));
// Change the nodes, and test the change.
Reduce();
EXPECT_EQ(LoadMachRep(load), CompressedMachRep(MachineType::AnyTagged()));
......
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