| Index: src/mips64/debug-mips64.cc
|
| diff --git a/src/mips/debug-mips.cc b/src/mips64/debug-mips64.cc
|
| similarity index 83%
|
| copy from src/mips/debug-mips.cc
|
| copy to src/mips64/debug-mips64.cc
|
| index 424a87a14803299d7b3e9596e7ff94cf9f04ba45..6b805c78397f917b7d2d98a4b4c78a46e42dd47a 100644
|
| --- a/src/mips/debug-mips.cc
|
| +++ b/src/mips64/debug-mips64.cc
|
| @@ -6,7 +6,7 @@
|
|
|
| #include "src/v8.h"
|
|
|
| -#if V8_TARGET_ARCH_MIPS
|
| +#if V8_TARGET_ARCH_MIPS64
|
|
|
| #include "src/codegen.h"
|
| #include "src/debug.h"
|
| @@ -29,17 +29,16 @@ void BreakLocationIterator::SetDebugBreakAtReturn() {
|
| // jr ra
|
| // nop (in branch delay slot)
|
|
|
| - // Make sure this constant matches the number if instrucntions we emit.
|
| + // Make sure this constant matches the number if instructions we emit.
|
| ASSERT(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>(
|
| - debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry())));
|
| + // li and Call pseudo-instructions emit 6 + 2 instructions.
|
| + patcher.masm()->li(v8::internal::t9, Operand(reinterpret_cast<int64_t>(
|
| + debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry())),
|
| + ADDRESS_LOAD);
|
| patcher.masm()->Call(v8::internal::t9);
|
| + // Place nop to match return sequence size.
|
| patcher.masm()->nop();
|
| - patcher.masm()->nop();
|
| - patcher.masm()->nop();
|
| -
|
| // TODO(mips): Open issue about using breakpoint instruction instead of nops.
|
| // patcher.masm()->bkpt(0);
|
| }
|
| @@ -74,12 +73,16 @@ void BreakLocationIterator::SetDebugBreakAtSlot() {
|
| // nop(DEBUG_BREAK_NOP)
|
| // nop(DEBUG_BREAK_NOP)
|
| // nop(DEBUG_BREAK_NOP)
|
| + // nop(DEBUG_BREAK_NOP)
|
| + // nop(DEBUG_BREAK_NOP)
|
| // to a call to the debug break slot code.
|
| - // li t9, address (lui t9 / ori t9 instruction pair)
|
| + // li t9, address (4-instruction sequence on mips64)
|
| // call t9 (jalr t9 / nop instruction pair)
|
| CodePatcher patcher(rinfo()->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<int64_t>(
|
| + debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry())),
|
| + ADDRESS_LOAD);
|
| patcher.masm()->Call(v8::internal::t9);
|
| }
|
|
|
| @@ -103,33 +106,33 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
|
|
|
| // Load padding words on stack.
|
| __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingValue)));
|
| - __ Subu(sp, sp,
|
| + __ Dsubu(sp, sp,
|
| Operand(kPointerSize * LiveEdit::kFramePaddingInitialSize));
|
| for (int i = LiveEdit::kFramePaddingInitialSize - 1; i >= 0; i--) {
|
| - __ sw(at, MemOperand(sp, kPointerSize * i));
|
| + __ sd(at, MemOperand(sp, kPointerSize * i));
|
| }
|
| __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
|
| __ push(at);
|
|
|
| +
|
| + // TODO(plind): This needs to be revised to store pairs of smi's per
|
| + // the other 64-bit arch's.
|
| +
|
| // 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);
|
| - if ((object_regs | non_object_regs) != 0) {
|
| - for (int i = 0; i < kNumJSCallerSaved; i++) {
|
| - int r = JSCallerSavedCode(i);
|
| - Register reg = { r };
|
| - if ((non_object_regs & (1 << r)) != 0) {
|
| - if (FLAG_debug_code) {
|
| - __ And(at, reg, 0xc0000000);
|
| - __ Assert(eq, kUnableToEncodeValueAsSmi, at, Operand(zero_reg));
|
| - }
|
| - __ sll(reg, reg, kSmiTagSize);
|
| - }
|
| + 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) {
|
| + __ PushRegisterAsTwoSmis(reg);
|
| }
|
| - __ MultiPush(object_regs | non_object_regs);
|
| }
|
|
|
| #ifdef DEBUG
|
| @@ -142,18 +145,18 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
|
| __ CallStub(&ceb);
|
|
|
| // Restore the register values from the expression stack.
|
| - if ((object_regs | non_object_regs) != 0) {
|
| - __ MultiPop(object_regs | non_object_regs);
|
| - for (int i = 0; i < kNumJSCallerSaved; i++) {
|
| - int r = JSCallerSavedCode(i);
|
| - Register reg = { r };
|
| - if ((non_object_regs & (1 << r)) != 0) {
|
| - __ srl(reg, reg, kSmiTagSize);
|
| - }
|
| - if (FLAG_debug_code &&
|
| - (((object_regs |non_object_regs) & (1 << r)) == 0)) {
|
| - __ li(reg, kDebugZapValue);
|
| - }
|
| + for (int i = kNumJSCallerSaved - 1; i >= 0; i--) {
|
| + int r = JSCallerSavedCode(i);
|
| + Register reg = { r };
|
| + if ((non_object_regs & (1 << r)) != 0) {
|
| + __ PopRegisterAsTwoSmis(reg, at);
|
| + }
|
| + if ((object_regs & (1 << r)) != 0) {
|
| + __ pop(reg);
|
| + }
|
| + if (FLAG_debug_code &&
|
| + (((object_regs |non_object_regs) & (1 << r)) == 0)) {
|
| + __ li(reg, kDebugZapValue);
|
| }
|
| }
|
|
|
| @@ -169,7 +172,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
|
| ExternalReference after_break_target =
|
| ExternalReference::debug_after_break_target_address(masm->isolate());
|
| __ li(t9, Operand(after_break_target));
|
| - __ lw(t9, MemOperand(t9));
|
| + __ ld(t9, MemOperand(t9));
|
| __ Jump(t9);
|
| }
|
|
|
| @@ -257,6 +260,7 @@ void DebugCodegen::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| +
|
| void DebugCodegen::GenerateCallConstructStubRecordDebugBreak(
|
| MacroAssembler* masm) {
|
| // Calling convention for CallConstructStub (from code-stubs-mips.cc).
|
| @@ -305,17 +309,17 @@ void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
|
| __ sw(zero_reg, MemOperand(at, 0));
|
|
|
| // We do not know our frame height, but set sp based on fp.
|
| - __ Subu(sp, fp, Operand(kPointerSize));
|
| + __ Dsubu(sp, fp, Operand(kPointerSize));
|
|
|
| __ Pop(ra, fp, a1); // Return address, Frame, Function.
|
|
|
| // Load context from the function.
|
| - __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
|
| + __ ld(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));
|
| + __ ld(at, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| + __ ld(at, FieldMemOperand(at, SharedFunctionInfo::kCodeOffset));
|
| + __ Daddu(t9, at, Operand(Code::kHeaderSize - kHeapObjectTag));
|
|
|
| // Re-run JSFunction, a1 is function, cp is context.
|
| __ Jump(t9);
|
| @@ -328,4 +332,4 @@ const bool LiveEdit::kFrameDropperSupported = true;
|
|
|
| } } // namespace v8::internal
|
|
|
| -#endif // V8_TARGET_ARCH_MIPS
|
| +#endif // V8_TARGET_ARCH_MIPS64
|
|
|