| 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 ASSERT(!done()); | 503 ASSERT(!done()); |
| 504 return frame_; | 504 return frame_; |
| 505 } | 505 } |
| 506 | 506 |
| 507 bool done() const { return frame_ == NULL; } | 507 bool done() const { return frame_ == NULL; } |
| 508 void Advance() { (this->*advance_)(); } | 508 void Advance() { (this->*advance_)(); } |
| 509 | 509 |
| 510 // Go back to the first frame. | 510 // Go back to the first frame. |
| 511 void Reset(); | 511 void Reset(); |
| 512 | 512 |
| 513 StackFrameIterator(const StackFrameIterator& original); |
| 514 void operator=(const StackFrameIterator& original); |
| 515 |
| 513 private: | 516 private: |
| 514 #define DECLARE_SINGLETON(ignore, type) type type##_; | 517 #define DECLARE_SINGLETON(ignore, type) type type##_; |
| 515 STACK_FRAME_TYPE_LIST(DECLARE_SINGLETON) | 518 STACK_FRAME_TYPE_LIST(DECLARE_SINGLETON) |
| 516 #undef DECLARE_SINGLETON | 519 #undef DECLARE_SINGLETON |
| 517 StackFrame* frame_; | 520 StackFrame* frame_; |
| 518 StackHandler* handler_; | 521 StackHandler* handler_; |
| 519 ThreadLocalTop* thread_; | 522 ThreadLocalTop* thread_; |
| 520 Address fp_; | 523 Address fp_; |
| 521 Address sp_; | 524 Address sp_; |
| 522 void (StackFrameIterator::*advance_)(); | 525 void (StackFrameIterator::*advance_)(); |
| 523 | 526 |
| 524 StackHandler* handler() const { | 527 StackHandler* handler() const { |
| 525 ASSERT(!done()); | 528 ASSERT(!done()); |
| 526 return handler_; | 529 return handler_; |
| 527 } | 530 } |
| 528 | 531 |
| 529 // Get the type-specific frame singleton in a given state. | 532 // Get the type-specific frame singleton in a given state. |
| 530 StackFrame* SingletonFor(StackFrame::Type type, StackFrame::State* state); | 533 StackFrame* SingletonFor(StackFrame::Type type, StackFrame::State* state); |
| 531 // A helper function, can return a NULL pointer. | 534 // A helper function, can return a NULL pointer. |
| 532 StackFrame* SingletonFor(StackFrame::Type type); | 535 StackFrame* SingletonFor(StackFrame::Type type); |
| 533 | 536 |
| 534 void AdvanceWithHandler(); | 537 void AdvanceWithHandler(); |
| 535 void AdvanceWithoutHandler(); | 538 void AdvanceWithoutHandler(); |
| 536 | 539 |
| 537 friend class StackFrame; | 540 friend class StackFrame; |
| 538 friend class SafeStackFrameIterator; | 541 friend class SafeStackFrameIterator; |
| 539 DISALLOW_COPY_AND_ASSIGN(StackFrameIterator); | |
| 540 }; | 542 }; |
| 541 | 543 |
| 542 | 544 |
| 545 bool operator==(const StackFrameIterator& one, |
| 546 const StackFrameIterator& another); |
| 547 |
| 548 |
| 543 // Iterator that supports iterating through all JavaScript frames. | 549 // Iterator that supports iterating through all JavaScript frames. |
| 544 template<typename Iterator> | 550 template<typename Iterator> |
| 545 class JavaScriptFrameIteratorTemp BASE_EMBEDDED { | 551 class JavaScriptFrameIteratorTemp BASE_EMBEDDED { |
| 546 public: | 552 public: |
| 547 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); } | 553 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); } |
| 548 | 554 |
| 549 explicit JavaScriptFrameIteratorTemp(ThreadLocalTop* thread) : | 555 explicit JavaScriptFrameIteratorTemp(ThreadLocalTop* thread) : |
| 550 iterator_(thread) { | 556 iterator_(thread) { |
| 551 if (!done()) Advance(); | 557 if (!done()) Advance(); |
| 552 } | 558 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 JavaScriptFrame* FindJavaScriptFrame(int n); | 660 JavaScriptFrame* FindJavaScriptFrame(int n); |
| 655 | 661 |
| 656 private: | 662 private: |
| 657 StackFrameIterator iterator_; | 663 StackFrameIterator iterator_; |
| 658 }; | 664 }; |
| 659 | 665 |
| 660 | 666 |
| 661 } } // namespace v8::internal | 667 } } // namespace v8::internal |
| 662 | 668 |
| 663 #endif // V8_FRAMES_H_ | 669 #endif // V8_FRAMES_H_ |
| OLD | NEW |