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

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

Issue 1411703004: Pass Thread into StackFrameIterator (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « runtime/vm/profiler.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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // It is the responsibility of users of StackFrameIterator to ensure that the 175 // It is the responsibility of users of StackFrameIterator to ensure that the
176 // isolate given is not running concurrently on another thread. 176 // isolate given is not running concurrently on another thread.
177 class StackFrameIterator : public ValueObject { 177 class StackFrameIterator : public ValueObject {
178 public: 178 public:
179 static const bool kValidateFrames = true; 179 static const bool kValidateFrames = true;
180 static const bool kDontValidateFrames = false; 180 static const bool kDontValidateFrames = false;
181 181
182 // Iterators for iterating over all frames from the last ExitFrame to the 182 // Iterators for iterating over all frames from the last ExitFrame to the
183 // first EntryFrame. 183 // first EntryFrame.
184 explicit StackFrameIterator(bool validate, 184 explicit StackFrameIterator(bool validate,
185 Isolate* isolate = Isolate::Current()); 185 Isolate* isolate = Isolate::Current(),
186 Thread* thread = Thread::Current());
siva 2015/10/20 21:06:14 The explicit should have been removed when the iso
186 StackFrameIterator(uword last_fp, bool validate, 187 StackFrameIterator(uword last_fp, bool validate,
187 Isolate* isolate = Isolate::Current()); 188 Isolate* isolate = Isolate::Current(),
189 Thread* thread = Thread::Current());
188 190
189 // Iterator for iterating over all frames from the current frame (given by its 191 // Iterator for iterating over all frames from the current frame (given by its
190 // fp, sp, and pc) to the first EntryFrame. 192 // fp, sp, and pc) to the first EntryFrame.
191 StackFrameIterator(uword fp, uword sp, uword pc, bool validate, 193 StackFrameIterator(uword fp, uword sp, uword pc, bool validate,
192 Isolate* isolate = Isolate::Current()); 194 Isolate* isolate = Isolate::Current(),
195 Thread* thread = Thread::Current());
193 196
194 // Checks if a next frame exists. 197 // Checks if a next frame exists.
195 bool HasNextFrame() const { return frames_.fp_ != 0; } 198 bool HasNextFrame() const { return frames_.fp_ != 0; }
196 199
197 // Get next frame. 200 // Get next frame.
198 StackFrame* NextFrame(); 201 StackFrame* NextFrame();
199 202
200 bool validate() const { return validate_; } 203 bool validate() const { return validate_; }
201 204
202 private: 205 private:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // stack frames. 247 // stack frames.
245 void SetupLastExitFrameData(); 248 void SetupLastExitFrameData();
246 void SetupNextExitFrameData(); 249 void SetupNextExitFrameData();
247 250
248 bool validate_; // Validate each frame as we traverse the frames. 251 bool validate_; // Validate each frame as we traverse the frames.
249 EntryFrame entry_; // Singleton entry frame returned by NextEntryFrame(). 252 EntryFrame entry_; // Singleton entry frame returned by NextEntryFrame().
250 ExitFrame exit_; // Singleton exit frame returned by NextExitFrame(). 253 ExitFrame exit_; // Singleton exit frame returned by NextExitFrame().
251 FrameSetIterator frames_; 254 FrameSetIterator frames_;
252 StackFrame* current_frame_; // Points to the current frame in the iterator. 255 StackFrame* current_frame_; // Points to the current frame in the iterator.
253 Isolate* isolate_; 256 Isolate* isolate_;
257 Thread* thread_;
254 258
255 DISALLOW_COPY_AND_ASSIGN(StackFrameIterator); 259 DISALLOW_COPY_AND_ASSIGN(StackFrameIterator);
256 }; 260 };
257 261
258 262
259 // Iterator for iterating over all dart frames (skips over exit frames, 263 // Iterator for iterating over all dart frames (skips over exit frames,
260 // entry frames and stub frames). 264 // entry frames and stub frames).
261 // A DartFrameIterator can be initialized with an isolate other than the 265 // A DartFrameIterator can be initialized with an isolate other than the
262 // current thread's isolate. Because this is generally a bad idea, 266 // current thread's isolate. Because this is generally a bad idea,
263 // it is only allowed on Windows- where it is needed for the profiler. 267 // it is only allowed on Windows- where it is needed for the profiler.
264 // It is the responsibility of users of DartFrameIterator to ensure that the 268 // It is the responsibility of users of DartFrameIterator to ensure that the
265 // isolate given is not running concurrently on another thread. 269 // isolate given is not running concurrently on another thread.
266 class DartFrameIterator : public ValueObject { 270 class DartFrameIterator : public ValueObject {
267 public: 271 public:
268 explicit DartFrameIterator(Isolate* isolate = Isolate::Current()) 272 DartFrameIterator(Isolate* isolate = Isolate::Current(),
269 : frames_(StackFrameIterator::kDontValidateFrames, isolate) { } 273 Thread* thread = Thread::Current())
srdjan 2015/10/20 20:59:26 Pass in only thread and get isolate from thread->i
274 : frames_(StackFrameIterator::kDontValidateFrames, isolate, thread) { }
270 DartFrameIterator(uword last_fp, 275 DartFrameIterator(uword last_fp,
271 Isolate* isolate = Isolate::Current()) 276 Isolate* isolate = Isolate::Current(),
272 : frames_(last_fp, StackFrameIterator::kDontValidateFrames, isolate) { } 277 Thread* thread = Thread::Current())
278 : frames_(last_fp, StackFrameIterator::kDontValidateFrames,
279 isolate, thread) { }
273 DartFrameIterator(uword fp, 280 DartFrameIterator(uword fp,
274 uword sp, 281 uword sp,
275 uword pc, 282 uword pc,
276 Isolate* isolate = Isolate::Current()) 283 Isolate* isolate = Isolate::Current(),
277 : frames_(fp, sp, pc, StackFrameIterator::kDontValidateFrames, isolate) { 284 Thread* thread = Thread::Current())
285 : frames_(fp, sp, pc,
286 StackFrameIterator::kDontValidateFrames, isolate, thread) {
278 } 287 }
279 // Get next dart frame. 288 // Get next dart frame.
280 StackFrame* NextFrame() { 289 StackFrame* NextFrame() {
281 StackFrame* frame = frames_.NextFrame(); 290 StackFrame* frame = frames_.NextFrame();
282 while (frame != NULL && !frame->IsDartFrame(frames_.validate())) { 291 while (frame != NULL && !frame->IsDartFrame(frames_.validate())) {
283 frame = frames_.NextFrame(); 292 frame = frames_.NextFrame();
284 } 293 }
285 return frame; 294 return frame;
286 } 295 }
287 296
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 uword pc_; 338 uword pc_;
330 GrowableArray<DeoptInstr*> deopt_instructions_; 339 GrowableArray<DeoptInstr*> deopt_instructions_;
331 ObjectPool& object_table_; 340 ObjectPool& object_table_;
332 341
333 DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator); 342 DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator);
334 }; 343 };
335 344
336 } // namespace dart 345 } // namespace dart
337 346
338 #endif // VM_STACK_FRAME_H_ 347 #endif // VM_STACK_FRAME_H_
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/stack_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698