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 |
57 protected: | 61 protected: |
58 StackFrame() : fp_(0), sp_(0) { } | 62 StackFrame() : fp_(0), sp_(0) { } |
59 | 63 |
60 // Name of the frame, used for generic frame printing functionality. | 64 // Name of the frame, used for generic frame printing functionality. |
61 virtual const char* GetName() const = 0; | 65 virtual const char* GetName() const = 0; |
62 | 66 |
63 private: | 67 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 |
64 // Target specific implementations for locating pc and caller fp/sp values. | 83 // Target specific implementations for locating pc and caller fp/sp values. |
65 static intptr_t PcAddressOffsetFromSp(); | 84 static intptr_t PcAddressOffsetFromSp(); |
66 uword GetCallerSp() const; | 85 uword GetCallerSp() const; |
67 uword GetCallerFp() const; | 86 uword GetCallerFp() const; |
68 | 87 |
69 uword fp_; | 88 uword fp_; |
70 uword sp_; | 89 uword sp_; |
71 | 90 |
72 // The iterators FrameSetIterator and StackFrameIterator set the private | 91 // The iterators FrameSetIterator and StackFrameIterator set the private |
73 // fields fp_ and sp_ when they return the respective frame objects. | 92 // fields fp_ and sp_ when they return the respective frame objects. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 277 |
259 private: | 278 private: |
260 StackFrameIterator frames_; | 279 StackFrameIterator frames_; |
261 | 280 |
262 DISALLOW_COPY_AND_ASSIGN(DartFrameIterator); | 281 DISALLOW_COPY_AND_ASSIGN(DartFrameIterator); |
263 }; | 282 }; |
264 | 283 |
265 } // namespace dart | 284 } // namespace dart |
266 | 285 |
267 #endif // VM_STACK_FRAME_H_ | 286 #endif // VM_STACK_FRAME_H_ |
OLD | NEW |