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 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 | 1745 |
1746 void walk(Heap* heap) { | 1746 void walk(Heap* heap) { |
1747 const uword kMaxStep = VirtualMemory::PageSize(); | 1747 const uword kMaxStep = VirtualMemory::PageSize(); |
1748 | 1748 |
1749 sample_->SetAt(0, original_pc_); | 1749 sample_->SetAt(0, original_pc_); |
1750 | 1750 |
1751 uword* pc = reinterpret_cast<uword*>(original_pc_); | 1751 uword* pc = reinterpret_cast<uword*>(original_pc_); |
1752 uword* fp = reinterpret_cast<uword*>(original_fp_); | 1752 uword* fp = reinterpret_cast<uword*>(original_fp_); |
1753 uword* previous_fp = fp; | 1753 uword* previous_fp = fp; |
1754 | 1754 |
1755 if ((original_fp_ - original_sp_) >= kMaxStep) { | 1755 uword gap = original_fp_ - original_sp_; |
| 1756 if (gap >= kMaxStep) { |
1756 // Gap between frame pointer and stack pointer is | 1757 // Gap between frame pointer and stack pointer is |
1757 // too large. | 1758 // too large. |
1758 return; | 1759 return; |
1759 } | 1760 } |
1760 | 1761 |
1761 if (!ValidFramePointer(fp)) { | 1762 if (!ValidFramePointer(fp)) { |
1762 return; | 1763 return; |
1763 } | 1764 } |
1764 | 1765 |
1765 for (int i = 0; i < FLAG_profile_depth; i++) { | 1766 for (int i = 0; i < FLAG_profile_depth; i++) { |
1766 sample_->SetAt(i, reinterpret_cast<uword>(pc)); | 1767 sample_->SetAt(i, reinterpret_cast<uword>(pc)); |
1767 | 1768 |
1768 pc = CallerPC(fp); | 1769 pc = CallerPC(fp); |
1769 previous_fp = fp; | 1770 previous_fp = fp; |
1770 fp = CallerFP(fp); | 1771 fp = CallerFP(fp); |
1771 | 1772 |
1772 if (fp == NULL) { | 1773 if (fp == NULL) { |
1773 return; | 1774 return; |
1774 } | 1775 } |
1775 | 1776 |
1776 if (fp <= previous_fp) { | 1777 if (fp <= previous_fp) { |
1777 // Frame pointer did not move to a higher address. | 1778 // Frame pointer did not move to a higher address. |
1778 return; | 1779 return; |
1779 } | 1780 } |
1780 | 1781 |
1781 if ((fp - previous_fp) >= kMaxStep) { | 1782 gap = fp - previous_fp; |
| 1783 if (gap >= kMaxStep) { |
1782 // Frame pointer step is too large. | 1784 // Frame pointer step is too large. |
1783 return; | 1785 return; |
1784 } | 1786 } |
1785 | 1787 |
1786 if (!ValidFramePointer(fp)) { | 1788 if (!ValidFramePointer(fp)) { |
1787 // Frame pointer is outside of isolate stack boundary. | 1789 // Frame pointer is outside of isolate stack boundary. |
1788 return; | 1790 return; |
1789 } | 1791 } |
1790 | 1792 |
1791 // Move the lower bound up. | 1793 // Move the lower bound up. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 stackWalker.walk(); | 1928 stackWalker.walk(); |
1927 } else { | 1929 } else { |
1928 ProfilerNativeStackWalker stackWalker(sample, stack_lower, stack_upper, | 1930 ProfilerNativeStackWalker stackWalker(sample, stack_lower, stack_upper, |
1929 state.pc, state.fp, state.sp); | 1931 state.pc, state.fp, state.sp); |
1930 stackWalker.walk(isolate->heap()); | 1932 stackWalker.walk(isolate->heap()); |
1931 } | 1933 } |
1932 } | 1934 } |
1933 } | 1935 } |
1934 | 1936 |
1935 } // namespace dart | 1937 } // namespace dart |
OLD | NEW |