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

Unified Diff: src/ia32/debug-ia32.cc

Issue 3141047: Cleanup the way the debugger stores live registers when entering at a break... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/frames-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/debug-ia32.cc
===================================================================
--- src/ia32/debug-ia32.cc (revision 5352)
+++ src/ia32/debug-ia32.cc (working copy)
@@ -94,22 +94,33 @@
static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
- RegList pointer_regs,
+ RegList object_regs,
+ RegList non_object_regs,
bool convert_call_to_jmp) {
- // Save the content of all general purpose registers in memory. This copy in
- // memory is later pushed onto the JS expression stack for the fake JS frame
- // generated and also to the C frame generated on top of that. In the JS
- // frame ONLY the registers containing pointers will be pushed on the
- // expression stack. This causes the GC to update these pointers so that
- // they will have the correct value when returning from the debugger.
- __ SaveRegistersToMemory(kJSCallerSaved);
-
// Enter an internal frame.
__ EnterInternalFrame();
- // Store the registers containing object pointers on the expression stack to
- // make sure that these are correctly updated during GC.
- __ PushRegistersFromMemory(pointer_regs);
+ // Store the registers containing live values on the expression stack to
+ // make sure that these are correctly updated during GC. Non object values
+ // are stored as a smi causing it to be untouched by GC.
+ ASSERT((object_regs & ~kJSCallerSaved) == 0);
+ ASSERT((non_object_regs & ~kJSCallerSaved) == 0);
+ ASSERT((object_regs & non_object_regs) == 0);
+ for (int i = 0; i < kNumJSCallerSaved; i++) {
+ int r = JSCallerSavedCode(i);
+ Register reg = { r };
+ if ((object_regs & (1 << r)) != 0) {
+ __ push(reg);
+ }
+ if ((non_object_regs & (1 << r)) != 0) {
+ if (FLAG_debug_code) {
+ __ test(reg, Immediate(0xc0000000));
+ __ Assert(zero, "Unable to encode value as smi");
+ }
+ __ SmiTag(reg);
+ __ push(reg);
+ }
+ }
#ifdef DEBUG
__ RecordComment("// Calling from debug break to runtime - come in - over");
@@ -117,12 +128,25 @@
__ Set(eax, Immediate(0)); // no arguments
__ mov(ebx, Immediate(ExternalReference::debug_break()));
- CEntryStub ceb(1, ExitFrame::MODE_DEBUG);
+ CEntryStub ceb(1);
__ CallStub(&ceb);
// Restore the register values containing object pointers from the expression
- // stack in the reverse order as they where pushed.
- __ PopRegistersToMemory(pointer_regs);
+ // stack.
+ for (int i = kNumJSCallerSaved; --i >= 0;) {
+ int r = JSCallerSavedCode(i);
+ Register reg = { r };
+ if (FLAG_debug_code) {
+ __ Set(reg, Immediate(kDebugZapValue));
+ }
+ if ((object_regs & (1 << r)) != 0) {
+ __ pop(reg);
+ }
+ if ((non_object_regs & (1 << r)) != 0) {
+ __ pop(reg);
+ __ SmiUntag(reg);
+ }
+ }
// Get rid of the internal frame.
__ LeaveInternalFrame();
@@ -130,12 +154,9 @@
// If this call did not replace a call but patched other code then there will
// be an unwanted return address left on the stack. Here we get rid of that.
if (convert_call_to_jmp) {
- __ pop(eax);
+ __ add(Operand(esp), Immediate(kPointerSize));
}
- // Finally restore all registers.
- __ RestoreRegistersFromMemory(kJSCallerSaved);
-
// Now that the break point has been handled, resume normal execution by
// jumping to the target address intended by the caller and that was
// overwritten by the address of DebugBreakXXX.
@@ -151,7 +172,7 @@
// -- eax : receiver
// -- ecx : name
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit() | ecx.bit(), false);
+ Generate_DebugBreakCallHelper(masm, eax.bit() | ecx.bit(), 0, false);
}
@@ -162,7 +183,8 @@
// -- ecx : name
// -- edx : receiver
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit() | ecx.bit() | edx.bit(), false);
+ Generate_DebugBreakCallHelper(
+ masm, eax.bit() | ecx.bit() | edx.bit(), 0, false);
}
@@ -172,7 +194,7 @@
// -- edx : receiver
// -- eax : key
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit() | edx.bit(), false);
+ Generate_DebugBreakCallHelper(masm, eax.bit() | edx.bit(), 0, false);
}
@@ -183,7 +205,8 @@
// -- ecx : key
// -- edx : receiver
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit() | ecx.bit() | edx.bit(), false);
+ Generate_DebugBreakCallHelper(
+ masm, eax.bit() | ecx.bit() | edx.bit(), 0, false);
}
@@ -192,7 +215,7 @@
// ----------- S t a t e -------------
// -- ecx: name
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, ecx.bit(), false);
+ Generate_DebugBreakCallHelper(masm, ecx.bit(), 0, false);
}
@@ -201,10 +224,11 @@
// eax is the actual number of arguments not encoded as a smi see comment
// above IC call.
// ----------- S t a t e -------------
- // -- eax: number of arguments
+ // -- eax: number of arguments (not smi)
+ // -- edi: constructor function
// -----------------------------------
// The number of arguments in eax is not smi encoded.
- Generate_DebugBreakCallHelper(masm, 0, false);
+ Generate_DebugBreakCallHelper(masm, edi.bit(), eax.bit(), false);
}
@@ -213,7 +237,7 @@
// ----------- S t a t e -------------
// -- eax: return value
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit(), true);
+ Generate_DebugBreakCallHelper(masm, eax.bit(), 0, true);
}
@@ -222,7 +246,7 @@
// ----------- S t a t e -------------
// No registers used on entry.
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, 0, false);
+ Generate_DebugBreakCallHelper(masm, 0, 0, false);
}
@@ -242,7 +266,7 @@
void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) {
// In the places where a debug break slot is inserted no registers can contain
// object pointers.
- Generate_DebugBreakCallHelper(masm, 0, true);
+ Generate_DebugBreakCallHelper(masm, 0, 0, true);
}
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/frames-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698