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 17 matching lines...) Expand all Loading... |
28 #ifndef V8_FRAMES_H_ | 28 #ifndef V8_FRAMES_H_ |
29 #define V8_FRAMES_H_ | 29 #define V8_FRAMES_H_ |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "handles.h" | 32 #include "handles.h" |
33 #include "safepoint-table.h" | 33 #include "safepoint-table.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 #if defined(V8_TARGET_ARCH_A64) | 38 #if V8_TARGET_ARCH_A64 |
39 typedef uint64_t RegList; | 39 typedef uint64_t RegList; |
40 #else | 40 #else |
41 typedef uint32_t RegList; | 41 typedef uint32_t RegList; |
42 #endif | 42 #endif |
43 | 43 |
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 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 virtual void Iterate(ObjectVisitor* v) const = 0; | 295 virtual void Iterate(ObjectVisitor* v) const = 0; |
296 static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder); | 296 static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder); |
297 | 297 |
298 // Sets a callback function for return-address rewriting profilers | 298 // Sets a callback function for return-address rewriting profilers |
299 // to resolve the location of a return address to the location of the | 299 // to resolve the location of a return address to the location of the |
300 // profiler's stashed return address. | 300 // profiler's stashed return address. |
301 static void SetReturnAddressLocationResolver( | 301 static void SetReturnAddressLocationResolver( |
302 ReturnAddressLocationResolver resolver); | 302 ReturnAddressLocationResolver resolver); |
303 | 303 |
| 304 // Resolves pc_address through the resolution address function if one is set. |
| 305 static inline Address* ResolveReturnAddressLocation(Address* pc_address); |
| 306 |
| 307 |
304 // Printing support. | 308 // Printing support. |
305 enum PrintMode { OVERVIEW, DETAILS }; | 309 enum PrintMode { OVERVIEW, DETAILS }; |
306 virtual void Print(StringStream* accumulator, | 310 virtual void Print(StringStream* accumulator, |
307 PrintMode mode, | 311 PrintMode mode, |
308 int index) const { } | 312 int index) const { } |
309 | 313 |
310 Isolate* isolate() const { return isolate_; } | 314 Isolate* isolate() const { return isolate_; } |
311 | 315 |
312 protected: | 316 protected: |
313 inline explicit StackFrame(StackFrameIteratorBase* iterator); | 317 inline explicit StackFrame(StackFrameIteratorBase* iterator); |
(...skipping 15 matching lines...) Expand all Loading... |
329 | 333 |
330 #ifdef DEBUG | 334 #ifdef DEBUG |
331 bool can_access_heap_objects() const; | 335 bool can_access_heap_objects() const; |
332 #endif | 336 #endif |
333 | 337 |
334 private: | 338 private: |
335 const StackFrameIteratorBase* iterator_; | 339 const StackFrameIteratorBase* iterator_; |
336 Isolate* isolate_; | 340 Isolate* isolate_; |
337 State state_; | 341 State state_; |
338 | 342 |
| 343 static ReturnAddressLocationResolver return_address_location_resolver_; |
| 344 |
339 // Fill in the state of the calling frame. | 345 // Fill in the state of the calling frame. |
340 virtual void ComputeCallerState(State* state) const = 0; | 346 virtual void ComputeCallerState(State* state) const = 0; |
341 | 347 |
342 // Get the type and the state of the calling frame. | 348 // Get the type and the state of the calling frame. |
343 virtual Type GetCallerState(State* state) const; | 349 virtual Type GetCallerState(State* state) const; |
344 | 350 |
345 static const intptr_t kIsolateTag = 1; | 351 static const intptr_t kIsolateTag = 1; |
346 | 352 |
347 friend class StackFrameIterator; | 353 friend class StackFrameIterator; |
348 friend class StackFrameIteratorBase; | 354 friend class StackFrameIteratorBase; |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 | 878 |
873 private: | 879 private: |
874 bool IsValidFrame(); | 880 bool IsValidFrame(); |
875 }; | 881 }; |
876 | 882 |
877 | 883 |
878 class SafeStackFrameIterator: public StackFrameIteratorBase { | 884 class SafeStackFrameIterator: public StackFrameIteratorBase { |
879 public: | 885 public: |
880 SafeStackFrameIterator(Isolate* isolate, | 886 SafeStackFrameIterator(Isolate* isolate, |
881 Address fp, Address sp, | 887 Address fp, Address sp, |
882 Address low_bound, Address high_bound); | 888 Address js_entry_sp); |
883 | 889 |
884 inline JavaScriptFrame* frame() const; | 890 inline JavaScriptFrame* frame() const; |
885 void Advance(); | 891 void Advance(); |
886 | 892 |
| 893 StackFrame::Type top_frame_type() const { return top_frame_type_; } |
| 894 |
887 private: | 895 private: |
888 void AdvanceOneFrame(); | 896 void AdvanceOneFrame(); |
889 | 897 |
890 bool IsValidStackAddress(Address addr) const { | 898 bool IsValidStackAddress(Address addr) const { |
891 return low_bound_ <= addr && addr <= high_bound_; | 899 return low_bound_ <= addr && addr <= high_bound_; |
892 } | 900 } |
893 bool IsValidFrame(StackFrame* frame) const; | 901 bool IsValidFrame(StackFrame* frame) const; |
894 bool IsValidCaller(StackFrame* frame); | 902 bool IsValidCaller(StackFrame* frame); |
895 bool IsValidExitFrame(Address fp) const; | 903 bool IsValidExitFrame(Address fp) const; |
896 bool IsValidTop(ThreadLocalTop* top) const; | 904 bool IsValidTop(ThreadLocalTop* top) const; |
897 | 905 |
898 const Address low_bound_; | 906 const Address low_bound_; |
899 const Address high_bound_; | 907 const Address high_bound_; |
| 908 StackFrame::Type top_frame_type_; |
900 }; | 909 }; |
901 | 910 |
902 | 911 |
903 class StackFrameLocator BASE_EMBEDDED { | 912 class StackFrameLocator BASE_EMBEDDED { |
904 public: | 913 public: |
905 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} | 914 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} |
906 | 915 |
907 // Find the nth JavaScript frame on the stack. The caller must | 916 // Find the nth JavaScript frame on the stack. The caller must |
908 // guarantee that such a frame exists. | 917 // guarantee that such a frame exists. |
909 JavaScriptFrame* FindJavaScriptFrame(int n); | 918 JavaScriptFrame* FindJavaScriptFrame(int n); |
910 | 919 |
911 private: | 920 private: |
912 StackFrameIterator iterator_; | 921 StackFrameIterator iterator_; |
913 }; | 922 }; |
914 | 923 |
915 | 924 |
916 // Reads all frames on the current stack and copies them into the current | 925 // Reads all frames on the current stack and copies them into the current |
917 // zone memory. | 926 // zone memory. |
918 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 927 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
919 | 928 |
920 } } // namespace v8::internal | 929 } } // namespace v8::internal |
921 | 930 |
922 #endif // V8_FRAMES_H_ | 931 #endif // V8_FRAMES_H_ |
OLD | NEW |