| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // Get the number of registers in a given register list. | 44 // Get the number of registers in a given register list. |
| 45 int NumRegs(RegList list); | 45 int NumRegs(RegList list); |
| 46 | 46 |
| 47 void SetUpJSCallerSavedCodeData(); | 47 void SetUpJSCallerSavedCodeData(); |
| 48 | 48 |
| 49 // Return the code of the n-th saved register available to JavaScript. | 49 // Return the code of the n-th saved register available to JavaScript. |
| 50 int JSCallerSavedCode(int n); | 50 int JSCallerSavedCode(int n); |
| 51 | 51 |
| 52 | 52 |
| 53 // Forward declarations. | 53 // Forward declarations. |
| 54 class ExternalCallbackScope; |
| 54 class StackFrameIteratorBase; | 55 class StackFrameIteratorBase; |
| 55 class ThreadLocalTop; | 56 class ThreadLocalTop; |
| 56 class Isolate; | 57 class Isolate; |
| 57 | 58 |
| 58 class InnerPointerToCodeCache { | 59 class InnerPointerToCodeCache { |
| 59 public: | 60 public: |
| 60 struct InnerPointerToCodeCacheEntry { | 61 struct InnerPointerToCodeCacheEntry { |
| 61 Address inner_pointer; | 62 Address inner_pointer; |
| 62 Code* code; | 63 Code* code; |
| 63 SafepointEntry safepoint_entry; | 64 SafepointEntry safepoint_entry; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 89 | 90 |
| 90 | 91 |
| 91 class StackHandlerConstants : public AllStatic { | 92 class StackHandlerConstants : public AllStatic { |
| 92 public: | 93 public: |
| 93 static const int kNextOffset = 0 * kPointerSize; | 94 static const int kNextOffset = 0 * kPointerSize; |
| 94 static const int kCodeOffset = 1 * kPointerSize; | 95 static const int kCodeOffset = 1 * kPointerSize; |
| 95 static const int kStateOffset = 2 * kPointerSize; | 96 static const int kStateOffset = 2 * kPointerSize; |
| 96 static const int kContextOffset = 3 * kPointerSize; | 97 static const int kContextOffset = 3 * kPointerSize; |
| 97 static const int kFPOffset = 4 * kPointerSize; | 98 static const int kFPOffset = 4 * kPointerSize; |
| 98 | 99 |
| 99 static const int kSize = kFPOffset + kPointerSize; | 100 static const int kSize = kFPOffset + kFPOnStackSize; |
| 100 static const int kSlotCount = kSize >> kPointerSizeLog2; | 101 static const int kSlotCount = kSize >> kPointerSizeLog2; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 | 104 |
| 104 class StackHandler BASE_EMBEDDED { | 105 class StackHandler BASE_EMBEDDED { |
| 105 public: | 106 public: |
| 106 enum Kind { | 107 enum Kind { |
| 107 JS_ENTRY, | 108 JS_ENTRY, |
| 108 CATCH, | 109 CATCH, |
| 109 FINALLY, | 110 FINALLY, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 V(CONSTRUCT, ConstructFrame) \ | 166 V(CONSTRUCT, ConstructFrame) \ |
| 166 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) | 167 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
| 167 | 168 |
| 168 | 169 |
| 169 class StandardFrameConstants : public AllStatic { | 170 class StandardFrameConstants : public AllStatic { |
| 170 public: | 171 public: |
| 171 // Fixed part of the frame consists of return address, caller fp, | 172 // Fixed part of the frame consists of return address, caller fp, |
| 172 // context and function. | 173 // context and function. |
| 173 // StandardFrame::IterateExpressions assumes that kContextOffset is the last | 174 // StandardFrame::IterateExpressions assumes that kContextOffset is the last |
| 174 // object pointer. | 175 // object pointer. |
| 175 static const int kFixedFrameSize = 4 * kPointerSize; | 176 static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize + |
| 177 2 * kPointerSize; |
| 176 static const int kExpressionsOffset = -3 * kPointerSize; | 178 static const int kExpressionsOffset = -3 * kPointerSize; |
| 177 static const int kMarkerOffset = -2 * kPointerSize; | 179 static const int kMarkerOffset = -2 * kPointerSize; |
| 178 static const int kContextOffset = -1 * kPointerSize; | 180 static const int kContextOffset = -1 * kPointerSize; |
| 179 static const int kCallerFPOffset = 0 * kPointerSize; | 181 static const int kCallerFPOffset = 0 * kPointerSize; |
| 180 static const int kCallerPCOffset = +1 * kPointerSize; | 182 static const int kCallerPCOffset = +1 * kFPOnStackSize; |
| 181 static const int kCallerSPOffset = +2 * kPointerSize; | 183 static const int kCallerSPOffset = +2 * kPCOnStackSize; |
| 182 }; | 184 }; |
| 183 | 185 |
| 184 | 186 |
| 185 // Abstract base class for all stack frames. | 187 // Abstract base class for all stack frames. |
| 186 class StackFrame BASE_EMBEDDED { | 188 class StackFrame BASE_EMBEDDED { |
| 187 public: | 189 public: |
| 188 #define DECLARE_TYPE(type, ignore) type, | 190 #define DECLARE_TYPE(type, ignore) type, |
| 189 enum Type { | 191 enum Type { |
| 190 NONE = 0, | 192 NONE = 0, |
| 191 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 193 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 bool IsValidFrame(); | 882 bool IsValidFrame(); |
| 881 }; | 883 }; |
| 882 | 884 |
| 883 | 885 |
| 884 class SafeStackFrameIterator: public StackFrameIteratorBase { | 886 class SafeStackFrameIterator: public StackFrameIteratorBase { |
| 885 public: | 887 public: |
| 886 SafeStackFrameIterator(Isolate* isolate, | 888 SafeStackFrameIterator(Isolate* isolate, |
| 887 Address fp, Address sp, | 889 Address fp, Address sp, |
| 888 Address js_entry_sp); | 890 Address js_entry_sp); |
| 889 | 891 |
| 890 inline JavaScriptFrame* frame() const; | 892 inline StackFrame* frame() const; |
| 891 void Advance(); | 893 void Advance(); |
| 892 | 894 |
| 893 StackFrame::Type top_frame_type() const { return top_frame_type_; } | 895 StackFrame::Type top_frame_type() const { return top_frame_type_; } |
| 894 | 896 |
| 895 private: | 897 private: |
| 896 void AdvanceOneFrame(); | 898 void AdvanceOneFrame(); |
| 897 | 899 |
| 898 bool IsValidStackAddress(Address addr) const { | 900 bool IsValidStackAddress(Address addr) const { |
| 899 return low_bound_ <= addr && addr <= high_bound_; | 901 return low_bound_ <= addr && addr <= high_bound_; |
| 900 } | 902 } |
| 901 bool IsValidFrame(StackFrame* frame) const; | 903 bool IsValidFrame(StackFrame* frame) const; |
| 902 bool IsValidCaller(StackFrame* frame); | 904 bool IsValidCaller(StackFrame* frame); |
| 903 bool IsValidExitFrame(Address fp) const; | 905 bool IsValidExitFrame(Address fp) const; |
| 904 bool IsValidTop(ThreadLocalTop* top) const; | 906 bool IsValidTop(ThreadLocalTop* top) const; |
| 905 | 907 |
| 906 const Address low_bound_; | 908 const Address low_bound_; |
| 907 const Address high_bound_; | 909 const Address high_bound_; |
| 908 StackFrame::Type top_frame_type_; | 910 StackFrame::Type top_frame_type_; |
| 911 ExternalCallbackScope* external_callback_scope_; |
| 909 }; | 912 }; |
| 910 | 913 |
| 911 | 914 |
| 912 class StackFrameLocator BASE_EMBEDDED { | 915 class StackFrameLocator BASE_EMBEDDED { |
| 913 public: | 916 public: |
| 914 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} | 917 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} |
| 915 | 918 |
| 916 // Find the nth JavaScript frame on the stack. The caller must | 919 // Find the nth JavaScript frame on the stack. The caller must |
| 917 // guarantee that such a frame exists. | 920 // guarantee that such a frame exists. |
| 918 JavaScriptFrame* FindJavaScriptFrame(int n); | 921 JavaScriptFrame* FindJavaScriptFrame(int n); |
| 919 | 922 |
| 920 private: | 923 private: |
| 921 StackFrameIterator iterator_; | 924 StackFrameIterator iterator_; |
| 922 }; | 925 }; |
| 923 | 926 |
| 924 | 927 |
| 925 // Reads all frames on the current stack and copies them into the current | 928 // Reads all frames on the current stack and copies them into the current |
| 926 // zone memory. | 929 // zone memory. |
| 927 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 930 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 928 | 931 |
| 929 } } // namespace v8::internal | 932 } } // namespace v8::internal |
| 930 | 933 |
| 931 #endif // V8_FRAMES_H_ | 934 #endif // V8_FRAMES_H_ |
| OLD | NEW |