Revision: 12226
Author:   [email protected]
Date:     Mon Jul 30 06:04:10 2012
Log:      [email protected],[email protected]
x64 BinaryOpStub::GenerateSmiCode use wrong registers in one code path.

e.g. d8 --trace_ic
var dd = new Float64Array(2);
dd[1] = 1;
(function fn() {
  for (var i = 0; i < 1000; i++)
  dd[0] = 2 / dd[1];
})();
It keeps falling into runtime call and patching.

No regression test, because I don't how to test it.

Review URL: https://chromiumcodereview.appspot.com/10834064
Patch from Zheng Liu <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12226

Modified:
 /branches/bleeding_edge/src/x64/code-stubs-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Jul 17 08:18:15 2012 +++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Mon Jul 30 06:04:10 2012
@@ -1080,8 +1080,8 @@
     SmiCodeGenerateHeapNumberResults allow_heapnumber_results) {

   // Arguments to BinaryOpStub are in rdx and rax.
-  Register left = rdx;
-  Register right = rax;
+  const Register left = rdx;
+  const Register right = rax;

   // We only generate heapnumber answers for overflowing calculations
   // for the four basic arithmetic operations and logical right shift by 0.
@@ -1123,20 +1123,16 @@

     case Token::DIV:
       // SmiDiv will not accept left in rdx or right in rax.
-      left = rcx;
-      right = rbx;
       __ movq(rbx, rax);
       __ movq(rcx, rdx);
-      __ SmiDiv(rax, left, right, &use_fp_on_smis);
+      __ SmiDiv(rax, rcx, rbx, &use_fp_on_smis);
       break;

     case Token::MOD:
       // SmiMod will not accept left in rdx or right in rax.
-      left = rcx;
-      right = rbx;
       __ movq(rbx, rax);
       __ movq(rcx, rdx);
-      __ SmiMod(rax, left, right, &use_fp_on_smis);
+      __ SmiMod(rax, rcx, rbx, &use_fp_on_smis);
       break;

     case Token::BIT_OR: {

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

Reply via email to