Revision: 15305
Author:   [email protected]
Date:     Tue Jun 25 00:14:06 2013
Log:      Merge SafeStackTraceFrameIterator into SafeStackFrameIterator

SafeStackFrameIterator was used solely to implement SafeStackTraceFrameIterator. This CL simply merges them and updates usage of SafeStackTraceFrameIterator to use SafeStackFrameIterator (a bit shorter name).

BUG=None
[email protected], [email protected]

Review URL: https://codereview.chromium.org/17579005
http://code.google.com/p/v8/source/detail?r=15305

Modified:
 /branches/bleeding_edge/src/frames-inl.h
 /branches/bleeding_edge/src/frames.cc
 /branches/bleeding_edge/src/frames.h
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/src/sampler.cc

=======================================
--- /branches/bleeding_edge/src/frames-inl.h    Mon Jun 24 01:38:37 2013
+++ /branches/bleeding_edge/src/frames-inl.h    Tue Jun 25 00:14:06 2013
@@ -324,7 +324,8 @@
 }


-inline JavaScriptFrame* SafeStackTraceFrameIterator::frame() const {
+inline JavaScriptFrame* SafeStackFrameIterator::frame() const {
+  ASSERT(!iteration_done_);
   // TODO(1233797): The frame hierarchy needs to change. It's
   // problematic that we can't use the safe-cast operator to cast to
   // the JavaScript frame type, because we may encounter arguments
=======================================
--- /branches/bleeding_edge/src/frames.cc       Mon Jun 24 06:27:48 2013
+++ /branches/bleeding_edge/src/frames.cc       Tue Jun 25 00:14:06 2013
@@ -291,6 +291,7 @@
     is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)),
     iteration_done_(!is_valid_top_ && !is_valid_fp_),
     iterator_(isolate, is_valid_top_, is_valid_fp_ ? fp : NULL, sp) {
+  if (!done()) Advance();
 }

 bool SafeStackFrameIterator::is_active(Isolate* isolate) {
@@ -308,7 +309,7 @@
 }


-void SafeStackFrameIterator::Advance() {
+void SafeStackFrameIterator::AdvanceOneFrame() {
   ASSERT(!done());
   StackFrame* last_frame = iterator_.frame();
   Address last_sp = last_frame->sp(), last_fp = last_frame->fp();
@@ -366,24 +367,16 @@
 }


-// -------------------------------------------------------------------------
-
-
-SafeStackTraceFrameIterator::SafeStackTraceFrameIterator(
-    Isolate* isolate,
-    Address fp, Address sp, Address low_bound, Address high_bound)
-    : iterator_(isolate, fp, sp, low_bound, high_bound) {
-  if (!done()) Advance();
-}
-
-
-void SafeStackTraceFrameIterator::Advance() {
+void SafeStackFrameIterator::Advance() {
   while (true) {
-    iterator_.Advance();
-    if (iterator_.done()) return;
+    AdvanceOneFrame();
+    if (done()) return;
     if (iterator_.frame()->is_java_script()) return;
   }
 }
+
+
+// -------------------------------------------------------------------------


 Code* StackFrame::GetSafepointData(Isolate* isolate,
=======================================
--- /branches/bleeding_edge/src/frames.h        Mon Jun 24 06:27:48 2013
+++ /branches/bleeding_edge/src/frames.h        Tue Jun 25 00:14:06 2013
@@ -874,18 +874,16 @@
                          Address fp, Address sp,
                          Address low_bound, Address high_bound);

-  StackFrame* frame() const {
-    ASSERT(!iteration_done_);
-    return iterator_.frame();
-  }
+  inline JavaScriptFrame* frame() const;

   bool done() const { return iteration_done_ || iterator_.done(); }
-
   void Advance();

   static bool is_active(Isolate* isolate);

  private:
+  void AdvanceOneFrame();
+
   static bool IsWithinBounds(
       Address low_bound, Address high_bound, Address addr) {
     return low_bound <= addr && addr <= high_bound;
@@ -945,24 +943,6 @@
 };


-class SafeStackTraceFrameIterator BASE_EMBEDDED {
- public:
-  SafeStackTraceFrameIterator(Isolate* isolate,
-                              Address fp,
-                              Address sp,
-                              Address low_bound,
-                              Address high_bound);
-
-  inline JavaScriptFrame* frame() const;
-
-  bool done() const { return iterator_.done(); }
-  void Advance();
-
- private:
-  SafeStackFrameIterator iterator_;
-};
-
-
 class StackFrameLocator BASE_EMBEDDED {
  public:
   explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {}
=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Thu Jun 13 02:27:09 2013 +++ /branches/bleeding_edge/src/profile-generator.cc Tue Jun 25 00:14:06 2013
@@ -910,7 +910,7 @@
     Address start;
     CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start);
// If pc is in the function code before it set up stack frame or after the - // frame was destroyed SafeStackTraceFrameIterator incorrectly thinks that
+    // frame was destroyed SafeStackFrameIterator incorrectly thinks that
// ebp contains return address of the current function and skips caller's
     // frame. Check for this case and just skip such samples.
     if (pc_entry) {
=======================================
--- /branches/bleeding_edge/src/sampler.cc      Thu Jun 13 12:16:35 2013
+++ /branches/bleeding_edge/src/sampler.cc      Tue Jun 25 00:14:06 2013
@@ -636,7 +636,7 @@
     has_external_callback = false;
   }

-  SafeStackTraceFrameIterator it(isolate, fp, sp, sp, js_entry_sp);
+  SafeStackFrameIterator it(isolate, fp, sp, sp, js_entry_sp);
   int i = 0;
   while (!it.done() && i < TickSample::kMaxFramesCount) {
     stack[i++] = it.frame()->pc();

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to