Revision: 3072
Author: [email protected]
Date: Thu Oct 15 04:52:53 2009
Log: Fix X64 build in the case that debugger support is disabled. Change
function name from IsCallInstruction to IsPatchedReturnSequence on all
platforms.
Review URL: http://codereview.chromium.org/267116
http://code.google.com/p/v8/source/detail?r=3072
Modified:
/branches/bleeding_edge/src/arm/assembler-arm-inl.h
/branches/bleeding_edge/src/arm/debug-arm.cc
/branches/bleeding_edge/src/assembler.h
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/ia32/assembler-ia32-inl.h
/branches/bleeding_edge/src/ia32/debug-ia32.cc
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/x64/assembler-x64-inl.h
/branches/bleeding_edge/src/x64/debug-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm-inl.h Tue Oct 6 06:11:05
2009
+++ /branches/bleeding_edge/src/arm/assembler-arm-inl.h Thu Oct 15 04:52:53
2009
@@ -110,7 +110,7 @@
Address RelocInfo::call_address() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
// The 2 instructions offset assumes patched return sequence.
ASSERT(IsJSReturn(rmode()));
return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize);
@@ -118,7 +118,7 @@
void RelocInfo::set_call_address(Address target) {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
// The 2 instructions offset assumes patched return sequence.
ASSERT(IsJSReturn(rmode()));
Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target;
@@ -131,7 +131,7 @@
Object** RelocInfo::call_object_address() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
// The 2 instructions offset assumes patched return sequence.
ASSERT(IsJSReturn(rmode()));
return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
@@ -143,7 +143,7 @@
}
-bool RelocInfo::IsCallInstruction() {
+bool RelocInfo::IsPatchedReturnSequence() {
// On ARM a "call instruction" is actually two instructions.
// mov lr, pc
// ldr pc, [pc, #XXX]
=======================================
--- /branches/bleeding_edge/src/arm/debug-arm.cc Sun Sep 13 23:57:24 2009
+++ /branches/bleeding_edge/src/arm/debug-arm.cc Thu Oct 15 04:52:53 2009
@@ -68,7 +68,7 @@
// A debug break in the exit code is identified by a call.
bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()));
- return rinfo->IsCallInstruction();
+ return rinfo->IsPatchedReturnSequence();
}
=======================================
--- /branches/bleeding_edge/src/assembler.h Tue Oct 6 06:11:05 2009
+++ /branches/bleeding_edge/src/assembler.h Thu Oct 15 04:52:53 2009
@@ -217,10 +217,10 @@
// Patch the code with a call.
void PatchCodeWithCall(Address target, int guard_bytes);
- // Check whether the current instruction is currently a call
- // sequence (whether naturally or a return sequence overwritten
- // to enter the debugger).
- INLINE(bool IsCallInstruction());
+
+ // Check whether this return sequence has been patched
+ // with a call to the debugger.
+ INLINE(bool IsPatchedReturnSequence());
#ifdef ENABLE_DISASSEMBLER
// Printing
=======================================
--- /branches/bleeding_edge/src/debug.cc Wed Oct 7 05:20:02 2009
+++ /branches/bleeding_edge/src/debug.cc Thu Oct 15 04:52:53 2009
@@ -1614,7 +1614,7 @@
if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
at_js_return = (it.rinfo()->pc() ==
addr - Assembler::kPatchReturnSequenceAddressOffset);
- break_at_js_return_active = it.rinfo()->IsCallInstruction();
+ break_at_js_return_active = it.rinfo()->IsPatchedReturnSequence();
}
it.next();
}
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Tue Oct 6
06:11:05 2009
+++ /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Thu Oct 15
04:52:53 2009
@@ -52,7 +52,7 @@
if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) {
int32_t* p = reinterpret_cast<int32_t*>(pc_);
*p -= delta; // relocate entry
- } else if (rmode_ == JS_RETURN && IsCallInstruction()) {
+ } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) {
// Special handling of js_return when a break point is set (call
// instruction has been inserted).
int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1);
@@ -114,36 +114,36 @@
Address RelocInfo::call_address() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
return Assembler::target_address_at(pc_ + 1);
}
void RelocInfo::set_call_address(Address target) {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
Assembler::set_target_address_at(pc_ + 1, target);
}
Object* RelocInfo::call_object() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
return *call_object_address();
}
Object** RelocInfo::call_object_address() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
return reinterpret_cast<Object**>(pc_ + 1);
}
void RelocInfo::set_call_object(Object* target) {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
*call_object_address() = target;
}
-bool RelocInfo::IsCallInstruction() {
+bool RelocInfo::IsPatchedReturnSequence() {
return *pc_ == 0xE8;
}
=======================================
--- /branches/bleeding_edge/src/ia32/debug-ia32.cc Wed Sep 9 10:45:21 2009
+++ /branches/bleeding_edge/src/ia32/debug-ia32.cc Thu Oct 15 04:52:53 2009
@@ -63,7 +63,7 @@
// having been patched with a call instruction.
bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()));
- return rinfo->IsCallInstruction();
+ return rinfo->IsPatchedReturnSequence();
}
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Oct 6 06:11:05 2009
+++ /branches/bleeding_edge/src/mark-compact.cc Thu Oct 15 04:52:53 2009
@@ -279,7 +279,7 @@
void VisitDebugTarget(RelocInfo* rinfo) {
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) &&
- rinfo->IsCallInstruction());
+ rinfo->IsPatchedReturnSequence());
HeapObject* code =
Code::GetCodeFromTargetAddress(rinfo->call_address());
MarkCompactCollector::MarkObject(code);
}
@@ -1382,7 +1382,8 @@
}
void VisitDebugTarget(RelocInfo* rinfo) {
- ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) &&
rinfo->IsCallInstruction());
+ ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) &&
+ rinfo->IsPatchedReturnSequence());
Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
VisitPointer(&target);
rinfo->set_call_address(
=======================================
--- /branches/bleeding_edge/src/objects.cc Wed Oct 14 02:26:16 2009
+++ /branches/bleeding_edge/src/objects.cc Thu Oct 15 04:52:53 2009
@@ -4983,7 +4983,8 @@
void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) {
- ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) &&
rinfo->IsCallInstruction());
+ ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) &&
+ rinfo->IsPatchedReturnSequence());
Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
Object* old_target = target;
VisitPointer(&target);
@@ -5009,7 +5010,7 @@
#ifdef ENABLE_DEBUGGER_SUPPORT
} else if (Debug::has_break_points() &&
RelocInfo::IsJSReturn(rmode) &&
- it.rinfo()->IsCallInstruction()) {
+ it.rinfo()->IsPatchedReturnSequence()) {
v->VisitDebugTarget(it.rinfo());
#endif
} else if (rmode == RelocInfo::RUNTIME_ENTRY) {
@@ -5047,7 +5048,7 @@
desc.reloc_size);
// unbox handles and relocate
- int delta = instruction_start() - desc.buffer;
+ intptr_t delta = instruction_start() - desc.buffer;
int mode_mask = RelocInfo::kCodeTargetMask |
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
RelocInfo::kApplyMask;
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64-inl.h Thu Oct 8 05:36:12
2009
+++ /branches/bleeding_edge/src/x64/assembler-x64-inl.h Thu Oct 15 04:52:53
2009
@@ -194,7 +194,7 @@
Memory::Address_at(pc_) += delta;
} else if (IsCodeTarget(rmode_)) {
Memory::int32_at(pc_) -= delta;
- } else if (rmode_ == JS_RETURN && IsCallInstruction()) {
+ } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) {
// Special handling of js_return when a break point is set (call
// instruction has been inserted).
Memory::int32_at(pc_ + 1) -= delta; // relocate entry
@@ -262,45 +262,49 @@
}
-bool RelocInfo::IsCallInstruction() {
+bool RelocInfo::IsPatchedReturnSequence() {
// The recognized call sequence is:
// movq(kScratchRegister, immediate64); call(kScratchRegister);
// It only needs to be distinguished from a return sequence
// movq(rsp, rbp); pop(rbp); ret(n); int3 *6
// The 11th byte is int3 (0xCC) in the return sequence and
// REX.WB (0x48+register bit) for the call sequence.
+#ifdef ENABLE_DEBUGGER_SUPPORT
return pc_[10] != 0xCC;
+#else
+ return false;
+#endif
}
Address RelocInfo::call_address() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
return Memory::Address_at(
pc_ + Assembler::kRealPatchReturnSequenceAddressOffset);
}
void RelocInfo::set_call_address(Address target) {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
Memory::Address_at(pc_ +
Assembler::kRealPatchReturnSequenceAddressOffset) =
target;
}
Object* RelocInfo::call_object() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
return *call_object_address();
}
void RelocInfo::set_call_object(Object* target) {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
*call_object_address() = target;
}
Object** RelocInfo::call_object_address() {
- ASSERT(IsCallInstruction());
+ ASSERT(IsPatchedReturnSequence());
return reinterpret_cast<Object**>(
pc_ + Assembler::kPatchReturnSequenceAddressOffset);
}
=======================================
--- /branches/bleeding_edge/src/x64/debug-x64.cc Wed Sep 9 10:45:21 2009
+++ /branches/bleeding_edge/src/x64/debug-x64.cc Thu Oct 15 04:52:53 2009
@@ -39,10 +39,7 @@
bool Debug::IsDebugBreakAtReturn(v8::internal::RelocInfo* rinfo) {
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()));
- // 11th byte of patch is 0x49 (REX.WB byte of computed jump/call to r10),
- // 11th byte of JS return is 0xCC (int3).
- ASSERT(*(rinfo->pc() + 10) == 0x49 || *(rinfo->pc() + 10) == 0xCC);
- return (*(rinfo->pc() + 10) != 0xCC);
+ return rinfo->IsPatchedReturnSequence();
}
#define __ ACCESS_MASM(masm)
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---