From 57d0b53eed42dc1f5f612860c5ec759e6d1bbbd7 Mon Sep 17 00:00:00 2001 From: "palfia@homejinni.com" Date: Fri, 20 Jun 2014 20:52:57 +0000 Subject: [PATCH] MIPS: Support LiveEdit. Port r21895 (210f7aa) BUG=368580 LOG=Y R=jkummerow@chromium.org, palfia@homejinni.com Review URL: https://codereview.chromium.org/349703002 Patch from Balazs Kilvady . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21905 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/debug-mips.cc | 39 ++++++++++++++++++++++++++++++++++++--- src/objects.h | 2 -- test/mjsunit/mjsunit.status | 7 ------- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/mips/debug-mips.cc b/src/mips/debug-mips.cc index fc05211..48771d3 100644 --- a/src/mips/debug-mips.cc +++ b/src/mips/debug-mips.cc @@ -101,6 +101,16 @@ 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. @@ -147,6 +157,9 @@ 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. } @@ -290,16 +303,36 @@ void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) { void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { - masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnMips); + __ Ret(); } void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { - masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnMips); + 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, r1 is function, cp is context. + __ Jump(t9); } -const bool LiveEdit::kFrameDropperSupported = false; +const bool LiveEdit::kFrameDropperSupported = true; #undef __ diff --git a/src/objects.h b/src/objects.h index 7877600..53741aa 100644 --- a/src/objects.h +++ b/src/objects.h @@ -1153,8 +1153,6 @@ template inline bool Is(Object* obj); V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \ V(kLiveEditFrameDroppingIsNotSupportedOnARM64, \ "LiveEdit frame dropping is not supported on arm64") \ - V(kLiveEditFrameDroppingIsNotSupportedOnMips, \ - "LiveEdit frame dropping is not supported on mips") \ V(kLiveEdit, "LiveEdit") \ V(kLookupVariableInCountOperation, \ "Lookup variable in count operation") \ diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index eb4fe35..34ea1d5 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -346,13 +346,6 @@ # should be platform-independent. 'regress/regress-1132': [SKIP], - # Stack manipulations in LiveEdit is not implemented for this arch. - 'debug-liveedit-check-stack': [SKIP], - 'debug-liveedit-stack-padding': [SKIP], - 'debug-liveedit-restart-frame': [SKIP], - 'debug-liveedit-double-call': [SKIP], - 'harmony/generators-debug-liveedit': [SKIP], - # Currently always deopt on minus zero 'math-floor-of-div-minus-zero': [SKIP], }], # 'arch == mipsel or arch == mips' -- 2.7.4