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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 V(EXIT, ExitFrame) \ | 136 V(EXIT, ExitFrame) \ |
137 V(JAVA_SCRIPT, JavaScriptFrame) \ | 137 V(JAVA_SCRIPT, JavaScriptFrame) \ |
138 V(OPTIMIZED, OptimizedFrame) \ | 138 V(OPTIMIZED, OptimizedFrame) \ |
139 V(STUB, StubFrame) \ | 139 V(STUB, StubFrame) \ |
140 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ | 140 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ |
141 V(INTERNAL, InternalFrame) \ | 141 V(INTERNAL, InternalFrame) \ |
142 V(CONSTRUCT, ConstructFrame) \ | 142 V(CONSTRUCT, ConstructFrame) \ |
143 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) | 143 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
144 | 144 |
145 | 145 |
| 146 class StandardFrameConstants : public AllStatic { |
| 147 public: |
| 148 // Fixed part of the frame consists of return address, caller fp, |
| 149 // context and function. |
| 150 // StandardFrame::IterateExpressions assumes that kContextOffset is the last |
| 151 // object pointer. |
| 152 static const int kFixedFrameSize = 4 * kPointerSize; |
| 153 static const int kExpressionsOffset = -3 * kPointerSize; |
| 154 static const int kMarkerOffset = -2 * kPointerSize; |
| 155 static const int kContextOffset = -1 * kPointerSize; |
| 156 static const int kCallerFPOffset = 0 * kPointerSize; |
| 157 static const int kCallerPCOffset = +1 * kPointerSize; |
| 158 static const int kCallerSPOffset = +2 * kPointerSize; |
| 159 }; |
| 160 |
| 161 |
146 // Abstract base class for all stack frames. | 162 // Abstract base class for all stack frames. |
147 class StackFrame BASE_EMBEDDED { | 163 class StackFrame BASE_EMBEDDED { |
148 public: | 164 public: |
149 #define DECLARE_TYPE(type, ignore) type, | 165 #define DECLARE_TYPE(type, ignore) type, |
150 enum Type { | 166 enum Type { |
151 NONE = 0, | 167 NONE = 0, |
152 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 168 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
153 NUMBER_OF_TYPES, | 169 NUMBER_OF_TYPES, |
154 // Used by FrameScope to indicate that the stack frame is constructed | 170 // Used by FrameScope to indicate that the stack frame is constructed |
155 // manually and the FrameScope does not need to emit code. | 171 // manually and the FrameScope does not need to emit code. |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 protected: | 681 protected: |
666 inline explicit InternalFrame(StackFrameIterator* iterator); | 682 inline explicit InternalFrame(StackFrameIterator* iterator); |
667 | 683 |
668 virtual Address GetCallerStackPointer() const; | 684 virtual Address GetCallerStackPointer() const; |
669 | 685 |
670 private: | 686 private: |
671 friend class StackFrameIterator; | 687 friend class StackFrameIterator; |
672 }; | 688 }; |
673 | 689 |
674 | 690 |
675 class StubFailureTrampolineFrame: public InternalFrame { | 691 class StubFailureTrampolineFrame: public StandardFrame { |
676 public: | 692 public: |
| 693 // sizeof(Arguments) - sizeof(Arguments*) is 3 * kPointerSize), but the |
| 694 // presubmit script complains about using sizeof() on a type. |
| 695 static const int kFirstRegisterParameterFrameOffset = |
| 696 StandardFrameConstants::kMarkerOffset - 3 * kPointerSize; |
| 697 |
| 698 static const int kCallerStackParameterCountFrameOffset = |
| 699 StandardFrameConstants::kMarkerOffset - 2 * kPointerSize; |
| 700 |
677 virtual Type type() const { return STUB_FAILURE_TRAMPOLINE; } | 701 virtual Type type() const { return STUB_FAILURE_TRAMPOLINE; } |
678 | 702 |
| 703 // Get the code associated with this frame. |
| 704 // This method could be called during marking phase of GC. |
| 705 virtual Code* unchecked_code() const; |
| 706 |
679 virtual void Iterate(ObjectVisitor* v) const; | 707 virtual void Iterate(ObjectVisitor* v) const; |
680 | 708 |
681 protected: | 709 protected: |
682 inline explicit StubFailureTrampolineFrame( | 710 inline explicit StubFailureTrampolineFrame( |
683 StackFrameIterator* iterator); | 711 StackFrameIterator* iterator); |
684 | 712 |
| 713 virtual Address GetCallerStackPointer() const; |
| 714 |
685 private: | 715 private: |
686 friend class StackFrameIterator; | 716 friend class StackFrameIterator; |
687 }; | 717 }; |
688 | 718 |
689 | 719 |
690 // Construct frames are special trampoline frames introduced to handle | 720 // Construct frames are special trampoline frames introduced to handle |
691 // function invocations through 'new'. | 721 // function invocations through 'new'. |
692 class ConstructFrame: public InternalFrame { | 722 class ConstructFrame: public InternalFrame { |
693 public: | 723 public: |
694 virtual Type type() const { return CONSTRUCT; } | 724 virtual Type type() const { return CONSTRUCT; } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 }; | 970 }; |
941 | 971 |
942 | 972 |
943 // Reads all frames on the current stack and copies them into the current | 973 // Reads all frames on the current stack and copies them into the current |
944 // zone memory. | 974 // zone memory. |
945 Vector<StackFrame*> CreateStackMap(Zone* zone); | 975 Vector<StackFrame*> CreateStackMap(Zone* zone); |
946 | 976 |
947 } } // namespace v8::internal | 977 } } // namespace v8::internal |
948 | 978 |
949 #endif // V8_FRAMES_H_ | 979 #endif // V8_FRAMES_H_ |
OLD | NEW |