From 0af94e4ac4504e00c4300156ca78faafe83f6d5f Mon Sep 17 00:00:00 2001 From: "titzer@chromium.org" Date: Tue, 30 Jul 2013 13:30:03 +0000 Subject: [PATCH] Don't generate a shift left by one if can deoptimize on ia32 and arm and mips. BUG= R=verwaest@chromium.org Review URL: https://codereview.chromium.org/21196006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15958 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-codegen-arm.cc | 4 +++- src/ia32/lithium-codegen-ia32.cc | 4 +++- src/mips/lithium-codegen-mips.cc | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 929d04d..5f5ce07 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -1744,7 +1744,9 @@ void LCodeGen::DoShiftI(LShiftI* instr) { if (shift_count != 0) { if (instr->hydrogen_value()->representation().IsSmi() && instr->can_deopt()) { - __ mov(result, Operand(left, LSL, shift_count - 1)); + if (shift_count != 1) { + __ mov(result, Operand(left, LSL, shift_count - 1)); + } __ SmiTag(result, result, SetCC); DeoptimizeIf(vs, instr->environment()); } else { diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 3ddad06..a21a965 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -1771,7 +1771,9 @@ void LCodeGen::DoShiftI(LShiftI* instr) { if (shift_count != 0) { if (instr->hydrogen_value()->representation().IsSmi() && instr->can_deopt()) { - __ shl(ToRegister(left), shift_count - 1); + if (shift_count != 1) { + __ shl(ToRegister(left), shift_count - 1); + } __ SmiTag(ToRegister(left)); DeoptimizeIf(overflow, instr->environment()); } else { diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 8db5f00..4fa0ac4 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -1583,7 +1583,9 @@ void LCodeGen::DoShiftI(LShiftI* instr) { if (shift_count != 0) { if (instr->hydrogen_value()->representation().IsSmi() && instr->can_deopt()) { - __ sll(result, left, shift_count - 1); + if (shift_count != 1) { + __ sll(result, left, shift_count - 1); + } __ SmiTagCheckOverflow(result, result, scratch); DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); } else { -- 2.7.4