Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index 40df12c437281bb6006c66af0e8a55871c14623d..81b75c889e326af68a6630032debab2c57c1a0bd 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -41,6 +41,22 @@ |
namespace v8 { |
namespace internal { |
+ |
+ReturnAddressLocationResolver return_address_location_resolver = NULL; |
Vyacheslav Egorov (Chromium)
2012/02/24 10:34:02
declare it static
Sigurður Ásgeirsson
2012/02/24 14:46:04
Done.
|
+ |
+ |
+// Resolves pc_address through the resolution address function if one is set. |
+Address* ResolveReturnAddressLocation(Address* pc_address) { |
Vyacheslav Egorov (Chromium)
2012/02/24 10:34:02
declare it static
Sigurður Ásgeirsson
2012/02/24 14:46:04
Done.
Does this warrant "static inline" or are the
Vyacheslav Egorov (Chromium)
2012/02/24 14:48:21
Yes, I think there is no harm declaring it inline
Sigurður Ásgeirsson
2012/02/24 14:59:40
Done.
|
+ if (return_address_location_resolver == NULL) { |
+ return pc_address; |
+ } else { |
+ return reinterpret_cast<Address*>( |
+ return_address_location_resolver( |
+ reinterpret_cast<uintptr_t>(pc_address))); |
+ } |
+} |
+ |
+ |
// Iterator that supports traversing the stack handlers of a |
// particular frame. Needs to know the top of the handler chain. |
class StackHandlerIterator BASE_EMBEDDED { |
@@ -155,8 +171,8 @@ void StackFrameIterator::Reset() { |
ASSERT(fp_ != NULL); |
state.fp = fp_; |
state.sp = sp_; |
- state.pc_address = |
- reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp_)); |
+ state.pc_address = ResolveReturnAddressLocation( |
+ reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp_))); |
type = StackFrame::ComputeType(isolate(), &state); |
} |
if (SingletonFor(type) == NULL) return; |
@@ -413,6 +429,11 @@ void StackFrame::IteratePc(ObjectVisitor* v, |
} |
} |
Vyacheslav Egorov (Chromium)
2012/02/24 10:34:02
add empty line
Sigurður Ásgeirsson
2012/02/24 14:46:04
Done.
|
+void StackFrame::SetReturnAddressLocationResolver( |
+ ReturnAddressLocationResolver resolver) { |
+ return_address_location_resolver = resolver; |
Vyacheslav Egorov (Chromium)
2012/02/24 10:34:02
assert that we don't have any other resolver insta
Sigurður Ásgeirsson
2012/02/24 14:46:04
Done.
|
+} |
+ |
StackFrame::Type StackFrame::ComputeType(Isolate* isolate, State* state) { |
ASSERT(state->fp != NULL); |
@@ -488,8 +509,8 @@ void ExitFrame::ComputeCallerState(State* state) const { |
// Set up the caller state. |
state->sp = caller_sp(); |
state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset); |
- state->pc_address |
- = reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset); |
+ state->pc_address = ResolveReturnAddressLocation( |
+ reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset)); |
} |
@@ -523,7 +544,8 @@ StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { |
void ExitFrame::FillState(Address fp, Address sp, State* state) { |
state->sp = sp; |
state->fp = fp; |
- state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize); |
+ state->pc_address = ResolveReturnAddressLocation( |
+ reinterpret_cast<Address*>(sp - 1 * kPointerSize)); |
} |
@@ -558,7 +580,8 @@ int StandardFrame::ComputeExpressionsCount() const { |
void StandardFrame::ComputeCallerState(State* state) const { |
state->sp = caller_sp(); |
state->fp = caller_fp(); |
- state->pc_address = reinterpret_cast<Address*>(ComputePCAddress(fp())); |
+ state->pc_address = ResolveReturnAddressLocation( |
+ reinterpret_cast<Address*>(ComputePCAddress(fp()))); |
} |