| 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" |
| 11 #include "vm/json_stream.h" | 11 #include "vm/json_stream.h" |
| 12 #include "vm/native_symbol.h" | 12 #include "vm/native_symbol.h" |
| 13 #include "vm/object.h" | 13 #include "vm/object.h" |
| 14 #include "vm/os.h" | 14 #include "vm/os.h" |
| 15 #include "vm/profiler.h" | 15 #include "vm/profiler.h" |
| 16 #include "vm/signal_handler.h" | 16 #include "vm/signal_handler.h" |
| 17 #include "vm/simulator.h" | 17 #include "vm/simulator.h" |
| 18 #include "vm/stack_frame.h" |
| 18 | 19 |
| 19 namespace dart { | 20 namespace dart { |
| 20 | 21 |
| 21 | 22 |
| 22 #if defined(USING_SIMULATOR) || defined(TARGET_OS_WINDOWS) || \ | 23 #if defined(USING_SIMULATOR) || defined(TARGET_OS_WINDOWS) || \ |
| 23 defined(TARGET_OS_MACOS) || defined(TARGET_OS_ANDROID) | 24 defined(TARGET_OS_MACOS) || defined(TARGET_OS_ANDROID) |
| 24 DEFINE_FLAG(bool, profile, false, "Enable Sampling Profiler"); | 25 DEFINE_FLAG(bool, profile, false, "Enable Sampling Profiler"); |
| 25 #else | 26 #else |
| 26 DEFINE_FLAG(bool, profile, true, "Enable Sampling Profiler"); | 27 DEFINE_FLAG(bool, profile, true, "Enable Sampling Profiler"); |
| 27 #endif | 28 #endif |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 } | 813 } |
| 813 // Move the lower bound up. | 814 // Move the lower bound up. |
| 814 lower_bound_ = reinterpret_cast<uintptr_t>(fp); | 815 lower_bound_ = reinterpret_cast<uintptr_t>(fp); |
| 815 } | 816 } |
| 816 return i; | 817 return i; |
| 817 } | 818 } |
| 818 | 819 |
| 819 | 820 |
| 820 uword* ProfilerSampleStackWalker::CallerPC(uword* fp) { | 821 uword* ProfilerSampleStackWalker::CallerPC(uword* fp) { |
| 821 ASSERT(fp != NULL); | 822 ASSERT(fp != NULL); |
| 822 return reinterpret_cast<uword*>(*(fp + 1)); | 823 return reinterpret_cast<uword*>(*(fp + kSavedCallerPcSlotFromFp)); |
| 823 } | 824 } |
| 824 | 825 |
| 825 | 826 |
| 826 uword* ProfilerSampleStackWalker::CallerFP(uword* fp) { | 827 uword* ProfilerSampleStackWalker::CallerFP(uword* fp) { |
| 827 ASSERT(fp != NULL); | 828 ASSERT(fp != NULL); |
| 828 return reinterpret_cast<uword*>(*fp); | 829 return reinterpret_cast<uword*>(*(fp + kSavedCallerFpSlotFromFp)); |
| 829 } | 830 } |
| 830 | 831 |
| 831 | 832 |
| 832 bool ProfilerSampleStackWalker::ValidFramePointer(uword* fp) { | 833 bool ProfilerSampleStackWalker::ValidFramePointer(uword* fp) { |
| 833 if (fp == NULL) { | 834 if (fp == NULL) { |
| 834 return false; | 835 return false; |
| 835 } | 836 } |
| 836 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); | 837 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); |
| 837 cursor += sizeof(fp); | 838 cursor += sizeof(fp); |
| 838 bool r = cursor >= lower_bound_ && cursor < stack_upper_; | 839 bool r = cursor >= lower_bound_ && cursor < stack_upper_; |
| 839 return r; | 840 return r; |
| 840 } | 841 } |
| 841 | 842 |
| 842 | 843 |
| 843 } // namespace dart | 844 } // namespace dart |
| OLD | NEW |