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

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

Issue 2845053003: Fix asserts in StackFrameIterator which were effectively disabled (Closed)
Patch Set: remote two assertions which cannot be made Created 3 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
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 RUNTIME_VM_STACK_FRAME_H_ 5 #ifndef RUNTIME_VM_STACK_FRAME_H_
6 #define RUNTIME_VM_STACK_FRAME_H_ 6 #define RUNTIME_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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // users of StackFrameIterator to ensure that the thread given is not running 205 // users of StackFrameIterator to ensure that the thread given is not running
206 // concurrently. 206 // concurrently.
207 class StackFrameIterator : public ValueObject { 207 class StackFrameIterator : public ValueObject {
208 public: 208 public:
209 static const bool kValidateFrames = true; 209 static const bool kValidateFrames = true;
210 static const bool kDontValidateFrames = false; 210 static const bool kDontValidateFrames = false;
211 211
212 // Iterators for iterating over all frames from the last ExitFrame to the 212 // Iterators for iterating over all frames from the last ExitFrame to the
213 // first EntryFrame. 213 // first EntryFrame.
214 explicit StackFrameIterator(bool validate, 214 explicit StackFrameIterator(bool validate,
215 Thread* thread = Thread::Current()); 215 Thread* thread,
216 bool allow_iterating_other_thread);
216 StackFrameIterator(uword last_fp, 217 StackFrameIterator(uword last_fp,
217 bool validate, 218 bool validate,
218 Thread* thread = Thread::Current()); 219 Thread* thread,
220 bool allow_iterating_other_thread);
219 221
220 #if !defined(TARGET_ARCH_DBC) 222 #if !defined(TARGET_ARCH_DBC)
221 // Iterator for iterating over all frames from the current frame (given by its 223 // Iterator for iterating over all frames from the current frame (given by its
222 // fp, sp, and pc) to the first EntryFrame. 224 // fp, sp, and pc) to the first EntryFrame.
223 StackFrameIterator(uword fp, 225 StackFrameIterator(uword fp,
224 uword sp, 226 uword sp,
225 uword pc, 227 uword pc,
226 bool validate, 228 bool validate,
227 Thread* thread = Thread::Current()); 229 Thread* thread,
230 bool allow_iterating_other_thread);
228 #endif 231 #endif
229 232
230 // Checks if a next frame exists. 233 // Checks if a next frame exists.
231 bool HasNextFrame() const { return frames_.fp_ != 0; } 234 bool HasNextFrame() const { return frames_.fp_ != 0; }
232 235
233 // Get next frame. 236 // Get next frame.
234 StackFrame* NextFrame(); 237 StackFrame* NextFrame();
235 238
236 bool validate() const { return validate_; } 239 bool validate() const { return validate_; }
237 240
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 298
296 // Iterator for iterating over all dart frames (skips over exit frames, 299 // Iterator for iterating over all dart frames (skips over exit frames,
297 // entry frames and stub frames). 300 // entry frames and stub frames).
298 // A DartFrameIterator can be initialized with an isolate other than the 301 // A DartFrameIterator can be initialized with an isolate other than the
299 // current thread's isolate. Because this is generally a bad idea, 302 // current thread's isolate. Because this is generally a bad idea,
300 // it is only allowed on Windows- where it is needed for the profiler. 303 // it is only allowed on Windows- where it is needed for the profiler.
301 // It is the responsibility of users of DartFrameIterator to ensure that the 304 // It is the responsibility of users of DartFrameIterator to ensure that the
302 // isolate given is not running concurrently on another thread. 305 // isolate given is not running concurrently on another thread.
303 class DartFrameIterator : public ValueObject { 306 class DartFrameIterator : public ValueObject {
304 public: 307 public:
305 explicit DartFrameIterator(Thread* thread = Thread::Current()) 308 explicit DartFrameIterator(Thread* thread, bool allow_iterating_other_thread)
306 : frames_(StackFrameIterator::kDontValidateFrames, thread) {} 309 : frames_(StackFrameIterator::kDontValidateFrames,
307 explicit DartFrameIterator(uword last_fp, Thread* thread = Thread::Current()) 310 thread,
308 : frames_(last_fp, StackFrameIterator::kDontValidateFrames, thread) {} 311 allow_iterating_other_thread) {}
312 explicit DartFrameIterator(uword last_fp,
313 Thread* thread,
314 bool allow_iterating_other_thread)
315 : frames_(last_fp,
316 StackFrameIterator::kDontValidateFrames,
317 thread,
318 allow_iterating_other_thread) {}
309 319
310 #if !defined(TARGET_ARCH_DBC) 320 #if !defined(TARGET_ARCH_DBC)
311 DartFrameIterator(uword fp, 321 DartFrameIterator(uword fp,
312 uword sp, 322 uword sp,
313 uword pc, 323 uword pc,
314 Thread* thread = Thread::Current()) 324 Thread* thread,
315 : frames_(fp, sp, pc, StackFrameIterator::kDontValidateFrames, thread) {} 325 bool allow_iterating_other_thread)
326 : frames_(fp,
327 sp,
328 pc,
329 StackFrameIterator::kDontValidateFrames,
330 thread,
331 allow_iterating_other_thread) {}
316 #endif 332 #endif
317 333
318 // Get next dart frame. 334 // Get next dart frame.
319 StackFrame* NextFrame() { 335 StackFrame* NextFrame() {
320 StackFrame* frame = frames_.NextFrame(); 336 StackFrame* frame = frames_.NextFrame();
321 while (frame != NULL && !frame->IsDartFrame(frames_.validate())) { 337 while (frame != NULL && !frame->IsDartFrame(frames_.validate())) {
322 frame = frames_.NextFrame(); 338 frame = frames_.NextFrame();
323 } 339 }
324 return frame; 340 return frame;
325 } 341 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 419
404 420
405 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { 421 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) {
406 return fp + LocalVarIndex(0, index) * kWordSize; 422 return fp + LocalVarIndex(0, index) * kWordSize;
407 } 423 }
408 424
409 425
410 } // namespace dart 426 } // namespace dart
411 427
412 #endif // RUNTIME_VM_STACK_FRAME_H_ 428 #endif // RUNTIME_VM_STACK_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698