| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include <cstdio> | 5 #include <cstdio> |
| 6 | 6 |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
| 8 | 8 |
| 9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 const intptr_t kMaxStep = 0x1000; // 4K. | 465 const intptr_t kMaxStep = 0x1000; // 4K. |
| 466 uword* pc = reinterpret_cast<uword*>(original_pc_); | 466 uword* pc = reinterpret_cast<uword*>(original_pc_); |
| 467 #define WALK_STACK | 467 #define WALK_STACK |
| 468 #if defined(WALK_STACK) | 468 #if defined(WALK_STACK) |
| 469 uword* fp = reinterpret_cast<uword*>(original_fp_); | 469 uword* fp = reinterpret_cast<uword*>(original_fp_); |
| 470 uword* previous_fp = fp; | 470 uword* previous_fp = fp; |
| 471 if (original_sp_ > original_fp_) { | 471 if (original_sp_ > original_fp_) { |
| 472 // Stack pointer should not be above frame pointer. | 472 // Stack pointer should not be above frame pointer. |
| 473 return 0; | 473 return 0; |
| 474 } | 474 } |
| 475 if ((original_fp_ - original_sp_) >= kMaxStep) { | 475 intptr_t gap = original_fp_ - original_sp_; |
| 476 if (gap >= kMaxStep) { |
| 476 // Gap between frame pointer and stack pointer is | 477 // Gap between frame pointer and stack pointer is |
| 477 // too large. | 478 // too large. |
| 478 return 0; | 479 return 0; |
| 479 } | 480 } |
| 480 if (original_sp_ < lower_bound_) { | 481 if (original_sp_ < lower_bound_) { |
| 481 // The stack pointer gives us a better lower bound than | 482 // The stack pointer gives us a better lower bound than |
| 482 // the isolates stack limit. | 483 // the isolates stack limit. |
| 483 lower_bound_ = original_sp_; | 484 lower_bound_ = original_sp_; |
| 484 } | 485 } |
| 485 int i = 0; | 486 int i = 0; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 return false; | 527 return false; |
| 527 } | 528 } |
| 528 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); | 529 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); |
| 529 cursor += sizeof(fp); | 530 cursor += sizeof(fp); |
| 530 bool r = cursor >= lower_bound_ && cursor < stack_upper_; | 531 bool r = cursor >= lower_bound_ && cursor < stack_upper_; |
| 531 return r; | 532 return r; |
| 532 } | 533 } |
| 533 | 534 |
| 534 | 535 |
| 535 } // namespace dart | 536 } // namespace dart |
| OLD | NEW |