| Index: src/a64/lithium-a64.cc
|
| diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
|
| index e85059243bd0c344486426d97e7ac1b672d4f7a2..6ae391a925ad5d244f1fd2ab4d0bd4a019b32c89 100644
|
| --- a/src/a64/lithium-a64.cc
|
| +++ b/src/a64/lithium-a64.cc
|
| @@ -2272,11 +2272,9 @@ LInstruction* LChunkBuilder::DoStringCompareAndBranch(
|
|
|
|
|
| LInstruction* LChunkBuilder::DoSub(HSub* instr) {
|
| - // TODO(jbramley): Add smi support.
|
| - if (instr->representation().IsInteger32()) {
|
| - ASSERT(instr->left()->representation().IsInteger32());
|
| - ASSERT(instr->right()->representation().IsInteger32());
|
| -
|
| + if (instr->representation().IsSmiOrInteger32()) {
|
| + ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| + ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| LOperand *left;
|
| if (instr->left()->IsConstant() &&
|
| (HConstant::cast(instr->left())->Integer32Value() == 0)) {
|
| @@ -2285,8 +2283,9 @@ LInstruction* LChunkBuilder::DoSub(HSub* instr) {
|
| left = UseRegisterAtStart(instr->left());
|
| }
|
| LOperand* right = UseRegisterOrConstantAtStart(instr->right());
|
| - LSubI* sub = new(zone()) LSubI(left, right);
|
| - LInstruction* result = DefineAsRegister(sub);
|
| + LInstruction* result = instr->representation().IsSmi() ?
|
| + DefineAsRegister(new(zone()) LSubS(left, right)) :
|
| + DefineAsRegister(new(zone()) LSubI(left, right));
|
| if (instr->CheckFlag(HValue::kCanOverflow)) {
|
| result = AssignEnvironment(result);
|
| }
|
|
|