}
-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
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) {
}
-void SafeStackFrameIterator::Advance() {
+void SafeStackFrameIterator::AdvanceOneFrame() {
ASSERT(!done());
StackFrame* last_frame = iterator_.frame();
Address last_sp = last_frame->sp(), last_fp = last_frame->fp();
}
-// -------------------------------------------------------------------------
-
-
-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,
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;
};
-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) {}
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) {
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();