| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "frames-inl.h" | 30 #include "frames-inl.h" |
| 31 #include "mark-compact.h" | 31 #include "mark-compact.h" |
| 32 #include "scopeinfo.h" | 32 #include "scopeinfo.h" |
| 33 #include "string-stream.h" | 33 #include "string-stream.h" |
| 34 #include "top.h" | |
| 35 | 34 |
| 36 namespace v8 { | 35 namespace v8 { |
| 37 namespace internal { | 36 namespace internal { |
| 38 | 37 |
| 39 // Iterator that supports traversing the stack handlers of a | 38 // Iterator that supports traversing the stack handlers of a |
| 40 // particular frame. Needs to know the top of the handler chain. | 39 // particular frame. Needs to know the top of the handler chain. |
| 41 class StackHandlerIterator BASE_EMBEDDED { | 40 class StackHandlerIterator BASE_EMBEDDED { |
| 42 public: | 41 public: |
| 43 StackHandlerIterator(const StackFrame* frame, StackHandler* handler) | 42 StackHandlerIterator(const StackFrame* frame, StackHandler* handler) |
| 44 : limit_(frame->fp()), handler_(handler) { | 43 : limit_(frame->fp()), handler_(handler) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 StackFrame::State state; | 123 StackFrame::State state; |
| 125 StackFrame::Type type = frame_->GetCallerState(&state); | 124 StackFrame::Type type = frame_->GetCallerState(&state); |
| 126 frame_ = SingletonFor(type, &state); | 125 frame_ = SingletonFor(type, &state); |
| 127 } | 126 } |
| 128 | 127 |
| 129 | 128 |
| 130 void StackFrameIterator::Reset() { | 129 void StackFrameIterator::Reset() { |
| 131 StackFrame::State state; | 130 StackFrame::State state; |
| 132 StackFrame::Type type; | 131 StackFrame::Type type; |
| 133 if (thread_ != NULL) { | 132 if (thread_ != NULL) { |
| 134 type = ExitFrame::GetStateForFramePointer(Top::c_entry_fp(thread_), &state); | 133 type = ExitFrame::GetStateForFramePointer( |
| 135 handler_ = StackHandler::FromAddress(Top::handler(thread_)); | 134 Isolate::c_entry_fp(thread_), &state); |
| 135 handler_ = StackHandler::FromAddress( |
| 136 Isolate::handler(thread_)); |
| 136 } else { | 137 } else { |
| 137 ASSERT(fp_ != NULL); | 138 ASSERT(fp_ != NULL); |
| 138 state.fp = fp_; | 139 state.fp = fp_; |
| 139 state.sp = sp_; | 140 state.sp = sp_; |
| 140 state.pc_address = | 141 state.pc_address = |
| 141 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp_)); | 142 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp_)); |
| 142 type = StackFrame::ComputeType(&state); | 143 type = StackFrame::ComputeType(&state); |
| 143 if (SingletonFor(type) == NULL) return; | 144 if (SingletonFor(type) == NULL) return; |
| 144 } | 145 } |
| 145 frame_ = SingletonFor(type, &state); | 146 frame_ = SingletonFor(type, &state); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 199 |
| 199 | 200 |
| 200 // ------------------------------------------------------------------------- | 201 // ------------------------------------------------------------------------- |
| 201 | 202 |
| 202 | 203 |
| 203 SafeStackFrameIterator::SafeStackFrameIterator( | 204 SafeStackFrameIterator::SafeStackFrameIterator( |
| 204 Address fp, Address sp, Address low_bound, Address high_bound) : | 205 Address fp, Address sp, Address low_bound, Address high_bound) : |
| 205 low_bound_(low_bound), high_bound_(high_bound), | 206 low_bound_(low_bound), high_bound_(high_bound), |
| 206 is_valid_top_( | 207 is_valid_top_( |
| 207 IsWithinBounds(low_bound, high_bound, | 208 IsWithinBounds(low_bound, high_bound, |
| 208 Top::c_entry_fp(Isolate::Current()->thread_local_top())) | 209 Isolate::c_entry_fp( |
| 209 && Top::handler(Isolate::Current()->thread_local_top()) != NULL), | 210 Isolate::Current()->thread_local_top())) && |
| 211 Isolate::handler(Isolate::Current()->thread_local_top()) != NULL), |
| 210 is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)), | 212 is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)), |
| 211 is_working_iterator_(is_valid_top_ || is_valid_fp_), | 213 is_working_iterator_(is_valid_top_ || is_valid_fp_), |
| 212 iteration_done_(!is_working_iterator_), | 214 iteration_done_(!is_working_iterator_), |
| 213 iterator_(is_valid_top_, is_valid_fp_ ? fp : NULL, sp) { | 215 iterator_(is_valid_top_, is_valid_fp_ ? fp : NULL, sp) { |
| 214 } | 216 } |
| 215 | 217 |
| 216 | 218 |
| 217 void SafeStackFrameIterator::Advance() { | 219 void SafeStackFrameIterator::Advance() { |
| 218 ASSERT(is_working_iterator_); | 220 ASSERT(is_working_iterator_); |
| 219 ASSERT(!done()); | 221 ASSERT(!done()); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 ZoneList<StackFrame*> list(10); | 817 ZoneList<StackFrame*> list(10); |
| 816 for (StackFrameIterator it; !it.done(); it.Advance()) { | 818 for (StackFrameIterator it; !it.done(); it.Advance()) { |
| 817 StackFrame* frame = AllocateFrameCopy(it.frame()); | 819 StackFrame* frame = AllocateFrameCopy(it.frame()); |
| 818 list.Add(frame); | 820 list.Add(frame); |
| 819 } | 821 } |
| 820 return list.ToVector(); | 822 return list.ToVector(); |
| 821 } | 823 } |
| 822 | 824 |
| 823 | 825 |
| 824 } } // namespace v8::internal | 826 } } // namespace v8::internal |
| OLD | NEW |