diff options
Diffstat (limited to 'deps/v8/src/mips/debug-mips.cc')
-rw-r--r-- | deps/v8/src/mips/debug-mips.cc | 145 |
1 files changed, 82 insertions, 63 deletions
diff --git a/deps/v8/src/mips/debug-mips.cc b/deps/v8/src/mips/debug-mips.cc index fcb5643d1..c421c727d 100644 --- a/deps/v8/src/mips/debug-mips.cc +++ b/deps/v8/src/mips/debug-mips.cc @@ -4,12 +4,12 @@ -#include "v8.h" +#include "src/v8.h" #if V8_TARGET_ARCH_MIPS -#include "codegen.h" -#include "debug.h" +#include "src/codegen.h" +#include "src/debug.h" namespace v8 { namespace internal { @@ -30,7 +30,7 @@ void BreakLocationIterator::SetDebugBreakAtReturn() { // nop (in branch delay slot) // Make sure this constant matches the number if instrucntions we emit. - ASSERT(Assembler::kJSReturnSequenceInstructions == 7); + DCHECK(Assembler::kJSReturnSequenceInstructions == 7); CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); // li and Call pseudo-instructions emit two instructions each. patcher.masm()->li(v8::internal::t9, Operand(reinterpret_cast<int32_t>( @@ -55,20 +55,20 @@ void BreakLocationIterator::ClearDebugBreakAtReturn() { // A debug break in the exit code is identified by the JS frame exit code // having been patched with li/call psuedo-instrunction (liu/ori/jalr). bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { - ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); + DCHECK(RelocInfo::IsJSReturn(rinfo->rmode())); return rinfo->IsPatchedReturnSequence(); } bool BreakLocationIterator::IsDebugBreakAtSlot() { - ASSERT(IsDebugBreakSlot()); + DCHECK(IsDebugBreakSlot()); // Check whether the debug break slot instructions have been patched. return rinfo()->IsPatchedDebugBreakSlotSequence(); } void BreakLocationIterator::SetDebugBreakAtSlot() { - ASSERT(IsDebugBreakSlot()); + DCHECK(IsDebugBreakSlot()); // 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) @@ -85,13 +85,11 @@ void BreakLocationIterator::SetDebugBreakAtSlot() { void BreakLocationIterator::ClearDebugBreakAtSlot() { - ASSERT(IsDebugBreakSlot()); + DCHECK(IsDebugBreakSlot()); rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); } -const bool Debug::FramePaddingLayout::kIsSupported = false; - #define __ ACCESS_MASM(masm) @@ -103,12 +101,22 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, { FrameScope scope(masm, StackFrame::INTERNAL); + // Load padding words on stack. + __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingValue))); + __ Subu(sp, sp, + Operand(kPointerSize * LiveEdit::kFramePaddingInitialSize)); + for (int i = LiveEdit::kFramePaddingInitialSize - 1; i >= 0; i--) { + __ sw(at, MemOperand(sp, kPointerSize * i)); + } + __ 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. - ASSERT((object_regs & ~kJSCallerSaved) == 0); - ASSERT((non_object_regs & ~kJSCallerSaved) == 0); - ASSERT((object_regs & non_object_regs) == 0); + DCHECK((object_regs & ~kJSCallerSaved) == 0); + DCHECK((non_object_regs & ~kJSCallerSaved) == 0); + DCHECK((object_regs & non_object_regs) == 0); if ((object_regs | non_object_regs) != 0) { for (int i = 0; i < kNumJSCallerSaved; i++) { int r = JSCallerSavedCode(i); @@ -149,20 +157,24 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, } } + // Don't bother removing padding bytes pushed on the stack + // as the frame is going to be restored right away. + // Leave the internal frame. } // 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. - __ li(t9, Operand( - ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate()))); + ExternalReference after_break_target = + ExternalReference::debug_after_break_target_address(masm->isolate()); + __ li(t9, Operand(after_break_target)); __ lw(t9, MemOperand(t9)); __ Jump(t9); } -void Debug::GenerateCallICStubDebugBreak(MacroAssembler* masm) { +void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) { // Register state for CallICStub // ----------- S t a t e ------------- // -- a1 : function @@ -172,54 +184,40 @@ void Debug::GenerateCallICStubDebugBreak(MacroAssembler* masm) { } -void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { - // Calling convention for IC load (from ic-mips.cc). - // ----------- S t a t e ------------- - // -- a2 : name - // -- ra : return address - // -- a0 : receiver - // -- [sp] : receiver - // ----------------------------------- - // Registers a0 and a2 contain objects that need to be pushed on the - // expression stack of the fake JS frame. - Generate_DebugBreakCallHelper(masm, a0.bit() | a2.bit(), 0); +void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) { + Register receiver = LoadIC::ReceiverRegister(); + Register name = LoadIC::NameRegister(); + Generate_DebugBreakCallHelper(masm, receiver.bit() | name.bit(), 0); } -void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) { +void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) { // Calling convention for IC store (from ic-mips.cc). - // ----------- S t a t e ------------- - // -- a0 : value - // -- a1 : receiver - // -- a2 : name - // -- ra : return address - // ----------------------------------- - // Registers a0, a1, and a2 contain objects that need to be pushed on the - // expression stack of the fake JS frame. - Generate_DebugBreakCallHelper(masm, a0.bit() | a1.bit() | a2.bit(), 0); + Register receiver = StoreIC::ReceiverRegister(); + Register name = StoreIC::NameRegister(); + Register value = StoreIC::ValueRegister(); + Generate_DebugBreakCallHelper( + masm, receiver.bit() | name.bit() | value.bit(), 0); } -void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { - // ---------- S t a t e -------------- - // -- ra : return address - // -- a0 : key - // -- a1 : receiver - Generate_DebugBreakCallHelper(masm, a0.bit() | a1.bit(), 0); +void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { + // Calling convention for keyed IC load (from ic-mips.cc). + GenerateLoadICDebugBreak(masm); } -void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { - // ---------- S t a t e -------------- - // -- a0 : value - // -- a1 : key - // -- a2 : receiver - // -- ra : return address - Generate_DebugBreakCallHelper(masm, a0.bit() | a1.bit() | a2.bit(), 0); +void DebugCodegen::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { + // Calling convention for IC keyed store call (from ic-mips.cc). + Register receiver = KeyedStoreIC::ReceiverRegister(); + Register name = KeyedStoreIC::NameRegister(); + Register value = KeyedStoreIC::ValueRegister(); + Generate_DebugBreakCallHelper( + masm, receiver.bit() | name.bit() | value.bit(), 0); } -void Debug::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { +void DebugCodegen::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { // Register state for CompareNil IC // ----------- S t a t e ------------- // -- a0 : value @@ -228,7 +226,7 @@ void Debug::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { } -void Debug::GenerateReturnDebugBreak(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. @@ -236,7 +234,7 @@ void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) { } -void Debug::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { +void DebugCodegen::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { // Register state for CallFunctionStub (from code-stubs-mips.cc). // ----------- S t a t e ------------- // -- a1 : function @@ -245,7 +243,7 @@ void Debug::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { } -void Debug::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { +void DebugCodegen::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { // Calling convention for CallConstructStub (from code-stubs-mips.cc). // ----------- S t a t e ------------- // -- a0 : number of arguments (not smi) @@ -255,7 +253,8 @@ void Debug::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { } -void Debug::GenerateCallConstructStubRecordDebugBreak(MacroAssembler* masm) { +void DebugCodegen::GenerateCallConstructStubRecordDebugBreak( + MacroAssembler* masm) { // Calling convention for CallConstructStub (from code-stubs-mips.cc). // ----------- S t a t e ------------- // -- a0 : number of arguments (not smi) @@ -267,7 +266,7 @@ void Debug::GenerateCallConstructStubRecordDebugBreak(MacroAssembler* masm) { } -void Debug::GenerateSlot(MacroAssembler* masm) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm) { // 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); @@ -277,29 +276,49 @@ void Debug::GenerateSlot(MacroAssembler* masm) { for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { __ nop(MacroAssembler::DEBUG_BREAK_NOP); } - ASSERT_EQ(Assembler::kDebugBreakSlotInstructions, + DCHECK_EQ(Assembler::kDebugBreakSlotInstructions, masm->InstructionsGeneratedSince(&check_codesize)); } -void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) { +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, 0); } -void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { - masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnMips); +void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { + __ Ret(); } -void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { - masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnMips); +void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { + ExternalReference restarter_frame_function_slot = + ExternalReference::debug_restarter_frame_function_pointer_address( + masm->isolate()); + __ li(at, Operand(restarter_frame_function_slot)); + __ sw(zero_reg, MemOperand(at, 0)); + + // We do not know our frame height, but set sp based on fp. + __ Subu(sp, fp, Operand(kPointerSize)); + + __ Pop(ra, fp, a1); // Return address, Frame, Function. + + // Load context from the function. + __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); + + // Get function code. + __ lw(at, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); + __ lw(at, FieldMemOperand(at, SharedFunctionInfo::kCodeOffset)); + __ Addu(t9, at, Operand(Code::kHeaderSize - kHeapObjectTag)); + + // Re-run JSFunction, a1 is function, cp is context. + __ Jump(t9); } -const bool Debug::kFrameDropperSupported = false; +const bool LiveEdit::kFrameDropperSupported = true; #undef __ |