Index: src/debug/s390/debug-s390.cc |
diff --git a/src/debug/ppc/debug-ppc.cc b/src/debug/s390/debug-s390.cc |
similarity index 64% |
copy from src/debug/ppc/debug-ppc.cc |
copy to src/debug/s390/debug-s390.cc |
index aab5399fee177d248fea1638ff66e7cc75b48f21..7f9b3b4a9b93bf6c784000ba8047a2fdccea48ec 100644 |
--- a/src/debug/ppc/debug-ppc.cc |
+++ b/src/debug/s390/debug-s390.cc |
@@ -1,8 +1,10 @@ |
-// Copyright 2014 the V8 project authors. All rights reserved. |
+// Copyright 2015 the V8 project authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#if V8_TARGET_ARCH_PPC |
+#include "src/v8.h" |
+ |
+#if V8_TARGET_ARCH_S390 |
#include "src/codegen.h" |
#include "src/debug/debug.h" |
@@ -12,56 +14,59 @@ namespace internal { |
#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); |
+ // oill r3, 0 |
+ // oill r3, 0 |
+ __ nop(Assembler::DEBUG_BREAK_NOP); |
+ __ nop(Assembler::DEBUG_BREAK_NOP); |
+ |
+ // lr r0, r0 64-bit only |
+ // lr r0, r0 64-bit only |
+ // lr r0, r0 64-bit only |
+ for (int i = 8; i < Assembler::kDebugBreakSlotLength; i += 2) { |
+ __ nop(); |
} |
- DCHECK_EQ(Assembler::kDebugBreakSlotInstructions, |
- masm->InstructionsGeneratedSince(&check_size)); |
+ DCHECK_EQ(Assembler::kDebugBreakSlotLength, |
+ masm->SizeOfCodeGeneratedSince(&check_size)); |
} |
- |
void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { |
- // 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); |
+ // Generate enough nop's to make space for a call instruction. |
masm->RecordDebugBreakSlot(mode); |
EmitDebugBreakSlot(masm); |
} |
- |
void DebugCodegen::ClearDebugBreakSlot(Isolate* isolate, Address pc) { |
- CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotInstructions); |
+ CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotLength); |
EmitDebugBreakSlot(patcher.masm()); |
} |
- |
void DebugCodegen::PatchDebugBreakSlot(Isolate* isolate, Address pc, |
Handle<Code> code) { |
DCHECK_EQ(Code::BUILTIN, code->kind()); |
- CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotInstructions); |
+ CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotLength); |
// Patch the code changing the debug break slot code from |
// |
- // ori r3, r3, 0 |
- // ori r3, r3, 0 |
- // ori r3, r3, 0 |
- // ori r3, r3, 0 |
- // ori r3, r3, 0 |
+ // oill r3, 0 |
+ // oill r3, 0 |
+ // oill r3, 0 64-bit only |
+ // lr r0, r0 64-bit only |
// |
// to a call to the debug break code, using a FIXED_SEQUENCE. |
// |
- // mov r0, <address> |
- // mtlr r0 |
- // blrl |
+ // iilf r14, <address> 6-bytes |
+ // basr r14, r14A 2-bytes |
+ // |
+ // The 64bit sequence has an extra iihf. |
// |
- Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); |
- patcher.masm()->mov(v8::internal::r0, |
+ // iihf r14, <high 32-bits address> 6-bytes |
+ // iilf r14, <lower 32-bits address> 6-bytes |
+ // basr r14, r14 2-bytes |
+ patcher.masm()->mov(v8::internal::r14, |
Operand(reinterpret_cast<intptr_t>(code->entry()))); |
- patcher.masm()->mtctr(v8::internal::r0); |
- patcher.masm()->bctrl(); |
+ patcher.masm()->basr(v8::internal::r14, v8::internal::r14); |
} |
bool DebugCodegen::DebugBreakSlotIsPatched(Address pc) { |
@@ -73,7 +78,7 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
DebugBreakCallHelperMode mode) { |
__ RecordComment("Debug break"); |
{ |
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
// Load padding words on stack. |
__ LoadSmiLiteral(ip, Smi::FromInt(LiveEdit::kFramePaddingValue)); |
@@ -83,10 +88,10 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
__ LoadSmiLiteral(ip, Smi::FromInt(LiveEdit::kFramePaddingInitialSize)); |
__ push(ip); |
- if (mode == SAVE_RESULT_REGISTER) __ push(r3); |
+ if (mode == SAVE_RESULT_REGISTER) __ push(r2); |
- __ mov(r3, Operand::Zero()); // no arguments |
- __ mov(r4, |
+ __ mov(r2, Operand::Zero()); // no arguments |
+ __ mov(r3, |
Operand(ExternalReference( |
Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()))); |
@@ -100,7 +105,7 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
} |
} |
- if (mode == SAVE_RESULT_REGISTER) __ pop(r3); |
+ if (mode == SAVE_RESULT_REGISTER) __ pop(r2); |
// Don't bother removing padding bytes pushed on the stack |
// as the frame is going to be restored right away. |
@@ -118,38 +123,36 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
__ JumpToJSEntry(ip); |
} |
- |
void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
// Load the function pointer off of our current stack frame. |
- __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kConstantPoolOffset - |
+ __ LoadP(r3, MemOperand(fp, StandardFrameConstants::kConstantPoolOffset - |
kPointerSize)); |
// Pop return address and frame |
__ LeaveFrame(StackFrame::INTERNAL); |
ParameterCount dummy(0); |
- __ FloodFunctionIfStepping(r4, no_reg, dummy, dummy); |
+ __ FloodFunctionIfStepping(r3, no_reg, dummy, dummy); |
// Load context from the function. |
- __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); |
+ __ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset)); |
// Clear new.target as a safety measure. |
- __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
+ __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
// Get function code. |
- __ LoadP(ip, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
+ __ LoadP(ip, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); |
__ LoadP(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset)); |
- __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
+ __ AddP(ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- // Re-run JSFunction, r4 is function, cp is context. |
+ // Re-run JSFunction, r3 is function, cp is context. |
__ Jump(ip); |
} |
- |
const bool LiveEdit::kFrameDropperSupported = true; |
#undef __ |
} // namespace internal |
} // namespace v8 |
-#endif // V8_TARGET_ARCH_PPC |
+#endif // V8_TARGET_ARCH_S390 |