OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_STACK_FRAME_H_ | 5 #ifndef VM_STACK_FRAME_H_ |
6 #define VM_STACK_FRAME_H_ | 6 #define VM_STACK_FRAME_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/stub_code.h" | 10 #include "vm/stub_code.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // Check validity of a frame, used for assertion purposes. | 48 // Check validity of a frame, used for assertion purposes. |
49 virtual bool IsValid() const { return false; } | 49 virtual bool IsValid() const { return false; } |
50 | 50 |
51 // Frame type. | 51 // Frame type. |
52 virtual bool IsDartFrame() const { return false; } | 52 virtual bool IsDartFrame() const { return false; } |
53 virtual bool IsStubFrame() const { return false; } | 53 virtual bool IsStubFrame() const { return false; } |
54 virtual bool IsEntryFrame() const { return false; } | 54 virtual bool IsEntryFrame() const { return false; } |
55 virtual bool IsExitFrame() const { return false; } | 55 virtual bool IsExitFrame() const { return false; } |
56 | 56 |
57 // Find code object corresponding to pc (valid only for DartFrame and | |
58 // StubFrame. | |
59 static RawCode* LookupCode(Isolate* isolate, uword pc); | |
60 | |
61 protected: | 57 protected: |
62 StackFrame() : fp_(0), sp_(0) { } | 58 StackFrame() : fp_(0), sp_(0) { } |
63 | 59 |
64 // Name of the frame, used for generic frame printing functionality. | 60 // Name of the frame, used for generic frame printing functionality. |
65 virtual const char* GetName() const = 0; | 61 virtual const char* GetName() const = 0; |
66 | 62 |
67 private: | 63 private: |
68 // An object finder visitor interface. | |
69 class FindRawCodeVisitor : public FindObjectVisitor { | |
70 public: | |
71 explicit FindRawCodeVisitor(uword pc) : pc_(pc) { } | |
72 virtual ~FindRawCodeVisitor() { } | |
73 | |
74 // Check if object matches find condition. | |
75 virtual bool FindObject(RawObject* obj); | |
76 | |
77 private: | |
78 uword pc_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(FindRawCodeVisitor); | |
81 }; | |
82 | |
83 // Target specific implementations for locating pc and caller fp/sp values. | 64 // Target specific implementations for locating pc and caller fp/sp values. |
84 static intptr_t PcAddressOffsetFromSp(); | 65 static intptr_t PcAddressOffsetFromSp(); |
85 uword GetCallerSp() const; | 66 uword GetCallerSp() const; |
86 uword GetCallerFp() const; | 67 uword GetCallerFp() const; |
87 | 68 |
88 uword fp_; | 69 uword fp_; |
89 uword sp_; | 70 uword sp_; |
90 | 71 |
91 // The iterators FrameSetIterator and StackFrameIterator set the private | 72 // The iterators FrameSetIterator and StackFrameIterator set the private |
92 // fields fp_ and sp_ when they return the respective frame objects. | 73 // fields fp_ and sp_ when they return the respective frame objects. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 258 |
278 private: | 259 private: |
279 StackFrameIterator frames_; | 260 StackFrameIterator frames_; |
280 | 261 |
281 DISALLOW_COPY_AND_ASSIGN(DartFrameIterator); | 262 DISALLOW_COPY_AND_ASSIGN(DartFrameIterator); |
282 }; | 263 }; |
283 | 264 |
284 } // namespace dart | 265 } // namespace dart |
285 | 266 |
286 #endif // VM_STACK_FRAME_H_ | 267 #endif // VM_STACK_FRAME_H_ |
OLD | NEW |