Do not apply JS_RETURN and DEBUG_BREAK_SLOT relocations on x64.
Improve tests for debug API to check behavior of JS_RETURN and DEBUG_BREAK_SLOT relocations. Review URL: http://codereview.chromium.org/3058049 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5180 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
31f3026b35
commit
bed254fac9
@ -120,9 +120,8 @@ Address RelocInfo::call_address() {
|
||||
|
||||
|
||||
void RelocInfo::set_call_address(Address target) {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
// The 2 instructions offset assumes patched return sequence.
|
||||
ASSERT(IsJSReturn(rmode()));
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target;
|
||||
}
|
||||
|
||||
@ -132,16 +131,15 @@ Object* RelocInfo::call_object() {
|
||||
}
|
||||
|
||||
|
||||
Object** RelocInfo::call_object_address() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
// The 2 instructions offset assumes patched return sequence.
|
||||
ASSERT(IsJSReturn(rmode()));
|
||||
return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
|
||||
void RelocInfo::set_call_object(Object* target) {
|
||||
*call_object_address() = target;
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_call_object(Object* target) {
|
||||
*call_object_address() = target;
|
||||
Object** RelocInfo::call_object_address() {
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
|
||||
}
|
||||
|
||||
|
||||
|
@ -232,8 +232,8 @@ class RelocInfo BASE_EMBEDDED {
|
||||
INLINE(Address call_address());
|
||||
INLINE(void set_call_address(Address target));
|
||||
INLINE(Object* call_object());
|
||||
INLINE(Object** call_object_address());
|
||||
INLINE(void set_call_object(Object* target));
|
||||
INLINE(Object** call_object_address());
|
||||
|
||||
inline void Visit(ObjectVisitor* v);
|
||||
|
||||
|
@ -121,32 +121,33 @@ Address* RelocInfo::target_reference_address() {
|
||||
|
||||
|
||||
Address RelocInfo::call_address() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
return Assembler::target_address_at(pc_ + 1);
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_call_address(Address target) {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
Assembler::set_target_address_at(pc_ + 1, target);
|
||||
}
|
||||
|
||||
|
||||
Object* RelocInfo::call_object() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
return *call_object_address();
|
||||
}
|
||||
|
||||
|
||||
Object** RelocInfo::call_object_address() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
return reinterpret_cast<Object**>(pc_ + 1);
|
||||
void RelocInfo::set_call_object(Object* target) {
|
||||
*call_object_address() = target;
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_call_object(Object* target) {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
*call_object_address() = target;
|
||||
Object** RelocInfo::call_object_address() {
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
return reinterpret_cast<Object**>(pc_ + 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,14 +201,6 @@ void RelocInfo::apply(intptr_t delta) {
|
||||
Memory::Address_at(pc_) += static_cast<int32_t>(delta);
|
||||
} else if (IsCodeTarget(rmode_)) {
|
||||
Memory::int32_at(pc_) -= static_cast<int32_t>(delta);
|
||||
} 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) -= static_cast<int32_t>(delta); // relocate entry
|
||||
} else if (rmode_ == DEBUG_BREAK_SLOT && IsPatchedDebugBreakSlotSequence()) {
|
||||
// Special handling of debug break slot when a break point is set (call
|
||||
// instruction has been inserted).
|
||||
Memory::int32_at(pc_ + 1) -= static_cast<int32_t>(delta); // relocate entry
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,33 +295,34 @@ bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
|
||||
|
||||
|
||||
Address RelocInfo::call_address() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
return Memory::Address_at(
|
||||
pc_ + Assembler::kRealPatchReturnSequenceAddressOffset);
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_call_address(Address target) {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
Memory::Address_at(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset) =
|
||||
target;
|
||||
}
|
||||
|
||||
|
||||
Object* RelocInfo::call_object() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
return *call_object_address();
|
||||
}
|
||||
|
||||
|
||||
void RelocInfo::set_call_object(Object* target) {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
*call_object_address() = target;
|
||||
}
|
||||
|
||||
|
||||
Object** RelocInfo::call_object_address() {
|
||||
ASSERT(IsPatchedReturnSequence());
|
||||
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
|
||||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
|
||||
return reinterpret_cast<Object**>(
|
||||
pc_ + Assembler::kPatchReturnSequenceAddressOffset);
|
||||
}
|
||||
|
@ -2941,9 +2941,7 @@ bool Assembler::WriteRecordedPositions() {
|
||||
|
||||
|
||||
const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask |
|
||||
1 << RelocInfo::INTERNAL_REFERENCE |
|
||||
1 << RelocInfo::JS_RETURN |
|
||||
1 << RelocInfo::DEBUG_BREAK_SLOT;
|
||||
1 << RelocInfo::INTERNAL_REFERENCE;
|
||||
|
||||
|
||||
bool RelocInfo::IsCodedSpecially() {
|
||||
|
@ -1277,25 +1277,53 @@ static void TestBreakPointSurviveGC(bool force_compaction) {
|
||||
v8::Local<v8::Function> foo;
|
||||
|
||||
// Test IC store break point with garbage collection.
|
||||
foo = CompileFunction(&env, "function foo(){bar=0;}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
{
|
||||
v8::Local<v8::Function> bar =
|
||||
CompileFunction(&env, "function foo(){}", "foo");
|
||||
foo = CompileFunction(&env, "function foo(){bar=0;}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
}
|
||||
CallAndGC(env->Global(), foo, force_compaction);
|
||||
|
||||
// Test IC load break point with garbage collection.
|
||||
foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
{
|
||||
v8::Local<v8::Function> bar =
|
||||
CompileFunction(&env, "function foo(){}", "foo");
|
||||
foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
}
|
||||
CallAndGC(env->Global(), foo, force_compaction);
|
||||
|
||||
// Test IC call break point with garbage collection.
|
||||
foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
{
|
||||
v8::Local<v8::Function> bar =
|
||||
CompileFunction(&env, "function foo(){}", "foo");
|
||||
foo = CompileFunction(&env,
|
||||
"function bar(){};function foo(){bar();}",
|
||||
"foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
}
|
||||
CallAndGC(env->Global(), foo, force_compaction);
|
||||
|
||||
// Test return break point with garbage collection.
|
||||
foo = CompileFunction(&env, "function foo(){}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
{
|
||||
v8::Local<v8::Function> bar =
|
||||
CompileFunction(&env, "function foo(){}", "foo");
|
||||
foo = CompileFunction(&env, "function foo(){}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
}
|
||||
CallAndGC(env->Global(), foo, force_compaction);
|
||||
|
||||
// Test non IC break point with garbage collection.
|
||||
{
|
||||
v8::Local<v8::Function> bar =
|
||||
CompileFunction(&env, "function foo(){}", "foo");
|
||||
foo = CompileFunction(&env, "function foo(){var bar=0;}", "foo");
|
||||
SetBreakPoint(foo, 0);
|
||||
}
|
||||
CallAndGC(env->Global(), foo, force_compaction);
|
||||
|
||||
|
||||
v8::Debug::SetDebugEventListener(NULL);
|
||||
CheckDebuggerUnloaded();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user