Reviewers: balazs.kilvady, akos.palfi.imgtec, ilija.pavlovic_imgtec.com,

Message:
PTAL, this is first step in getting some callee-saved regs into our register
allocator list, for use in interpreter. MIPS64 port still to come.

Description:
MIPS: Tweak CEntryStub to free up callee-saved regs s0-s2.

BUG=

Please review this at https://codereview.chromium.org/1263723002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+13, -18 lines):
  M src/mips/code-stubs-mips.cc


Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 5ebb70ed8bc6b41a73196ceb006bf8174733e854..7d3d12436eee67ea3f4f0309e11964ea309de074 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -1070,24 +1070,20 @@ void CEntryStub::Generate(MacroAssembler* masm) {

   ProfileEntryHookStub::MaybeCallEntryHook(masm);

-  // Compute the argv pointer in a callee-saved register.
-  __ sll(s1, a0, kPointerSizeLog2);
-  __ Addu(s1, sp, s1);
-  __ Subu(s1, s1, kPointerSize);
+  __ mov(t9, a1);  // Function pointer to t9 to conform to ABI for PIC.
+  // Compute the argv pointer in a1.
+  __ sll(a1, a0, kPointerSizeLog2);
+  __ Addu(a1, sp, a1);
+  __ Subu(a1, a1, kPointerSize);

   // Enter the exit frame that transitions from JavaScript to C++.
   FrameScope scope(masm, StackFrame::MANUAL);
   __ EnterExitFrame(save_doubles());

-  // s0: number of arguments  including receiver (C callee-saved)
-  // s1: pointer to first argument (C callee-saved)
-  // s2: pointer to builtin function (C callee-saved)
-
-  // Prepare arguments for C routine.
-  // a0 = argc
-  __ mov(s0, a0);
-  __ mov(s2, a1);
-  // a1 = argv (set in the delay slot after find_ra below).
+  // argc will be saved in s5 (callee-saved) in delay-slot of bal() below.
+  // a0, s5: number of arguments including receiver.
+  // a1: pointer to the first argument.
+  // t9: pointer to builtin function.

// We are calling compiled C/C++ code. a0 and a1 hold our two arguments. We
   // also need to reserve the 4 argument slots on the stack.
@@ -1107,20 +1103,19 @@ void CEntryStub::Generate(MacroAssembler* masm) {
     // coverage code can interfere with the proper calculation of ra.
     Label find_ra;
     masm->bal(&find_ra);  // bal exposes branch delay slot.
-    masm->mov(a1, s1);
+    masm->mov(s5, a0);    // Save argc for LeaveExitFrame() below.
     masm->bind(&find_ra);

     // Adjust the value in ra to point to the correct return location, 2nd
// instruction past the real call into C code (the jalr(t9)), and push it.
     // This is the return address of the exit frame.
-    const int kNumInstructionsToJump = 5;
+    const int kNumInstructionsToJump = 4;
     masm->Addu(ra, ra, kNumInstructionsToJump * kPointerSize);
masm->sw(ra, MemOperand(sp)); // This spot was reserved in EnterExitFrame.
     // Stack space reservation moved to the branch delay slot below.
     // Stack is still aligned.

     // Call the C routine.
- masm->mov(t9, s2); // Function pointer to t9 to conform to ABI for PIC.
     masm->jalr(t9);
     // Set up sp in the delay slot.
     masm->addiu(sp, sp, -kCArgsSlotsSize);
@@ -1154,8 +1149,8 @@ void CEntryStub::Generate(MacroAssembler* masm) {
   // v0:v1: result
   // sp: stack pointer
   // fp: frame pointer
-  // s0: still holds argc (callee-saved).
-  __ LeaveExitFrame(save_doubles(), s0, true, EMIT_RETURN);
+  // s5: still holds argc (callee-saved).
+  __ LeaveExitFrame(save_doubles(), s5, true, EMIT_RETURN);

   // Handling of exception.
   __ bind(&exception_returned);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to