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

Unified Diff: src/codegen-ia32.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-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 353)
+++ src/codegen-ia32.cc (working copy)
@@ -5258,12 +5258,8 @@
}
// Call C function.
- __ lea(eax, Operand(ebp,
- edi,
- times_4,
- StandardFrameConstants::kCallerSPOffset - kPointerSize));
__ mov(Operand(esp, 0 * kPointerSize), edi); // argc.
- __ mov(Operand(esp, 1 * kPointerSize), eax); // argv.
+ __ mov(Operand(esp, 1 * kPointerSize), esi); // argv.
iposva 2008/09/23 07:51:28 Please add the definition of esi to the contract a
__ call(Operand(ebx));
// Result is in eax or edx:eax - do not destroy these registers!
@@ -5275,11 +5271,6 @@
__ test(ecx, Immediate(kFailureTagMask));
__ j(zero, &failure_returned, not_taken);
- // Restore number of arguments to ecx and clear top frame.
- __ mov(ecx, Operand(edi));
- ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
- __ mov(Operand::StaticVariable(c_entry_fp_address), Immediate(0));
-
// Restore the memory copy of the registers by digging them out from
// the stack.
if (do_restore) {
@@ -5288,25 +5279,11 @@
const int kCallerSavedSize = kNumJSCallerSaved * kPointerSize;
int kOffset = ExitFrameConstants::kDebugMarkOffset - kCallerSavedSize;
__ lea(ebx, Operand(ebp, kOffset));
- __ CopyRegistersFromStackToMemory(ebx, edi, kJSCallerSaved);
+ __ CopyRegistersFromStackToMemory(ebx, ecx, kJSCallerSaved);
}
// Exit C frame.
- __ lea(esp, Operand(ebp, -1 * kPointerSize));
- __ pop(ebx);
- __ pop(ebp);
-
- // Restore current context from top and clear it in debug mode.
- ExternalReference context_address(Top::k_context_address);
- __ mov(esi, Operand::StaticVariable(context_address));
- if (kDebug) {
- __ mov(Operand::StaticVariable(context_address), Immediate(0));
- }
-
- // Pop arguments from caller's stack and return.
- __ pop(ebx); // Ok to clobber ebx - function pointer not needed anymore.
- __ lea(esp, Operand(esp, ecx, times_4, 0));
- __ push(ebx);
+ __ LeaveExitFrame();
__ ret(0);
// Handling of Failure.
@@ -5406,25 +5383,12 @@
// this by performing a garbage collection and retrying the
// builtin once.
- // Enter C frame.
- // Here we make the following assumptions and use them when setting
- // up the top-most Frame. Adjust the code if these assumptions
- // change.
- ASSERT(ExitFrameConstants::kPPDisplacement == +2 * kPointerSize);
- ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize);
- ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize);
- ASSERT(ExitFrameConstants::kSPOffset == -2 * kPointerSize);
- __ push(ebp); // caller fp
- __ mov(ebp, Operand(esp)); // C entry fp
- __ push(ebx); // C function
- __ push(Immediate(0)); // saved entry sp, set before call
- __ push(Immediate(is_debug_break ? 1 : 0));
+ StackFrame::Type frame_type = is_debug_break ?
+ StackFrame::EXIT_DEBUG :
+ StackFrame::EXIT;
- // Remember top frame.
- ExternalReference c_entry_fp(Top::k_c_entry_fp_address);
- ExternalReference context_address(Top::k_context_address);
- __ mov(Operand::StaticVariable(c_entry_fp), ebp);
- __ mov(Operand::StaticVariable(context_address), esi);
+ // Enter the exit frame that transitions from JavaScript to C++.
+ __ EnterExitFrame(frame_type);
if (is_debug_break) {
// Save the state of all registers to the stack from the memory
@@ -5439,10 +5403,6 @@
__ PushRegistersFromMemory(kJSCallerSaved);
}
- // Move number of arguments (argc) into callee-saved register. Note
- // that edi is only available after remembering the top frame.
- __ mov(edi, Operand(eax));
-
// Allocate stack space for 2 arguments (argc, argv).
GenerateReserveCParameterSpace(masm, 2);
__ mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); // save entry sp
« src/codegen-arm.cc ('K') | « src/codegen-arm.cc ('k') | src/frames-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698