Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index 5e81a54d8dad81e9ccb4282ce17a6cb5a324130c..9cf83c91cfcb5fe8811cfe59509d8a0b1569edf4 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -382,6 +382,12 @@ void EntryFrame::ComputeCallerState(State* state) const { |
} |
+void EntryFrame::SetCallerFp(Address caller_fp) { |
+ const int offset = EntryFrameConstants::kCallerFPOffset; |
+ Memory::Address_at(this->fp() + offset) = caller_fp; |
+} |
+ |
+ |
StackFrame::Type EntryFrame::GetCallerState(State* state) const { |
const int offset = EntryFrameConstants::kCallerFPOffset; |
Address fp = Memory::Address_at(this->fp() + offset); |
@@ -414,6 +420,11 @@ void ExitFrame::ComputeCallerState(State* state) const { |
} |
+void ExitFrame::SetCallerFp(Address caller_fp) { |
+ Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset) = caller_fp; |
+} |
+ |
+ |
Address ExitFrame::GetCallerStackPointer() const { |
return fp() + ExitFrameConstants::kCallerSPDisplacement; |
} |
@@ -443,6 +454,12 @@ void StandardFrame::ComputeCallerState(State* state) const { |
} |
+void StandardFrame::SetCallerFp(Address caller_fp) { |
+ Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) = |
+ caller_fp; |
+} |
+ |
+ |
bool StandardFrame::IsExpressionInsideHandler(int n) const { |
Address address = GetExpressionAddress(n); |
for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { |
@@ -767,4 +784,40 @@ int JSCallerSavedCode(int n) { |
} |
+#define DEFINE_WRAPPER(type, field) \ |
+class field##_Wrapper : public ZoneObject { \ |
+ public: /* NOLINT */ \ |
+ field##_Wrapper(const field& original) : frame_(original) { \ |
+ } \ |
+ field frame_; \ |
+}; |
+STACK_FRAME_TYPE_LIST(DEFINE_WRAPPER) |
+#undef DEFINE_WRAPPER |
+ |
+static StackFrame* AllocateFrameCopy(StackFrame* frame) { |
+#define FRAME_TYPE_CASE(type, field) \ |
+ case StackFrame::type: { \ |
+ field##_Wrapper* wrapper = \ |
+ new field##_Wrapper(*(reinterpret_cast<field*>(frame))); \ |
+ return &wrapper->frame_; \ |
+ } |
+ |
+ switch (frame->type()) { |
+ STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) |
+ default: UNREACHABLE(); |
+ } |
+#undef FRAME_TYPE_CASE |
+ return NULL; |
+} |
+ |
+Vector<StackFrame*> CreateStackMap() { |
+ ZoneList<StackFrame*> list(10); |
+ for (StackFrameIterator it; !it.done(); it.Advance()) { |
+ StackFrame* frame = AllocateFrameCopy(it.frame()); |
+ list.Add(frame); |
+ } |
+ return list.ToVector(); |
+} |
+ |
+ |
} } // namespace v8::internal |