Reviewers: Yang, Sven Panne,

Message:
PTAL

Description:

[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.

Please review this at http://codereview.chromium.org/10834064/

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

Affected files:
  M     src/x64/code-stubs-x64.cc


Index: src/x64/code-stubs-x64.cc
===================================================================
--- src/x64/code-stubs-x64.cc   (revision 12223)
+++ src/x64/code-stubs-x64.cc   (working copy)
@@ -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