Push version 2.2.2 to trunk.
Introduced new profiler API.
Fixed random number generator to produce full 32 random bits.
git-svn-id: http://v8.googlecode.com/svn/trunk@4386 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/frames.cc b/src/frames.cc
index 5e81a54..9cf83c9 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -382,6 +382,12 @@
}
+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::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::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 @@
}
+#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