Reviewers: loislo, Sven Panne,
Description:
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
Please review this at https://codereview.chromium.org/17579005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/frames-inl.h
M src/frames.h
M src/frames.cc
M src/profile-generator.cc
M src/sampler.cc
Index: src/frames-inl.h
diff --git a/src/frames-inl.h b/src/frames-inl.h
index
cf31a482c14fcbfc4faa7bdec1895a2c529b544d..c22a018fb0a1fb09bc0c5199fcf332d0c5a31c1b
100644
--- a/src/frames-inl.h
+++ b/src/frames-inl.h
@@ -324,7 +324,8 @@ inline JavaScriptFrame*
JavaScriptFrameIterator::frame() const {
}
-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
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index
5ea0fd84ca3eac49fe61cb92aeefb0dae972a066..3cf02f4007c076799324137d80406a3268ffefe3
100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -291,6 +291,7 @@ SafeStackFrameIterator::SafeStackFrameIterator(
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 @@ bool SafeStackFrameIterator::IsValidTop(Isolate*
isolate,
}
-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,26 +367,18 @@ bool
SafeStackFrameIterator::IsValidCaller(StackFrame* frame) {
}
-//
-------------------------------------------------------------------------
-
-
-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,
Address inner_pointer,
SafepointEntry* safepoint_entry,
Index: src/frames.h
diff --git a/src/frames.h b/src/frames.h
index
5c3acf2b861af6209c647e35b123df8dc39258f3..1a78d09b15fc114eddde1b29b1ecf6fbe3e6c282
100644
--- a/src/frames.h
+++ b/src/frames.h
@@ -874,18 +874,16 @@ class SafeStackFrameIterator BASE_EMBEDDED {
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 SafeStackFrameIterator BASE_EMBEDDED {
};
-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) {}
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index
d15c400f737f7fe6ed3932c5bec62798ab4f9d0b..7461462ccb5cfe8edd3e1d4d88348dad176d5d4b
100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -910,7 +910,7 @@ void ProfileGenerator::RecordTickSample(const
TickSample& sample) {
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) {
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index
96b20f0369fbb472a8653700760e8e30d2dafb0b..6d97110b1d5deecd08e518deb20d3d1870d4ae36
100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -636,7 +636,7 @@ DISABLE_ASAN void TickSample::Trace(Isolate* isolate) {
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.