Reviewers: William Hesse,

Message:
Small review.

Description:
X64: Fix bug in RandomPositiveSmi (doesn't save rsi before calling
C-code).

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

Affected files:
   M src/x64/codegen-x64.cc


Index: src/x64/codegen-x64.cc
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
index  
e74d58fb60ea943efaefddd17882d0c86bf02e07..1680c67b4280de8c9e6161557600ebe204883c4e
  
100644
--- a/src/x64/codegen-x64.cc
+++ b/src/x64/codegen-x64.cc
@@ -3442,11 +3442,14 @@ void  
CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) {
      __ movq(rbx, rsp);  // Save in AMD-64 abi callee-saved register.
      __ and_(rsp, Immediate(-kFrameAlignment));
    }
+  // rsi register is caller-save.
+  __ movq(r12, rsi);  // Save in callee-saved register.

    // Call V8::RandomPositiveSmi().
    __ Call(FUNCTION_ADDR(V8::RandomPositiveSmi), RelocInfo::RUNTIME_ENTRY);

-  // Restore stack pointer from callee-saved register edi.
+  __ movq(rsi, r12);
+  // Restore stack pointer from callee-saved register.
    if (kFrameAlignment > 0) {
      __ movq(rsp, rbx);
    }
@@ -6807,6 +6810,7 @@ void  
FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm) {
    __ bind(&done);
  }

+
  void FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm,
                                              Register lhs,
                                              Register rhs) {
@@ -6841,6 +6845,7 @@ void  
FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm,
    __ bind(&done);
  }

+
  void FloatingPointHelper::CheckFloatOperands(MacroAssembler* masm,
                                               Label* non_float) {
    Label test_other, done;
@@ -6878,6 +6883,7 @@ const char* GenericBinaryOpStub::GetName() {
    }
  }

+
  void GenericBinaryOpStub::GenerateSmiCode(MacroAssembler* masm, Label*  
slow) {
    // Perform fast-case smi code for the operation (rax <op> rbx) and
    // leave result in register rax.
@@ -7018,7 +7024,6 @@ void  
GenericBinaryOpStub::GenerateSmiCode(MacroAssembler* masm, Label* slow) {

  void GenericBinaryOpStub::Generate(MacroAssembler* masm) {
    Label call_runtime;
-
    if (flags_ == SMI_CODE_IN_STUB) {
      // The fast case smi code wasn't inlined in the stub caller
      // code. Generate it here to speed up common operations.



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

Reply via email to