Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 8f37505527f607eeab6db522f3357bcb342717d7..3c150e21c91d8abc494fdceed031b3801d0c0680 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -1307,7 +1307,13 @@ LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32)); |
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
- LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
+ LOperand* right; |
+ if (SmiValuesAre32Bits() && instr->representation().IsSmi()) { |
+ // We don't support tagged immediates, so we request it in a register. |
+ right = UseRegisterAtStart(instr->BetterRightOperand()); |
+ } else { |
+ right = UseOrConstantAtStart(instr->BetterRightOperand()); |
+ } |
return DefineSameAsFirst(new(zone()) LBitI(left, right)); |
} else { |
return DoArithmeticT(instr->op(), instr); |
@@ -1549,7 +1555,13 @@ LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
DCHECK(instr->left()->representation().Equals(instr->representation())); |
DCHECK(instr->right()->representation().Equals(instr->representation())); |
LOperand* left = UseRegisterAtStart(instr->left()); |
- LOperand* right = UseOrConstantAtStart(instr->right()); |
+ LOperand* right; |
+ if (SmiValuesAre32Bits() && instr->representation().IsSmi()) { |
+ // We don't support tagged immediates, so we request it in a register. |
+ right = UseRegisterAtStart(instr->right()); |
+ } else { |
+ right = UseOrConstantAtStart(instr->right()); |
+ } |
LSubI* sub = new(zone()) LSubI(left, right); |
LInstruction* result = DefineSameAsFirst(sub); |
if (instr->CheckFlag(HValue::kCanOverflow)) { |