| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 StackHandler* handler_; | 61 StackHandler* handler_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 | 64 |
| 65 // ------------------------------------------------------------------------- | 65 // ------------------------------------------------------------------------- |
| 66 | 66 |
| 67 | 67 |
| 68 #define INITIALIZE_SINGLETON(type, field) field##_(this), | 68 #define INITIALIZE_SINGLETON(type, field) field##_(this), |
| 69 StackFrameIterator::StackFrameIterator() | 69 StackFrameIterator::StackFrameIterator() |
| 70 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) | 70 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) |
| 71 frame_(NULL), handler_(NULL), thread_(Top::GetCurrentThread()), | 71 frame_(NULL), handler_(NULL), |
| 72 thread_(Isolate::Current()->thread_local_top()), |
| 72 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) { | 73 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) { |
| 73 Reset(); | 74 Reset(); |
| 74 } | 75 } |
| 75 StackFrameIterator::StackFrameIterator(ThreadLocalTop* t) | 76 StackFrameIterator::StackFrameIterator(ThreadLocalTop* t) |
| 76 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) | 77 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) |
| 77 frame_(NULL), handler_(NULL), thread_(t), | 78 frame_(NULL), handler_(NULL), thread_(t), |
| 78 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) { | 79 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) { |
| 79 Reset(); | 80 Reset(); |
| 80 } | 81 } |
| 81 StackFrameIterator::StackFrameIterator(bool use_top, Address fp, Address sp) | 82 StackFrameIterator::StackFrameIterator(bool use_top, Address fp, Address sp) |
| 82 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) | 83 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) |
| 83 frame_(NULL), handler_(NULL), | 84 frame_(NULL), handler_(NULL), |
| 84 thread_(use_top ? Top::GetCurrentThread() : NULL), | 85 thread_(use_top ? Isolate::Current()->thread_local_top() : NULL), |
| 85 fp_(use_top ? NULL : fp), sp_(sp), | 86 fp_(use_top ? NULL : fp), sp_(sp), |
| 86 advance_(use_top ? &StackFrameIterator::AdvanceWithHandler : | 87 advance_(use_top ? &StackFrameIterator::AdvanceWithHandler : |
| 87 &StackFrameIterator::AdvanceWithoutHandler) { | 88 &StackFrameIterator::AdvanceWithoutHandler) { |
| 88 if (use_top || fp != NULL) { | 89 if (use_top || fp != NULL) { |
| 89 Reset(); | 90 Reset(); |
| 90 } | 91 } |
| 91 JavaScriptFrame_.DisableHeapAccess(); | 92 JavaScriptFrame_.DisableHeapAccess(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 #undef INITIALIZE_SINGLETON | 95 #undef INITIALIZE_SINGLETON |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 198 |
| 198 | 199 |
| 199 // ------------------------------------------------------------------------- | 200 // ------------------------------------------------------------------------- |
| 200 | 201 |
| 201 | 202 |
| 202 SafeStackFrameIterator::SafeStackFrameIterator( | 203 SafeStackFrameIterator::SafeStackFrameIterator( |
| 203 Address fp, Address sp, Address low_bound, Address high_bound) : | 204 Address fp, Address sp, Address low_bound, Address high_bound) : |
| 204 low_bound_(low_bound), high_bound_(high_bound), | 205 low_bound_(low_bound), high_bound_(high_bound), |
| 205 is_valid_top_( | 206 is_valid_top_( |
| 206 IsWithinBounds(low_bound, high_bound, | 207 IsWithinBounds(low_bound, high_bound, |
| 207 Top::c_entry_fp(Top::GetCurrentThread())) && | 208 Top::c_entry_fp(Isolate::Current()->thread_local_top())) |
| 208 Top::handler(Top::GetCurrentThread()) != NULL), | 209 && Top::handler(Isolate::Current()->thread_local_top()) != NULL), |
| 209 is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)), | 210 is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)), |
| 210 is_working_iterator_(is_valid_top_ || is_valid_fp_), | 211 is_working_iterator_(is_valid_top_ || is_valid_fp_), |
| 211 iteration_done_(!is_working_iterator_), | 212 iteration_done_(!is_working_iterator_), |
| 212 iterator_(is_valid_top_, is_valid_fp_ ? fp : NULL, sp) { | 213 iterator_(is_valid_top_, is_valid_fp_ ? fp : NULL, sp) { |
| 213 } | 214 } |
| 214 | 215 |
| 215 | 216 |
| 216 void SafeStackFrameIterator::Advance() { | 217 void SafeStackFrameIterator::Advance() { |
| 217 ASSERT(is_working_iterator_); | 218 ASSERT(is_working_iterator_); |
| 218 ASSERT(!done()); | 219 ASSERT(!done()); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 ZoneList<StackFrame*> list(10); | 815 ZoneList<StackFrame*> list(10); |
| 815 for (StackFrameIterator it; !it.done(); it.Advance()) { | 816 for (StackFrameIterator it; !it.done(); it.Advance()) { |
| 816 StackFrame* frame = AllocateFrameCopy(it.frame()); | 817 StackFrame* frame = AllocateFrameCopy(it.frame()); |
| 817 list.Add(frame); | 818 list.Add(frame); |
| 818 } | 819 } |
| 819 return list.ToVector(); | 820 return list.ToVector(); |
| 820 } | 821 } |
| 821 | 822 |
| 822 | 823 |
| 823 } } // namespace v8::internal | 824 } } // namespace v8::internal |
| OLD | NEW |