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 "platform/utils.h" | 5 #include "platform/utils.h" |
6 | 6 |
7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
8 #include "vm/atomic.h" | 8 #include "vm/atomic.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1680 // Not walking the stack, only took exclusive sample. | 1680 // Not walking the stack, only took exclusive sample. |
1681 return 1; | 1681 return 1; |
1682 } | 1682 } |
1683 uword* pc = reinterpret_cast<uword*>(original_pc_); | 1683 uword* pc = reinterpret_cast<uword*>(original_pc_); |
1684 uword* fp = reinterpret_cast<uword*>(original_fp_); | 1684 uword* fp = reinterpret_cast<uword*>(original_fp_); |
1685 uword* previous_fp = fp; | 1685 uword* previous_fp = fp; |
1686 if (original_sp_ > original_fp_) { | 1686 if (original_sp_ > original_fp_) { |
1687 // Stack pointer should not be above frame pointer. | 1687 // Stack pointer should not be above frame pointer. |
1688 return 1; | 1688 return 1; |
1689 } | 1689 } |
1690 intptr_t gap = original_fp_ - original_sp_; | 1690 const intptr_t kPageMask = ~(kMaxStep - 1); |
1691 const intptr_t gap = | |
Cutch
2014/05/23 11:44:29
#ifdef PLATFORM_WINDOWS
const intptr_t gap = (orig
Anders Johnsen
2014/05/26 08:27:55
Done.
| |
1692 (original_fp_ & kPageMask) - (original_sp_ & kPageMask); | |
1691 if (gap >= kMaxStep) { | 1693 if (gap >= kMaxStep) { |
1692 // Gap between frame pointer and stack pointer is | 1694 // Gap between frame pointer and stack pointer is |
1693 // too large. | 1695 // too large. |
1694 return 1; | 1696 return 1; |
1695 } | 1697 } |
1696 if (original_sp_ < lower_bound_) { | 1698 if (original_sp_ < lower_bound_) { |
1697 // The stack pointer gives us a better lower bound than | 1699 // The stack pointer gives us a better lower bound than |
1698 // the isolates stack limit. | 1700 // the isolates stack limit. |
1699 lower_bound_ = original_sp_; | 1701 lower_bound_ = original_sp_; |
1700 } | 1702 } |
1701 // Store the PC marker for the top frame. | 1703 // Store the PC marker for the top frame. |
1702 sample_->set_pc_marker(GetCurrentFramePcMarker(fp)); | 1704 if (gap > 0) { |
1705 sample_->set_pc_marker(GetCurrentFramePcMarker(fp)); | |
1706 } | |
1703 int i = 0; | 1707 int i = 0; |
1704 for (; i < FLAG_profile_depth; i++) { | 1708 for (; i < FLAG_profile_depth; i++) { |
1705 if (FLAG_profile_verify_stack_walk) { | 1709 if (FLAG_profile_verify_stack_walk) { |
1706 VerifyCodeAddress(heap, i, reinterpret_cast<uword>(pc)); | 1710 VerifyCodeAddress(heap, i, reinterpret_cast<uword>(pc)); |
1707 } | 1711 } |
1708 sample_->SetAt(i, reinterpret_cast<uword>(pc)); | 1712 sample_->SetAt(i, reinterpret_cast<uword>(pc)); |
1709 if (fp == NULL) { | 1713 if (fp == NULL) { |
1710 return i + 1; | 1714 return i + 1; |
1711 } | 1715 } |
1712 if (!ValidFramePointer(fp)) { | 1716 if (!ValidFramePointer(fp)) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1831 ProfilerDartStackWalker stackWalker(sample); | 1835 ProfilerDartStackWalker stackWalker(sample); |
1832 stackWalker.walk(); | 1836 stackWalker.walk(); |
1833 } else { | 1837 } else { |
1834 // TODO(johnmccutchan): Support collecting only Dart frames with | 1838 // TODO(johnmccutchan): Support collecting only Dart frames with |
1835 // ProfilerNativeStackWalker. | 1839 // ProfilerNativeStackWalker. |
1836 } | 1840 } |
1837 } | 1841 } |
1838 } | 1842 } |
1839 | 1843 |
1840 } // namespace dart | 1844 } // namespace dart |
OLD | NEW |