Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: src/codegen-arm.cc

Issue 4035: Refactored the code for entering and leaving exit frames (calls... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/codegen-arm.cc
===================================================================
--- src/codegen-arm.cc (revision 353)
+++ src/codegen-arm.cc (working copy)
@@ -1640,11 +1640,9 @@
}
// Call C built-in.
- // r0 = argc.
+ // r0 = argc, r1 = argv
__ mov(r0, Operand(r4));
- // r1 = argv.
- __ add(r1, fp, Operand(r4, LSL, kPointerSizeLog2));
- __ add(r1, r1, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize));
+ __ mov(r1, Operand(r6));
iposva 2008/09/23 07:51:28 Please add r6 to the contract with calling code ab
// TODO(1242173): To let the GC traverse the return address of the exit
// frames, we need to know where the return address is. Right now,
@@ -1671,11 +1669,6 @@
__ tst(r2, Operand(kFailureTagMask));
__ b(eq, &failure_returned);
- // clear top frame
- __ mov(r3, Operand(0));
- __ mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address)));
- __ str(r3, MemOperand(ip));
-
// Restore the memory copy of the registers by digging them out from
// the stack.
if (do_restore) {
@@ -1691,13 +1684,8 @@
// sp: stack pointer
// fp: frame pointer
// pp: caller's parameter pointer pp (restored as C callee-saved)
+ __ LeaveExitFrame();
- // Restore current context from top and clear it in debug mode.
- __ mov(r3, Operand(Top::context_address()));
- __ ldr(cp, MemOperand(r3));
- __ mov(sp, Operand(fp)); // respect ABI stack constraint
- __ ldm(ia, sp, fp.bit() | sp.bit() | pc.bit());
-
// check if we should retry or throw exception
Label retry;
__ bind(&failure_returned);
@@ -1744,42 +1732,19 @@
// this by performing a garbage collection and retrying the
// builtin once.
- // Enter C frame
- // Compute parameter pointer before making changes and save it as ip register
- // so that it is restored as sp register on exit, thereby popping the args.
- // ip = sp + kPointerSize*args_len;
- __ add(ip, sp, Operand(r0, LSL, kPointerSizeLog2));
+ StackFrame::Type frame_type = is_debug_break
+ ? StackFrame::EXIT_DEBUG
+ : StackFrame::EXIT;
- // push in reverse order:
- // caller_fp, sp_on_exit, caller_pc
- __ stm(db_w, sp, fp.bit() | ip.bit() | lr.bit());
- __ mov(fp, Operand(sp)); // setup new frame pointer
+ // Enter the exit frame that transitions from JavaScript to C++.
+ __ EnterExitFrame(frame_type);
- // Store the current context in top.
- __ mov(ip, Operand(ExternalReference(Top::k_context_address)));
- __ str(cp, MemOperand(ip));
-
- // remember top frame
- __ mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address)));
- __ str(fp, MemOperand(ip));
-
- // Push debug marker.
- __ mov(ip, Operand(is_debug_break ? 1 : 0));
- __ push(ip);
-
if (is_debug_break) {
// Save the state of all registers to the stack from the memory location.
// Use sp as base to push.
__ CopyRegistersFromMemoryToStack(sp, kJSCallerSaved);
}
- // move number of arguments (argc) into callee-saved register
- __ mov(r4, Operand(r0));
-
- // move pointer to builtin function into callee-saved register
- __ mov(r5, Operand(r1));
-
- // r0: result parameter for PerformGC, if any (setup below)
// r4: number of arguments
// r5: pointer to builtin function (C callee-saved)
« no previous file with comments | « src/builtins-ia32.cc ('k') | src/codegen-ia32.cc » ('j') | src/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698