| Index: src/arm/debug-arm.cc
|
| diff --git a/src/arm/debug-arm.cc b/src/arm/debug-arm.cc
|
| index c09e17e85901aa4c3e78c697c8528c65733fcc74..05b22e74aa3fea004be7b81c4204be713aac3aeb 100644
|
| --- a/src/arm/debug-arm.cc
|
| +++ b/src/arm/debug-arm.cc
|
| @@ -12,49 +12,62 @@
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -void BreakLocation::SetDebugBreakAtReturn() {
|
| - // Patch the code changing the return from JS function sequence from
|
| - // mov sp, fp
|
| - // ldmia sp!, {fp, lr}
|
| - // add sp, sp, #4
|
| - // bx lr
|
| - // to a call to the debug break return code.
|
| - // ldr ip, [pc, #0]
|
| - // blx ip
|
| - // <debug break return code entry point address>
|
| - // bkpt 0
|
| - CodePatcher patcher(pc(), Assembler::kJSReturnSequenceInstructions);
|
| - patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
|
| - patcher.masm()->blx(v8::internal::ip);
|
| - patcher.Emit(
|
| - debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry());
|
| - patcher.masm()->bkpt(0);
|
| +#define __ ACCESS_MASM(masm)
|
| +
|
| +
|
| +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 constant pool in the debug break slot code.
|
| + Assembler::BlockConstPoolScope block_const_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
|
| // mov r2, r2
|
| // mov r2, r2
|
| // mov r2, r2
|
| + // mov r2, r2
|
| // to a call to the debug break slot code.
|
| // ldr ip, [pc, #0]
|
| - // blx ip
|
| + // b skip
|
| // <debug break slot code entry point address>
|
| - CodePatcher patcher(pc(), Assembler::kDebugBreakSlotInstructions);
|
| - patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
|
| - patcher.masm()->blx(v8::internal::ip);
|
| - patcher.Emit(
|
| - debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry());
|
| + // skip:
|
| + // blx ip
|
| + Label skip_constant;
|
| + patcher.masm()->ldr(ip, MemOperand(v8::internal::pc, 0));
|
| + patcher.masm()->b(&skip_constant);
|
| + patcher.Emit(code->entry());
|
| + patcher.masm()->bind(&skip_constant);
|
| + patcher.masm()->blx(ip);
|
| }
|
|
|
|
|
| -#define __ ACCESS_MASM(masm)
|
| -
|
| -
|
| -static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
|
| - RegList object_regs) {
|
| +void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
|
| + DebugBreakCallHelperMode mode) {
|
| + __ RecordComment("Debug break");
|
| {
|
| FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
|
|
|
| @@ -66,36 +79,23 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
|
| __ mov(ip, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
|
| __ push(ip);
|
|
|
| - // 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) {
|
| - __ stm(db_w, sp, object_regs);
|
| - }
|
| + if (mode == SAVE_RESULT_REGISTER) __ push(r0);
|
|
|
| -#ifdef DEBUG
|
| - __ RecordComment("// Calling from debug break to runtime - come in - over");
|
| -#endif
|
| __ mov(r0, Operand::Zero()); // no arguments
|
| __ mov(r1, Operand(ExternalReference::debug_break(masm->isolate())));
|
|
|
| CEntryStub ceb(masm->isolate(), 1);
|
| __ CallStub(&ceb);
|
|
|
| - // Restore the register values from the expression stack.
|
| - if (object_regs != 0) {
|
| - __ ldm(ia_w, sp, 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)};
|
| __ mov(reg, Operand(kDebugZapValue));
|
| }
|
| }
|
|
|
| + if (mode == SAVE_RESULT_REGISTER) __ pop(r0);
|
| +
|
| // Don't bother removing padding bytes pushed on the stack
|
| // as the frame is going to be restored right away.
|
|
|
| @@ -113,38 +113,6 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
|
| }
|
|
|
|
|
| -void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
|
| - // In places other than IC call sites it is expected that r0 is TOS which
|
| - // is an object - this is not generally the case so this should be used with
|
| - // care.
|
| - Generate_DebugBreakCallHelper(masm, r0.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 constant pool in the debug break slot code.
|
| - Assembler::BlockConstPoolScope block_const_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();
|
| }
|
|
|