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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 virtual void GetFunctions(List<JSFunction*>* functions); | 554 virtual void GetFunctions(List<JSFunction*>* functions); |
555 | 555 |
556 // Build a list with summaries for this frame including all inlined frames. | 556 // Build a list with summaries for this frame including all inlined frames. |
557 virtual void Summarize(List<FrameSummary>* frames); | 557 virtual void Summarize(List<FrameSummary>* frames); |
558 | 558 |
559 static JavaScriptFrame* cast(StackFrame* frame) { | 559 static JavaScriptFrame* cast(StackFrame* frame) { |
560 ASSERT(frame->is_java_script()); | 560 ASSERT(frame->is_java_script()); |
561 return static_cast<JavaScriptFrame*>(frame); | 561 return static_cast<JavaScriptFrame*>(frame); |
562 } | 562 } |
563 | 563 |
564 static void PrintTop(FILE* file, bool print_args, bool print_line_number); | 564 static void PrintTop(Isolate* isolate, |
| 565 FILE* file, |
| 566 bool print_args, |
| 567 bool print_line_number); |
565 | 568 |
566 protected: | 569 protected: |
567 inline explicit JavaScriptFrame(StackFrameIterator* iterator); | 570 inline explicit JavaScriptFrame(StackFrameIterator* iterator); |
568 | 571 |
569 virtual Address GetCallerStackPointer() const; | 572 virtual Address GetCallerStackPointer() const; |
570 | 573 |
571 virtual int GetNumberOfIncomingArguments() const; | 574 virtual int GetNumberOfIncomingArguments() const; |
572 | 575 |
573 // Garbage collection support. Iterates over incoming arguments, | 576 // Garbage collection support. Iterates over incoming arguments, |
574 // receiver, and any callee-saved registers. | 577 // receiver, and any callee-saved registers. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 protected: | 734 protected: |
732 inline explicit ConstructFrame(StackFrameIterator* iterator); | 735 inline explicit ConstructFrame(StackFrameIterator* iterator); |
733 | 736 |
734 private: | 737 private: |
735 friend class StackFrameIterator; | 738 friend class StackFrameIterator; |
736 }; | 739 }; |
737 | 740 |
738 | 741 |
739 class StackFrameIterator BASE_EMBEDDED { | 742 class StackFrameIterator BASE_EMBEDDED { |
740 public: | 743 public: |
741 // An iterator that iterates over the current thread's stack, | |
742 // and uses current isolate. | |
743 StackFrameIterator(); | |
744 | |
745 // An iterator that iterates over the isolate's current thread's stack, | 744 // An iterator that iterates over the isolate's current thread's stack, |
746 explicit StackFrameIterator(Isolate* isolate); | 745 explicit StackFrameIterator(Isolate* isolate); |
747 | 746 |
748 // An iterator that iterates over a given thread's stack. | 747 // An iterator that iterates over a given thread's stack. |
749 StackFrameIterator(Isolate* isolate, ThreadLocalTop* t); | 748 StackFrameIterator(Isolate* isolate, ThreadLocalTop* t); |
750 | 749 |
751 // An iterator that can start from a given FP address. | 750 // An iterator that can start from a given FP address. |
752 // If use_top, then work as usual, if fp isn't NULL, use it, | 751 // If use_top, then work as usual, if fp isn't NULL, use it, |
753 // otherwise, do nothing. | 752 // otherwise, do nothing. |
754 StackFrameIterator(Isolate* isolate, bool use_top, Address fp, Address sp); | 753 StackFrameIterator(Isolate* isolate, bool use_top, Address fp, Address sp); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 friend class StackFrame; | 793 friend class StackFrame; |
795 friend class SafeStackFrameIterator; | 794 friend class SafeStackFrameIterator; |
796 DISALLOW_COPY_AND_ASSIGN(StackFrameIterator); | 795 DISALLOW_COPY_AND_ASSIGN(StackFrameIterator); |
797 }; | 796 }; |
798 | 797 |
799 | 798 |
800 // Iterator that supports iterating through all JavaScript frames. | 799 // Iterator that supports iterating through all JavaScript frames. |
801 template<typename Iterator> | 800 template<typename Iterator> |
802 class JavaScriptFrameIteratorTemp BASE_EMBEDDED { | 801 class JavaScriptFrameIteratorTemp BASE_EMBEDDED { |
803 public: | 802 public: |
804 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); } | |
805 | |
806 inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate); | 803 inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate); |
807 | 804 |
808 inline JavaScriptFrameIteratorTemp(Isolate* isolate, ThreadLocalTop* top); | 805 inline JavaScriptFrameIteratorTemp(Isolate* isolate, ThreadLocalTop* top); |
809 | 806 |
810 // Skip frames until the frame with the given id is reached. | 807 // Skip frames until the frame with the given id is reached. |
811 explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); } | 808 explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); } |
812 | 809 |
813 inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id); | 810 inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id); |
814 | 811 |
815 JavaScriptFrameIteratorTemp(Address fp, | 812 JavaScriptFrameIteratorTemp(Address fp, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 public: | 951 public: |
955 explicit SafeStackTraceFrameIterator(Isolate* isolate, | 952 explicit SafeStackTraceFrameIterator(Isolate* isolate, |
956 Address fp, Address sp, | 953 Address fp, Address sp, |
957 Address low_bound, Address high_bound); | 954 Address low_bound, Address high_bound); |
958 void Advance(); | 955 void Advance(); |
959 }; | 956 }; |
960 | 957 |
961 | 958 |
962 class StackFrameLocator BASE_EMBEDDED { | 959 class StackFrameLocator BASE_EMBEDDED { |
963 public: | 960 public: |
| 961 explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {} |
| 962 |
964 // Find the nth JavaScript frame on the stack. The caller must | 963 // Find the nth JavaScript frame on the stack. The caller must |
965 // guarantee that such a frame exists. | 964 // guarantee that such a frame exists. |
966 JavaScriptFrame* FindJavaScriptFrame(int n); | 965 JavaScriptFrame* FindJavaScriptFrame(int n); |
967 | 966 |
968 private: | 967 private: |
969 StackFrameIterator iterator_; | 968 StackFrameIterator iterator_; |
970 }; | 969 }; |
971 | 970 |
972 | 971 |
973 // Reads all frames on the current stack and copies them into the current | 972 // Reads all frames on the current stack and copies them into the current |
974 // zone memory. | 973 // zone memory. |
975 Vector<StackFrame*> CreateStackMap(Zone* zone); | 974 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
976 | 975 |
977 } } // namespace v8::internal | 976 } } // namespace v8::internal |
978 | 977 |
979 #endif // V8_FRAMES_H_ | 978 #endif // V8_FRAMES_H_ |
OLD | NEW |