Abstract out fetching of break_address in debug mode

If the platform has a variable length call sequence
more than simple offset math is required. This can
be true with out of line constant pools on PowerPC.

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/427863003

Patch from Andrew Low <andrew_low@ca.ibm.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22935 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-08-06 13:56:58 +00:00
parent a6ad240b91
commit 46bda34130
15 changed files with 58 additions and 2 deletions

View File

@ -458,6 +458,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Address Assembler::return_address_from_call_start(Address pc) {
if (IsLdrPcImmediateOffset(Memory::int32_at(pc)) |
IsLdrPpImmediateOffset(Memory::int32_at(pc))) {

View File

@ -781,6 +781,9 @@ class Assembler : public AssemblerBase {
// in the instruction stream that the call will return from.
INLINE(static Address return_address_from_call_start(Address pc));
// Return the code target address of the patch debug break slot
INLINE(static Address break_address_from_return_address(Address pc));
// This sets the branch destination (which is in the constant pool on ARM).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(

View File

@ -607,6 +607,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Address Assembler::return_address_from_call_start(Address pc) {
// The call, generated by MacroAssembler::Call, is one of two possible
// sequences:

View File

@ -887,6 +887,9 @@ class Assembler : public AssemblerBase {
// instruction stream that call will return from.
inline static Address return_address_from_call_start(Address pc);
// Return the code target address of the patch debug break slot
inline static Address break_address_from_return_address(Address pc);
// This sets the branch destination (which is in the constant pool on ARM).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(

View File

@ -2326,7 +2326,7 @@ void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
// Find the call address in the running code. This address holds the call to
// either a DebugBreakXXX or to the debug break return entry code if the
// break point is still active after processing the break point.
Address addr = frame->pc() - Assembler::kPatchDebugBreakSlotReturnOffset;
Address addr = Assembler::break_address_from_return_address(frame->pc());
// Check if the location is at JS exit or debug break slot.
bool at_js_return = false;
@ -2417,7 +2417,7 @@ bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
#endif
// Find the call address in the running code.
Address addr = frame->pc() - Assembler::kPatchDebugBreakSlotReturnOffset;
Address addr = Assembler::break_address_from_return_address(frame->pc());
// Check if the location is at JS return.
RelocIterator it(debug_info->code());

View File

@ -482,6 +482,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Displacement Assembler::disp_at(Label* L) {
return Displacement(long_at(L->pos()));
}

View File

@ -519,6 +519,9 @@ class Assembler : public AssemblerBase {
// of that call in the instruction stream.
inline static Address target_address_from_return_address(Address pc);
// Return the code target address of the patch debug break slot
inline static Address break_address_from_return_address(Address pc);
// This sets the branch destination (which is in the instruction on x86).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(

View File

@ -190,6 +190,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Object* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));

View File

@ -511,6 +511,9 @@ class Assembler : public AssemblerBase {
// of that call in the instruction stream.
inline static Address target_address_from_return_address(Address pc);
// Return the code target address of the patch debug break slot
inline static Address break_address_from_return_address(Address pc);
static void JumpLabelToJumpRegister(Address pc);
static void QuietNaN(HeapObject* nan);

View File

@ -184,6 +184,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Object* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));

View File

@ -512,6 +512,9 @@ class Assembler : public AssemblerBase {
// of that call in the instruction stream.
inline static Address target_address_from_return_address(Address pc);
// Return the code target address of the patch debug break slot
inline static Address break_address_from_return_address(Address pc);
static void JumpLabelToJumpRegister(Address pc);
static void QuietNaN(HeapObject* nan);

View File

@ -206,6 +206,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Handle<Object> Assembler::code_target_object_handle_at(Address pc) {
return code_targets_[Memory::int32_at(pc)];
}

View File

@ -539,6 +539,9 @@ class Assembler : public AssemblerBase {
// of that call in the instruction stream.
static inline Address target_address_from_return_address(Address pc);
// Return the code target address of the patch debug break slot
inline static Address break_address_from_return_address(Address pc);
// This sets the branch destination (which is in the instruction on x64).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(

View File

@ -483,6 +483,11 @@ Address Assembler::target_address_from_return_address(Address pc) {
}
Address Assembler::break_address_from_return_address(Address pc) {
return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
}
Displacement Assembler::disp_at(Label* L) {
return Displacement(long_at(L->pos()));
}

View File

@ -508,6 +508,9 @@ class Assembler : public AssemblerBase {
// of that call in the instruction stream.
inline static Address target_address_from_return_address(Address pc);
// Return the code target address of the patch debug break slot
inline static Address break_address_from_return_address(Address pc);
// This sets the branch destination (which is in the instruction on x86).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(