Author: kmilli...@chromium.org
Date: Wed Jun 10 05:41:57 2009
New Revision: 2134

Modified:
    branches/bleeding_edge/src/ia32/codegen-ia32.cc
    branches/bleeding_edge/test/mjsunit/smi-ops.js

Log:
Fix a bug when shifting left by zero.  Ensure that the left operand is
writable (non-aliased) so it can be used for the result in the slow
case.

Review URL: http://codereview.chromium.org/118496

Modified: branches/bleeding_edge/src/ia32/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/ia32/codegen-ia32.cc     (original)
+++ branches/bleeding_edge/src/ia32/codegen-ia32.cc     Wed Jun 10 05:41:57 2009
@@ -1691,6 +1691,8 @@
          int shift_value = int_value & 0x1f;
          operand->ToRegister();
          if (shift_value == 0) {
+          // Spill operand so it can be overwritten in the slow case.
+          frame_->Spill(operand->reg());
            DeferredInlineSmiOperation* deferred =
                new DeferredInlineSmiOperation(op,
                                               operand->reg(),

Modified: branches/bleeding_edge/test/mjsunit/smi-ops.js
==============================================================================
--- branches/bleeding_edge/test/mjsunit/smi-ops.js      (original)
+++ branches/bleeding_edge/test/mjsunit/smi-ops.js      Wed Jun 10 05:41:57 2009
@@ -585,3 +585,10 @@
  }

  testShiftNonSmis();
+
+
+// Verify that we handle the (optimized) corner case of shifting by
+// zero even for non-smis.
+function shiftByZero(n) { return n << 0; }
+
+assertEquals(3, shiftByZero(3.1415));

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to