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

Unified Diff: src/frames-inl.h

Issue 6794019: Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: A couple more changes Created 9 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
« src/frames.cc ('K') | « src/frames.cc ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames-inl.h
diff --git a/src/frames-inl.h b/src/frames-inl.h
index e6eaec0e0ce518591370193e2e5edcf35ee3176b..2962ce75bb2b9a957ef508b49dbdb103dd60f930 100644
--- a/src/frames-inl.h
+++ b/src/frames-inl.h
@@ -89,10 +89,20 @@ inline Address* StackHandler::pc_address() const {
inline StackHandler* StackFrame::top_handler() const {
+ ASSERT((tagged_isolate_ptr_ & kIsolateTag) == 0);
return iterator_->handler();
}
+inline Isolate* StackFrame::isolate() const {
Vitaly Repeshko 2011/04/04 20:37:08 I'm not convinced we need this tricky stuff. Usual
mnaganov (inactive) 2011/04/05 08:28:23 I agree. I was in a premature optimization mood. S
+ if ((tagged_isolate_ptr_ & kIsolateTag) == 0) {
+ return iterator_->isolate();
+ } else {
+ return reinterpret_cast<Isolate*>(tagged_isolate_ptr_ & ~kIsolateTag);
+ }
+}
+
+
inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) {
return isolate->pc_to_code_cache()->GetCacheEntry(pc)->code;
}
@@ -168,6 +178,13 @@ inline Object* JavaScriptFrame::function() const {
template<typename Iterator>
+inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp(
+ Isolate* isolate)
+ : iterator_(isolate) {
+ if (!done()) Advance();
+}
+
+template<typename Iterator>
inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const {
// TODO(1233797): The frame hierarchy needs to change. It's
// problematic that we can't use the safe-cast operator to cast to
@@ -181,11 +198,9 @@ inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const {
template<typename Iterator>
JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp(
- StackFrame::Id id) {
- while (!done()) {
- Advance();
- if (frame()->id() == id) return;
- }
+ Isolate* isolate, StackFrame::Id id)
+ : iterator_(isolate) {
+ AdvanceToId(id);
}
@@ -206,6 +221,15 @@ void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToArgumentsFrame() {
template<typename Iterator>
+void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToId(StackFrame::Id id) {
+ while (!done()) {
+ Advance();
+ if (frame()->id() == id) return;
+ }
+}
+
+
+template<typename Iterator>
void JavaScriptFrameIteratorTemp<Iterator>::Reset() {
iterator_.Reset();
if (!done()) Advance();
« src/frames.cc ('K') | « src/frames.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698