Revision: 2693
Author: [email protected]
Date: Mon Aug 17 01:02:07 2009
Log: X64: Do not use an AllocateWithoutSpill register if it is invalid.   
Abandoned in favor of approach in  
http://codereview.chromium.org/165525/show (Issue 165526)
Review URL: http://codereview.chromium.org/164480
http://code.google.com/p/v8/source/detail?r=2693

Modified:
  /branches/bleeding_edge/src/x64/codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Thu Aug 13 01:00:04 2009
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Mon Aug 17 01:02:07 2009
@@ -3084,25 +3084,35 @@
                                                    is_increment);
      }

+    // If we have a free register, combine the smi and overflow checks.
      Result tmp = allocator_->AllocateWithoutSpilling();
      ASSERT(kSmiTagMask == 1 && kSmiTag == 0);
-    __ movl(tmp.reg(), Immediate(kSmiTagMask));
-    // Smi test.
+    if (tmp.is_valid()) {
+      __ movl(tmp.reg(), Immediate(kSmiTagMask));
+    }
+
+    // Try incrementing or decrementing the smi.
      __ movq(kScratchRegister, new_value.reg());
      if (is_increment) {
        __ addl(kScratchRegister, Immediate(Smi::FromInt(1)));
      } else {
        __ subl(kScratchRegister, Immediate(Smi::FromInt(1)));
      }
-    // deferred->Branch(overflow);
-    __ cmovl(overflow, kScratchRegister, tmp.reg());
-    __ testl(kScratchRegister, tmp.reg());
-    tmp.Unuse();
-    deferred->Branch(not_zero);
-    __ movq(new_value.reg(), kScratchRegister);
-
-    deferred->BindExit();
-
+
+    // Go to the deferred case if the result overflows or is non-smi.
+    if (tmp.is_valid()){
+      __ cmovl(overflow, kScratchRegister, tmp.reg());
+      __ testl(kScratchRegister, tmp.reg());
+      tmp.Unuse();
+      deferred->Branch(not_zero);
+    } else {
+      deferred->Branch(overflow);
+      __ testl(kScratchRegister, Immediate(kSmiTagMask));
+      deferred->Branch(not_zero);
+    }
+
+    __ movq(new_value.reg(), kScratchRegister);
+    deferred->BindExit();

      // Postfix: store the old value in the allocated slot under the
      // reference.

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to