Commit bbea5909 authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

[turbofan] Fix NumberConstant used with Word32 rep in ISel

Bug: chromium:1304658

Change-Id: I6a82603a7c5de5ae8f5a895990c1a904bbdd39b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3532263
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79526}
parent d8c9b089
......@@ -30,6 +30,14 @@ namespace v8 {
namespace internal {
namespace compiler {
Smi NumberConstantToSmi(Node* node) {
DCHECK_EQ(node->opcode(), IrOpcode::kNumberConstant);
const double d = OpParameter<double>(node->op());
Smi smi = Smi::FromInt(static_cast<int32_t>(d));
CHECK_EQ(smi.value(), d);
return smi;
}
InstructionSelector::InstructionSelector(
Zone* zone, size_t node_count, Linkage* linkage,
InstructionSequence* sequence, Schedule* schedule,
......@@ -501,11 +509,17 @@ InstructionOperand OperandForDeopt(Isolate* isolate, OperandGenerator* g,
switch (input->opcode()) {
case IrOpcode::kInt32Constant:
case IrOpcode::kInt64Constant:
case IrOpcode::kNumberConstant:
case IrOpcode::kFloat32Constant:
case IrOpcode::kFloat64Constant:
case IrOpcode::kDelayedStringConstant:
return g->UseImmediate(input);
case IrOpcode::kNumberConstant:
if (rep == MachineRepresentation::kWord32) {
Smi smi = NumberConstantToSmi(input);
return g->UseImmediate(static_cast<int32_t>(smi.ptr()));
} else {
return g->UseImmediate(input);
}
case IrOpcode::kCompressedHeapConstant:
case IrOpcode::kHeapConstant: {
if (!CanBeTaggedOrCompressedPointer(rep)) {
......
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