Skip to content

Commit 3ee5dbc

Browse files
santiaboyCommit Bot
authored andcommitted
Revert "[turbofan][64] Remove Smi Untagging extra nodes for 31 bit smis"
This reverts commit 4d1b7af. 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: Santiago Aboy Solanes <solanes@chromium.org> Cr-Commit-Position: refs/heads/master@{#64930}
1 parent d5dd2e6 commit 3ee5dbc

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/compiler/decompression-optimizer.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ void DecompressionOptimizer::MarkNodeInputs(Node* node) {
8080
case IrOpcode::kUint32LessThanOrEqual:
8181
case IrOpcode::kWord32And:
8282
case IrOpcode::kWord32Equal:
83-
case IrOpcode::kWord32Shl:
8483
DCHECK_EQ(node->op()->ValueInputCount(), 2);
8584
MaybeMarkAndQueueForRevisit(node->InputAt(0),
8685
State::kOnly32BitsObserved); // value_0

src/compiler/effect-control-linearizer.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4375,7 +4375,8 @@ Node* EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value) {
43754375
Node* EffectControlLinearizer::ChangeIntPtrToSmi(Node* value) {
43764376
// Do shift on 32bit values if Smis are stored in the lower word.
43774377
if (machine()->Is64() && SmiValuesAre31Bits()) {
4378-
return __ Word32Shl(value, SmiShiftBitsConstant());
4378+
return __ ChangeInt32ToInt64(
4379+
__ Word32Shl(__ TruncateInt64ToInt32(value), SmiShiftBitsConstant()));
43794380
}
43804381
return __ WordShl(value, SmiShiftBitsConstant());
43814382
}
@@ -4397,7 +4398,7 @@ Node* EffectControlLinearizer::ChangeIntPtrToInt32(Node* value) {
43974398
Node* EffectControlLinearizer::ChangeInt32ToSmi(Node* value) {
43984399
// Do shift on 32bit values if Smis are stored in the lower word.
43994400
if (machine()->Is64() && SmiValuesAre31Bits()) {
4400-
return __ Word32Shl(value, SmiShiftBitsConstant());
4401+
return __ ChangeInt32ToInt64(__ Word32Shl(value, SmiShiftBitsConstant()));
44014402
}
44024403
return ChangeIntPtrToSmi(ChangeInt32ToIntPtr(value));
44034404
}
@@ -4417,7 +4418,7 @@ Node* EffectControlLinearizer::ChangeUint32ToUintPtr(Node* value) {
44174418
Node* EffectControlLinearizer::ChangeUint32ToSmi(Node* value) {
44184419
// Do shift on 32bit values if Smis are stored in the lower word.
44194420
if (machine()->Is64() && SmiValuesAre31Bits()) {
4420-
return __ Word32Shl(value, SmiShiftBitsConstant());
4421+
return __ ChangeUint32ToUint64(__ Word32Shl(value, SmiShiftBitsConstant()));
44214422
} else {
44224423
return __ WordShl(ChangeUint32ToUintPtr(value), SmiShiftBitsConstant());
44234424
}

test/unittests/compiler/decompression-optimizer-unittest.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,13 @@ TEST_F(DecompressionOptimizerTest, Word32ShlSmiTag) {
195195
// Create the graph.
196196
Node* load = graph()->NewNode(machine()->Load(MachineType::AnyTagged()),
197197
object, index, effect, control);
198+
Node* truncation = graph()->NewNode(machine()->TruncateInt64ToInt32(), load);
198199
Node* smi_shift_bits =
199200
graph()->NewNode(common()->Int32Constant(kSmiShiftSize + kSmiTagSize));
201+
Node* word32_shl =
202+
graph()->NewNode(machine()->Word32Shl(), truncation, smi_shift_bits);
200203
graph()->SetEnd(
201-
graph()->NewNode(machine()->Word32Shl(), load, smi_shift_bits));
204+
graph()->NewNode(machine()->ChangeInt32ToInt64(), word32_shl));
202205
// Change the nodes, and test the change.
203206
Reduce();
204207
EXPECT_EQ(LoadMachRep(load), CompressedMachRep(MachineType::AnyTagged()));

0 commit comments

Comments
 (0)