Reviewers: Toon Verwaest,

Description:
Don't generate a shift left by one if can deoptimize on ia32 and arm and mips.

BUG=

Please review this at https://codereview.chromium.org/21196006/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/lithium-codegen-arm.cc
  M src/ia32/lithium-codegen-ia32.cc
  M src/mips/lithium-codegen-mips.cc


Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 929d04de13aa693065ad37067d8645266eed2300..5f5ce07476b8fede0643f56f7395e731a1001efb 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 {
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 3ddad068bfdfc0454442a87e3fd964269d5e6298..a21a96575bf8f9c9fa8affe63aa0deca575c3cbe 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 {
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 8db5f00fbffc9ad801d389ec6e2c32c8cf958051..4fa0ac44553d69e4a2781d41fa1dce281cbc8d74 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 {


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to