Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Side by Side Diff: runtime/vm/stack_frame.h

Issue 14925005: Remove stack_frame_<arch>.cc files. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scopes.cc ('k') | runtime/vm/stack_frame.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 30
31 // Generic stack frame. 31 // Generic stack frame.
32 class StackFrame : public ValueObject { 32 class StackFrame : public ValueObject {
33 public: 33 public:
34 virtual ~StackFrame() { } 34 virtual ~StackFrame() { }
35 35
36 // Accessors to get the pc, sp and fp of a frame. 36 // Accessors to get the pc, sp and fp of a frame.
37 uword sp() const { return sp_; } 37 uword sp() const { return sp_; }
38 uword fp() const { return fp_; } 38 uword fp() const { return fp_; }
39 uword pc() const { 39 uword pc() const {
40 return *reinterpret_cast<uword*>(sp_ + PcAddressOffsetFromSp()); 40 return *reinterpret_cast<uword*>(sp_ + (kSavedPcSlotFromSp * kWordSize));
41 } 41 }
42 42
43 void set_pc(uword value) { 43 void set_pc(uword value) {
44 *reinterpret_cast<uword*>(sp_ + PcAddressOffsetFromSp()) = value; 44 *reinterpret_cast<uword*>(sp_ + (kSavedPcSlotFromSp * kWordSize)) = value;
45 }
46
47 void SetEntrypointMarker(uword value) {
48 ASSERT(!(IsStubFrame() || IsEntryFrame() || IsExitFrame()));
49 *reinterpret_cast<uword*>(fp_ + EntrypointMarkerOffsetFromFp()) = value;
50 } 45 }
51 46
52 // Visit objects in the frame. 47 // Visit objects in the frame.
53 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor); 48 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor);
54 49
55 // Print a frame. 50 // Print a frame.
56 virtual void Print() const; 51 virtual void Print() const;
57 52
58 // Check validity of a frame, used for assertion purposes. 53 // Check validity of a frame, used for assertion purposes.
59 virtual bool IsValid() const; 54 virtual bool IsValid() const;
(...skipping 16 matching lines...) Expand all
76 71
77 protected: 72 protected:
78 StackFrame() : fp_(0), sp_(0) { } 73 StackFrame() : fp_(0), sp_(0) { }
79 74
80 // Name of the frame, used for generic frame printing functionality. 75 // Name of the frame, used for generic frame printing functionality.
81 virtual const char* GetName() const { return IsStubFrame()? "stub" : "dart"; } 76 virtual const char* GetName() const { return IsStubFrame()? "stub" : "dart"; }
82 77
83 private: 78 private:
84 RawCode* GetCodeObject() const; 79 RawCode* GetCodeObject() const;
85 80
86 // Target specific implementations for locating pc and caller fp/sp values. 81 uword GetCallerSp() const {
87 static intptr_t PcAddressOffsetFromSp(); 82 return fp() + (kCallerSpSlotFromFp * kWordSize);
88 static intptr_t EntrypointMarkerOffsetFromFp(); 83 }
89 uword GetCallerSp() const; 84 uword GetCallerFp() const {
90 uword GetCallerFp() const; 85 return *(reinterpret_cast<uword*>(
86 fp() + (kSavedCallerFpSlotFromFp * kWordSize)));
87 }
91 88
92 uword fp_; 89 uword fp_;
93 uword sp_; 90 uword sp_;
94 91
95 // The iterators FrameSetIterator and StackFrameIterator set the private 92 // The iterators FrameSetIterator and StackFrameIterator set the private
96 // fields fp_ and sp_ when they return the respective frame objects. 93 // fields fp_ and sp_ when they return the respective frame objects.
97 friend class FrameSetIterator; 94 friend class FrameSetIterator;
98 friend class StackFrameIterator; 95 friend class StackFrameIterator;
99 DISALLOW_COPY_AND_ASSIGN(StackFrame); 96 DISALLOW_COPY_AND_ASSIGN(StackFrame);
100 }; 97 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 RawContext* SavedContext() const; 132 RawContext* SavedContext() const;
136 133
137 // Visit objects in the frame. 134 // Visit objects in the frame.
138 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor); 135 virtual void VisitObjectPointers(ObjectPointerVisitor* visitor);
139 136
140 protected: 137 protected:
141 virtual const char* GetName() const { return "entry"; } 138 virtual const char* GetName() const { return "entry"; }
142 139
143 private: 140 private:
144 EntryFrame() { } 141 EntryFrame() { }
145 intptr_t ExitLinkOffset() const;
146 intptr_t SavedContextOffset() const;
147 142
148 friend class StackFrameIterator; 143 friend class StackFrameIterator;
149 DISALLOW_COPY_AND_ASSIGN(EntryFrame); 144 DISALLOW_COPY_AND_ASSIGN(EntryFrame);
150 }; 145 };
151 146
152 147
153 // Iterator for iterating over all frames from the last ExitFrame to the 148 // Iterator for iterating over all frames from the last ExitFrame to the
154 // first EntryFrame. 149 // first EntryFrame.
155 class StackFrameIterator : public ValueObject { 150 class StackFrameIterator : public ValueObject {
156 public: 151 public:
(...skipping 12 matching lines...) Expand all
169 private: 164 private:
170 // Iterator for iterating over the set of frames (dart or stub) which exist 165 // Iterator for iterating over the set of frames (dart or stub) which exist
171 // in one EntryFrame and ExitFrame block. 166 // in one EntryFrame and ExitFrame block.
172 class FrameSetIterator : public ValueObject { 167 class FrameSetIterator : public ValueObject {
173 public: 168 public:
174 // Checks if a next non entry/exit frame exists in the set. 169 // Checks if a next non entry/exit frame exists in the set.
175 bool HasNext() const { 170 bool HasNext() const {
176 if (fp_ == 0) { 171 if (fp_ == 0) {
177 return false; 172 return false;
178 } 173 }
179 intptr_t offset = StackFrame::PcAddressOffsetFromSp(); 174 const uword pc = *(reinterpret_cast<uword*>(
180 uword pc = *(reinterpret_cast<uword*>(sp_ + offset)); 175 sp_ + (kSavedPcSlotFromSp * kWordSize)));
181 return !StubCode::InInvocationStub(pc); 176 return !StubCode::InInvocationStub(pc);
182 } 177 }
183 178
184 // Get next non entry/exit frame in the set (assumes a next frame exists). 179 // Get next non entry/exit frame in the set (assumes a next frame exists).
185 StackFrame* NextFrame(bool validate); 180 StackFrame* NextFrame(bool validate);
186 181
187 private: 182 private:
188 FrameSetIterator() : fp_(0), sp_(0), stack_frame_() { } 183 FrameSetIterator() : fp_(0), sp_(0), stack_frame_() { }
189 184
190 uword fp_; 185 uword fp_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 GrowableArray<DeoptInstr*> deopt_instructions_; 273 GrowableArray<DeoptInstr*> deopt_instructions_;
279 Array& object_table_; 274 Array& object_table_;
280 275
281 DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator); 276 DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator);
282 }; 277 };
283 278
284 } // namespace dart 279 } // namespace dart
285 280
286 #endif // VM_STACK_FRAME_H_ 281 #endif // VM_STACK_FRAME_H_
287 282
OLDNEW
« no previous file with comments | « runtime/vm/scopes.cc ('k') | runtime/vm/stack_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698