| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 StackFrameIterator iterator_; | 853 StackFrameIterator iterator_; |
| 854 }; | 854 }; |
| 855 | 855 |
| 856 | 856 |
| 857 // NOTE: The stack trace frame iterator is an iterator that only | 857 // NOTE: The stack trace frame iterator is an iterator that only |
| 858 // traverse proper JavaScript frames; that is JavaScript frames that | 858 // traverse proper JavaScript frames; that is JavaScript frames that |
| 859 // have proper JavaScript functions. This excludes the problematic | 859 // have proper JavaScript functions. This excludes the problematic |
| 860 // functions in runtime.js. | 860 // functions in runtime.js. |
| 861 class StackTraceFrameIterator: public JavaScriptFrameIterator { | 861 class StackTraceFrameIterator: public JavaScriptFrameIterator { |
| 862 public: | 862 public: |
| 863 StackTraceFrameIterator(); | |
| 864 explicit StackTraceFrameIterator(Isolate* isolate); | 863 explicit StackTraceFrameIterator(Isolate* isolate); |
| 865 void Advance(); | 864 void Advance(); |
| 866 | 865 |
| 867 private: | 866 private: |
| 868 bool IsValidFrame(); | 867 bool IsValidFrame(); |
| 869 }; | 868 }; |
| 870 | 869 |
| 871 | 870 |
| 872 class SafeStackFrameIterator BASE_EMBEDDED { | 871 class SafeStackFrameIterator BASE_EMBEDDED { |
| 873 public: | 872 public: |
| 874 SafeStackFrameIterator(Isolate* isolate, | 873 SafeStackFrameIterator(Isolate* isolate, |
| 875 Address fp, Address sp, | 874 Address fp, Address sp, |
| 876 Address low_bound, Address high_bound); | 875 Address low_bound, Address high_bound); |
| 877 | 876 |
| 878 StackFrame* frame() const { | 877 StackFrame* frame() const { |
| 879 ASSERT(is_working_iterator_); | 878 ASSERT(!iteration_done_); |
| 880 return iterator_.frame(); | 879 return iterator_.frame(); |
| 881 } | 880 } |
| 882 | 881 |
| 883 bool done() const { return iteration_done_ ? true : iterator_.done(); } | 882 bool done() const { return iteration_done_ || iterator_.done(); } |
| 884 | 883 |
| 885 void Advance(); | 884 void Advance(); |
| 886 | 885 |
| 887 static bool is_active(Isolate* isolate); | 886 static bool is_active(Isolate* isolate); |
| 888 | 887 |
| 888 private: |
| 889 static bool IsWithinBounds( | 889 static bool IsWithinBounds( |
| 890 Address low_bound, Address high_bound, Address addr) { | 890 Address low_bound, Address high_bound, Address addr) { |
| 891 return low_bound <= addr && addr <= high_bound; | 891 return low_bound <= addr && addr <= high_bound; |
| 892 } | 892 } |
| 893 | 893 |
| 894 private: | |
| 895 class StackAddressValidator { | 894 class StackAddressValidator { |
| 896 public: | 895 public: |
| 897 StackAddressValidator(Address low_bound, Address high_bound) | 896 StackAddressValidator(Address low_bound, Address high_bound) |
| 898 : low_bound_(low_bound), high_bound_(high_bound) { } | 897 : low_bound_(low_bound), high_bound_(high_bound) { } |
| 899 bool IsValid(Address addr) const { | 898 bool IsValid(Address addr) const { |
| 900 return IsWithinBounds(low_bound_, high_bound_, addr); | 899 return IsWithinBounds(low_bound_, high_bound_, addr); |
| 901 } | 900 } |
| 902 private: | 901 private: |
| 903 Address low_bound_; | 902 Address low_bound_; |
| 904 Address high_bound_; | 903 Address high_bound_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 934 explicit ActiveCountMaintainer(Isolate* isolate); | 933 explicit ActiveCountMaintainer(Isolate* isolate); |
| 935 ~ActiveCountMaintainer(); | 934 ~ActiveCountMaintainer(); |
| 936 private: | 935 private: |
| 937 Isolate* isolate_; | 936 Isolate* isolate_; |
| 938 }; | 937 }; |
| 939 | 938 |
| 940 ActiveCountMaintainer maintainer_; | 939 ActiveCountMaintainer maintainer_; |
| 941 StackAddressValidator stack_validator_; | 940 StackAddressValidator stack_validator_; |
| 942 const bool is_valid_top_; | 941 const bool is_valid_top_; |
| 943 const bool is_valid_fp_; | 942 const bool is_valid_fp_; |
| 944 const bool is_working_iterator_; | |
| 945 bool iteration_done_; | 943 bool iteration_done_; |
| 946 StackFrameIterator iterator_; | 944 StackFrameIterator iterator_; |
| 947 }; | 945 }; |
| 948 | 946 |
| 949 | 947 |
| 950 class SafeStackTraceFrameIterator BASE_EMBEDDED { | 948 class SafeStackTraceFrameIterator BASE_EMBEDDED { |
| 951 public: | 949 public: |
| 952 SafeStackTraceFrameIterator(Isolate* isolate, | 950 SafeStackTraceFrameIterator(Isolate* isolate, |
| 953 Address fp, | 951 Address fp, |
| 954 Address sp, | 952 Address sp, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 978 }; | 976 }; |
| 979 | 977 |
| 980 | 978 |
| 981 // Reads all frames on the current stack and copies them into the current | 979 // Reads all frames on the current stack and copies them into the current |
| 982 // zone memory. | 980 // zone memory. |
| 983 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 981 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 984 | 982 |
| 985 } } // namespace v8::internal | 983 } } // namespace v8::internal |
| 986 | 984 |
| 987 #endif // V8_FRAMES_H_ | 985 #endif // V8_FRAMES_H_ |
| OLD | NEW |