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

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

Issue 1234833003: Debugger: use debug break slots to break at function exit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix for arm Created 5 years, 5 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/mips/assembler-mips-inl.h ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/debug-mips.cc
diff --git a/src/mips/debug-mips.cc b/src/mips/debug-mips.cc
index daadc82511aa2ac0332eec0d45b6219b16486ee7..3620bbebdef6bf04261fa70836304b31ba6f575a 100644
--- a/src/mips/debug-mips.cc
+++ b/src/mips/debug-mips.cc
@@ -14,34 +14,39 @@
namespace v8 {
namespace internal {
-void BreakLocation::SetDebugBreakAtReturn() {
- // Mips return sequence:
- // mov sp, fp
- // lw fp, sp(0)
- // lw ra, sp(4)
- // addiu sp, sp, 8
- // addiu sp, sp, N
- // jr ra
- // nop (in branch delay slot)
-
- // Make sure this constant matches the number if instrucntions we emit.
- DCHECK(Assembler::kJSReturnSequenceInstructions == 7);
- CodePatcher patcher(pc(), Assembler::kJSReturnSequenceInstructions);
- // li and Call pseudo-instructions emit two instructions each.
- patcher.masm()->li(v8::internal::t9, Operand(reinterpret_cast<int32_t>(
- debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry())));
- patcher.masm()->Call(v8::internal::t9);
- patcher.masm()->nop();
- patcher.masm()->nop();
- patcher.masm()->nop();
+#define __ ACCESS_MASM(masm)
+
- // TODO(mips): Open issue about using breakpoint instruction instead of nops.
- // patcher.masm()->bkpt(0);
+void EmitDebugBreakSlot(MacroAssembler* masm) {
+ Label check_size;
+ __ bind(&check_size);
+ for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
+ __ nop(MacroAssembler::DEBUG_BREAK_NOP);
+ }
+ DCHECK_EQ(Assembler::kDebugBreakSlotInstructions,
+ masm->InstructionsGeneratedSince(&check_size));
}
-void BreakLocation::SetDebugBreakAtSlot() {
- DCHECK(IsDebugBreakSlot());
+void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode,
+ int call_argc) {
+ // Generate enough nop's to make space for a call instruction. Avoid emitting
+ // the trampoline pool in the debug break slot code.
+ Assembler::BlockTrampolinePoolScope block_pool(masm);
+ masm->RecordDebugBreakSlot(mode, call_argc);
+ EmitDebugBreakSlot(masm);
+}
+
+
+void DebugCodegen::ClearDebugBreakSlot(Address pc) {
+ CodePatcher patcher(pc, Assembler::kDebugBreakSlotInstructions);
+ EmitDebugBreakSlot(patcher.masm());
+}
+
+
+void DebugCodegen::PatchDebugBreakSlot(Address pc, Handle<Code> code) {
+ DCHECK_EQ(Code::BUILTIN, code->kind());
+ CodePatcher patcher(pc, Assembler::kDebugBreakSlotInstructions);
// Patch the code changing the debug break slot code from:
// nop(DEBUG_BREAK_NOP) - nop(1) is sll(zero_reg, zero_reg, 1)
// nop(DEBUG_BREAK_NOP)
@@ -50,18 +55,15 @@ void BreakLocation::SetDebugBreakAtSlot() {
// to a call to the debug break slot code.
// li t9, address (lui t9 / ori t9 instruction pair)
// call t9 (jalr t9 / nop instruction pair)
- CodePatcher patcher(pc(), Assembler::kDebugBreakSlotInstructions);
- patcher.masm()->li(v8::internal::t9, Operand(reinterpret_cast<int32_t>(
- debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry())));
+ patcher.masm()->li(v8::internal::t9,
+ Operand(reinterpret_cast<int32_t>(code->entry())));
patcher.masm()->Call(v8::internal::t9);
}
-#define __ ACCESS_MASM(masm)
-
-
-static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
- RegList object_regs) {
+void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
+ DebugBreakCallHelperMode mode) {
+ __ RecordComment("Debug break");
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -75,35 +77,23 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
__ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
__ push(at);
- // 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.
- DCHECK((object_regs & ~kJSCallerSaved) == 0);
- if (object_regs != 0) {
- __ MultiPush(object_regs);
- }
+ if (mode == SAVE_RESULT_REGISTER) __ push(v0);
-#ifdef DEBUG
- __ RecordComment("// Calling from debug break to runtime - come in - over");
-#endif
__ PrepareCEntryArgs(0); // No arguments.
__ PrepareCEntryFunction(ExternalReference::debug_break(masm->isolate()));
CEntryStub ceb(masm->isolate(), 1);
__ CallStub(&ceb);
- // Restore the register values from the expression stack.
- if (object_regs != 0) {
- __ MultiPop(object_regs);
- }
- for (int i = 0; i < kNumJSCallerSaved; i++) {
- int r = JSCallerSavedCode(i);
- Register reg = {r};
- if (FLAG_debug_code && ((object_regs & (1 << r)) == 0)) {
+ if (FLAG_debug_code) {
+ for (int i = 0; i < kNumJSCallerSaved; i++) {
+ Register reg = {JSCallerSavedCode(i)};
__ li(reg, kDebugZapValue);
}
}
+ if (mode == SAVE_RESULT_REGISTER) __ pop(v0);
+
// Don't bother removing padding bytes pushed on the stack
// as the frame is going to be restored right away.
@@ -121,38 +111,6 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
}
-void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
- // In places other than IC call sites it is expected that v0 is TOS which
- // is an object - this is not generally the case so this should be used with
- // care.
- Generate_DebugBreakCallHelper(masm, v0.bit());
-}
-
-
-void DebugCodegen::GenerateSlot(MacroAssembler* masm,
- DebugCodegen::SlotLocation location,
- int call_argc) {
- // Generate enough nop's to make space for a call instruction. Avoid emitting
- // the trampoline pool in the debug break slot code.
- Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
- Label check_codesize;
- __ bind(&check_codesize);
- RecordRelocInfo(masm, location, call_argc);
- for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
- __ nop(MacroAssembler::DEBUG_BREAK_NOP);
- }
- DCHECK_EQ(Assembler::kDebugBreakSlotInstructions,
- masm->InstructionsGeneratedSince(&check_codesize));
-}
-
-
-void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) {
- // In the places where a debug break slot is inserted no registers can contain
- // object pointers.
- Generate_DebugBreakCallHelper(masm, 0);
-}
-
-
void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) {
__ Ret();
}
« no previous file with comments | « src/mips/assembler-mips-inl.h ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698