Index: src/compiler/effect-control-linearizer.cc |
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc |
index bc24a30968f5671c31d38fb928a128e77153c93d..301061d3fdcb7aae7cc56c0aaa054b888b0d3aea 100644 |
--- a/src/compiler/effect-control-linearizer.cc |
+++ b/src/compiler/effect-control-linearizer.cc |
@@ -633,6 +633,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node, |
case IrOpcode::kChangeTaggedToFloat64: |
result = LowerChangeTaggedToFloat64(node); |
break; |
+ case IrOpcode::kChangeTaggedToTaggedSigned: |
+ result = LowerChangeTaggedToTaggedSigned(node); |
+ break; |
case IrOpcode::kTruncateTaggedToBit: |
result = LowerTruncateTaggedToBit(node); |
break; |
@@ -1032,6 +1035,27 @@ Node* EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node) { |
return LowerTruncateTaggedToFloat64(node); |
} |
+Node* EffectControlLinearizer::LowerChangeTaggedToTaggedSigned(Node* node) { |
+ Node* value = node->InputAt(0); |
+ |
+ auto if_not_smi = __ MakeDeferredLabel<1>(); |
+ auto done = __ MakeLabel<2>(MachineRepresentation::kWord32); |
+ |
+ Node* check = ObjectIsSmi(value); |
+ __ GotoUnless(check, &if_not_smi); |
+ __ Goto(&done, value); |
+ |
+ __ Bind(&if_not_smi); |
+ STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); |
+ Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value); |
+ vfalse = __ ChangeFloat64ToInt32(vfalse); |
+ vfalse = ChangeInt32ToSmi(vfalse); |
+ __ Goto(&done, vfalse); |
+ |
+ __ Bind(&done); |
+ return done.PhiAt(0); |
+} |
+ |
Node* EffectControlLinearizer::LowerTruncateTaggedToFloat64(Node* node) { |
Node* value = node->InputAt(0); |