Commit b65e72c6 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[TurboFan] Change representation of NumberConstant in 32-bit arch

Smi constants in 32 bit machines are guaranteed to be 31 bits.

Bug: chromium:1254189
Change-Id: I4ea296a7212c5e6ea14119fbd71cfb5789762b55
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3195874
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77185}
parent 582f8021
...@@ -4743,6 +4743,12 @@ Node* EffectControlLinearizer::ChangeSmiToIntPtr(Node* value) { ...@@ -4743,6 +4743,12 @@ Node* EffectControlLinearizer::ChangeSmiToIntPtr(Node* value) {
__ ChangeInt32ToInt64(__ TruncateInt64ToInt32(value)), __ ChangeInt32ToInt64(__ TruncateInt64ToInt32(value)),
SmiShiftBitsConstant()); SmiShiftBitsConstant());
} }
if (machine()->Is32() && value->opcode() == IrOpcode::kNumberConstant) {
// Smi constants are guaranteed to be 31 bits.
double number = OpParameter<double>(value->op());
return __ WordSarShiftOutZeros(
__ Int32Constant(static_cast<int32_t>(number)), SmiShiftBitsConstant());
}
return __ WordSarShiftOutZeros(value, SmiShiftBitsConstant()); return __ WordSarShiftOutZeros(value, SmiShiftBitsConstant());
} }
......
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