| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 StackFrame* frame() const { | 732 StackFrame* frame() const { |
| 733 ASSERT(is_working_iterator_); | 733 ASSERT(is_working_iterator_); |
| 734 return iterator_.frame(); | 734 return iterator_.frame(); |
| 735 } | 735 } |
| 736 | 736 |
| 737 bool done() const { return iteration_done_ ? true : iterator_.done(); } | 737 bool done() const { return iteration_done_ ? true : iterator_.done(); } |
| 738 | 738 |
| 739 void Advance(); | 739 void Advance(); |
| 740 void Reset(); | 740 void Reset(); |
| 741 | 741 |
| 742 static bool is_active(Isolate* isolate); | 742 static bool is_active() { return active_count_ > 0; } |
| 743 | 743 |
| 744 static bool IsWithinBounds( | 744 static bool IsWithinBounds( |
| 745 Address low_bound, Address high_bound, Address addr) { | 745 Address low_bound, Address high_bound, Address addr) { |
| 746 return low_bound <= addr && addr <= high_bound; | 746 return low_bound <= addr && addr <= high_bound; |
| 747 } | 747 } |
| 748 | 748 |
| 749 private: | 749 private: |
| 750 class StackAddressValidator { | 750 class StackAddressValidator { |
| 751 public: | 751 public: |
| 752 StackAddressValidator(Address low_bound, Address high_bound) | 752 StackAddressValidator(Address low_bound, Address high_bound) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 779 static bool IsValidTop(Isolate* isolate, | 779 static bool IsValidTop(Isolate* isolate, |
| 780 Address low_bound, Address high_bound); | 780 Address low_bound, Address high_bound); |
| 781 | 781 |
| 782 // This is a nasty hack to make sure the active count is incremented | 782 // This is a nasty hack to make sure the active count is incremented |
| 783 // before the constructor for the embedded iterator is invoked. This | 783 // before the constructor for the embedded iterator is invoked. This |
| 784 // is needed because the constructor will start looking at frames | 784 // is needed because the constructor will start looking at frames |
| 785 // right away and we need to make sure it doesn't start inspecting | 785 // right away and we need to make sure it doesn't start inspecting |
| 786 // heap objects. | 786 // heap objects. |
| 787 class ActiveCountMaintainer BASE_EMBEDDED { | 787 class ActiveCountMaintainer BASE_EMBEDDED { |
| 788 public: | 788 public: |
| 789 explicit ActiveCountMaintainer(Isolate* isolate); | 789 ActiveCountMaintainer() { active_count_++; } |
| 790 ~ActiveCountMaintainer(); | 790 ~ActiveCountMaintainer() { active_count_--; } |
| 791 private: | |
| 792 Isolate* isolate_; | |
| 793 }; | 791 }; |
| 794 | 792 |
| 795 ActiveCountMaintainer maintainer_; | 793 ActiveCountMaintainer maintainer_; |
| 794 // TODO(isolates): this is dangerous. |
| 795 static int active_count_; |
| 796 StackAddressValidator stack_validator_; | 796 StackAddressValidator stack_validator_; |
| 797 const bool is_valid_top_; | 797 const bool is_valid_top_; |
| 798 const bool is_valid_fp_; | 798 const bool is_valid_fp_; |
| 799 const bool is_working_iterator_; | 799 const bool is_working_iterator_; |
| 800 bool iteration_done_; | 800 bool iteration_done_; |
| 801 StackFrameIterator iterator_; | 801 StackFrameIterator iterator_; |
| 802 }; | 802 }; |
| 803 | 803 |
| 804 | 804 |
| 805 #ifdef ENABLE_LOGGING_AND_PROFILING | 805 #ifdef ENABLE_LOGGING_AND_PROFILING |
| (...skipping 22 matching lines...) Expand all Loading... |
| 828 }; | 828 }; |
| 829 | 829 |
| 830 | 830 |
| 831 // Reads all frames on the current stack and copies them into the current | 831 // Reads all frames on the current stack and copies them into the current |
| 832 // zone memory. | 832 // zone memory. |
| 833 Vector<StackFrame*> CreateStackMap(); | 833 Vector<StackFrame*> CreateStackMap(); |
| 834 | 834 |
| 835 } } // namespace v8::internal | 835 } } // namespace v8::internal |
| 836 | 836 |
| 837 #endif // V8_FRAMES_H_ | 837 #endif // V8_FRAMES_H_ |
| OLD | NEW |