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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 bool IsValidFrame(); | 867 bool IsValidFrame(); |
868 }; | 868 }; |
869 | 869 |
870 | 870 |
871 class SafeStackFrameIterator BASE_EMBEDDED { | 871 class SafeStackFrameIterator BASE_EMBEDDED { |
872 public: | 872 public: |
873 SafeStackFrameIterator(Isolate* isolate, | 873 SafeStackFrameIterator(Isolate* isolate, |
874 Address fp, Address sp, | 874 Address fp, Address sp, |
875 Address low_bound, Address high_bound); | 875 Address low_bound, Address high_bound); |
876 | 876 |
877 StackFrame* frame() const { | 877 inline JavaScriptFrame* frame() const; |
878 ASSERT(!iteration_done_); | |
879 return iterator_.frame(); | |
880 } | |
881 | 878 |
882 bool done() const { return iteration_done_ || iterator_.done(); } | 879 bool done() const { return iteration_done_ || iterator_.done(); } |
883 | |
884 void Advance(); | 880 void Advance(); |
885 | 881 |
886 static bool is_active(Isolate* isolate); | 882 static bool is_active(Isolate* isolate); |
887 | 883 |
888 private: | 884 private: |
| 885 void AdvanceOneFrame(); |
| 886 |
889 static bool IsWithinBounds( | 887 static bool IsWithinBounds( |
890 Address low_bound, Address high_bound, Address addr) { | 888 Address low_bound, Address high_bound, Address addr) { |
891 return low_bound <= addr && addr <= high_bound; | 889 return low_bound <= addr && addr <= high_bound; |
892 } | 890 } |
893 | 891 |
894 class StackAddressValidator { | 892 class StackAddressValidator { |
895 public: | 893 public: |
896 StackAddressValidator(Address low_bound, Address high_bound) | 894 StackAddressValidator(Address low_bound, Address high_bound) |
897 : low_bound_(low_bound), high_bound_(high_bound) { } | 895 : low_bound_(low_bound), high_bound_(high_bound) { } |
898 bool IsValid(Address addr) const { | 896 bool IsValid(Address addr) const { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 | 936 |
939 ActiveCountMaintainer maintainer_; | 937 ActiveCountMaintainer maintainer_; |
940 StackAddressValidator stack_validator_; | 938 StackAddressValidator stack_validator_; |
941 const bool is_valid_top_; | 939 const bool is_valid_top_; |
942 const bool is_valid_fp_; | 940 const bool is_valid_fp_; |
943 bool iteration_done_; | 941 bool iteration_done_; |
944 StackFrameIterator iterator_; | 942 StackFrameIterator iterator_; |
945 }; | 943 }; |
946 | 944 |
947 | 945 |
948 class SafeStackTraceFrameIterator BASE_EMBEDDED { | |
949 public: | |
950 SafeStackTraceFrameIterator(Isolate* isolate, | |
951 Address fp, | |
952 Address sp, | |
953 Address low_bound, | |
954 Address high_bound); | |
955 | |
956 inline JavaScriptFrame* frame() const; | |
957 | |
958 bool done() const { return iterator_.done(); } | |
959 void Advance(); | |
960 | |
961 private: | |
962 SafeStackFrameIterator iterator_; | |
963 }; | |
964 | |
965 | |
966 class StackFrameLocator BASE_EMBEDDED { | 946 class StackFrameLocator BASE_EMBEDDED { |
967 public: | 947 public: |
968 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} | 948 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} |
969 | 949 |
970 // Find the nth JavaScript frame on the stack. The caller must | 950 // Find the nth JavaScript frame on the stack. The caller must |
971 // guarantee that such a frame exists. | 951 // guarantee that such a frame exists. |
972 JavaScriptFrame* FindJavaScriptFrame(int n); | 952 JavaScriptFrame* FindJavaScriptFrame(int n); |
973 | 953 |
974 private: | 954 private: |
975 StackFrameIterator iterator_; | 955 StackFrameIterator iterator_; |
976 }; | 956 }; |
977 | 957 |
978 | 958 |
979 // Reads all frames on the current stack and copies them into the current | 959 // Reads all frames on the current stack and copies them into the current |
980 // zone memory. | 960 // zone memory. |
981 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 961 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
982 | 962 |
983 } } // namespace v8::internal | 963 } } // namespace v8::internal |
984 | 964 |
985 #endif // V8_FRAMES_H_ | 965 #endif // V8_FRAMES_H_ |
OLD | NEW |