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

Unified Diff: src/macro-assembler-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/macro-assembler-arm.cc
===================================================================
--- src/macro-assembler-arm.cc (revision 353)
+++ src/macro-assembler-arm.cc (working copy)
@@ -258,7 +258,7 @@
}
-void MacroAssembler::ExitInternalFrame() {
+void MacroAssembler::LeaveInternalFrame() {
// r0: preserved
// r1: preserved
// r2: preserved
@@ -270,6 +270,58 @@
}
+void MacroAssembler::EnterExitFrame(StackFrame::Type type) {
+ ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG);
+ // 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;
+ add(ip, sp, Operand(r0, LSL, kPointerSizeLog2));
+
+ // Push in reverse order: caller_fp, sp_on_exit, and caller_pc.
+ stm(db_w, sp, fp.bit() | ip.bit() | lr.bit());
+ mov(fp, Operand(sp)); // setup new frame pointer
+
+ // Push debug marker.
+ mov(ip, Operand(type == StackFrame::EXIT_DEBUG ? 1 : 0));
+ push(ip);
+
+ // Save the frame pointer and the context in top.
+ mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address)));
+ str(fp, MemOperand(ip));
+ mov(ip, Operand(ExternalReference(Top::k_context_address)));
+ str(cp, MemOperand(ip));
+
+ // Setup argc and the builtin function in callee-saved registers.
+ mov(r4, Operand(r0));
+ mov(r5, Operand(r1));
+
+ // Compute the argv pointer and keep it in a callee-saved register.
+ add(r6, fp, Operand(r4, LSL, kPointerSizeLog2));
+ add(r6, r6, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize));
+}
+
+
+void MacroAssembler::LeaveExitFrame() {
+ // Clear top frame.
+ mov(r3, Operand(0));
+ mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address)));
+ str(r3, MemOperand(ip));
+
+ // Restore current context from top and clear it in debug mode.
+ mov(ip, Operand(ExternalReference(Top::k_context_address)));
+ ldr(cp, MemOperand(ip));
+ if (kDebug) {
+ str(r3, MemOperand(ip));
+ }
+
+ // Pop the arguments, restore registers, and return.
+ mov(sp, Operand(fp)); // respect ABI stack constraint
+ ldm(ia, sp, fp.bit() | sp.bit() | pc.bit());
+}
+
+
void MacroAssembler::InvokePrologue(const ParameterCount& expected,
const ParameterCount& actual,
Handle<Code> code_constant,
« src/codegen-ia32.cc ('K') | « src/macro-assembler-arm.h ('k') | src/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698