Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Unified Diff: src/frames.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
===================================================================
--- src/frames.cc (revision 1441)
+++ src/frames.cc (working copy)
@@ -74,6 +74,11 @@
frame_(NULL), handler_(NULL), thread_(t) {
Reset();
}
+StackFrameIterator::StackFrameIterator(bool reset)
+ : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
+ frame_(NULL), handler_(NULL), thread_(Top::GetCurrentThread()) {
+ if (reset) Reset();
+}
#undef INITIALIZE_SINGLETON
@@ -131,34 +136,79 @@
// -------------------------------------------------------------------------
-JavaScriptFrameIterator::JavaScriptFrameIterator(StackFrame::Id id) {
+StackTraceFrameIterator::StackTraceFrameIterator() {
+ if (!done() && !frame()->function()->IsJSFunction()) Advance();
+}
+
+
+void StackTraceFrameIterator::Advance() {
while (true) {
- Advance();
- if (frame()->id() == id) return;
+ JavaScriptFrameIterator::Advance();
+ if (done()) return;
+ if (frame()->function()->IsJSFunction()) return;
}
}
-void JavaScriptFrameIterator::Advance() {
- do {
+// -------------------------------------------------------------------------
+
+
+SafeStackFrameIterator::SafeStackFrameIterator(
+ Address low_bound, Address high_bound) :
+ low_bound_(low_bound), high_bound_(high_bound),
+ is_working_iterator_(IsInBounds(low_bound, high_bound,
+ Top::c_entry_fp(Top::GetCurrentThread()))),
+ iteration_done_(!is_working_iterator_), iterator_(is_working_iterator_) {
+}
+
+
+void SafeStackFrameIterator::Advance() {
+ ASSERT(is_working_iterator_);
+ ASSERT(!done());
+ StackFrame* frame = iterator_.frame();
+ iteration_done_ =
+ !IsGoodStackAddress(frame->sp()) || !IsGoodStackAddress(frame->fp());
+ if (!iteration_done_) {
iterator_.Advance();
- } while (!iterator_.done() && !iterator_.frame()->is_java_script());
+ if (!iterator_.done()) {
+ // Check that we have actually moved to the previous frame in the stack
+ StackFrame* prev_frame = iterator_.frame();
+ iteration_done_ =
+ prev_frame->sp() < frame->sp() || prev_frame->fp() < frame->fp();
+ }
+ }
}
-void JavaScriptFrameIterator::AdvanceToArgumentsFrame() {
- if (!frame()->has_adapted_arguments()) return;
- iterator_.Advance();
- ASSERT(iterator_.frame()->is_arguments_adaptor());
+void SafeStackFrameIterator::Reset() {
+ if (is_working_iterator_) {
+ iterator_.Reset();
+ iteration_done_ = false;
+ }
}
-void JavaScriptFrameIterator::Reset() {
- iterator_.Reset();
- Advance();
+// -------------------------------------------------------------------------
+
+
+#ifdef ENABLE_LOGGING_AND_PROFILING
+SafeStackTraceFrameIterator::SafeStackTraceFrameIterator(
+ Address low_bound, Address high_bound) :
+ SafeJavaScriptFrameIterator(low_bound, high_bound) {
+ if (!done() && !frame()->function()->IsJSFunction()) Advance();
}
+void SafeStackTraceFrameIterator::Advance() {
+ while (true) {
+ SafeJavaScriptFrameIterator::Advance();
+ if (done()) return;
+ if (frame()->function()->IsJSFunction()) return;
+ }
+}
+#endif
+
+
// -------------------------------------------------------------------------
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698