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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 // | 854 // |
855 class ProfilerSampleStackWalker : public ValueObject { | 855 class ProfilerSampleStackWalker : public ValueObject { |
856 public: | 856 public: |
857 ProfilerSampleStackWalker(Sample* sample, | 857 ProfilerSampleStackWalker(Sample* sample, |
858 uword stack_lower, | 858 uword stack_lower, |
859 uword stack_upper, | 859 uword stack_upper, |
860 uword pc, | 860 uword pc, |
861 uword fp, | 861 uword fp, |
862 uword sp) | 862 uword sp) |
863 : sample_(sample), | 863 : sample_(sample), |
864 stack_lower_(stack_lower), | |
865 stack_upper_(stack_upper), | 864 stack_upper_(stack_upper), |
866 original_pc_(pc), | 865 original_pc_(pc), |
867 original_fp_(fp), | 866 original_fp_(fp), |
868 original_sp_(sp), | 867 original_sp_(sp), |
869 lower_bound_(stack_lower) { | 868 lower_bound_(stack_lower) { |
870 ASSERT(sample_ != NULL); | 869 ASSERT(sample_ != NULL); |
871 } | 870 } |
872 | 871 |
873 int walk() { | 872 int walk() { |
874 const intptr_t kMaxStep = 0x1000; // 4K. | 873 const intptr_t kMaxStep = 0x1000; // 4K. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 if (fp == NULL) { | 933 if (fp == NULL) { |
935 return false; | 934 return false; |
936 } | 935 } |
937 uword cursor = reinterpret_cast<uword>(fp); | 936 uword cursor = reinterpret_cast<uword>(fp); |
938 cursor += sizeof(fp); | 937 cursor += sizeof(fp); |
939 bool r = cursor >= lower_bound_ && cursor < stack_upper_; | 938 bool r = cursor >= lower_bound_ && cursor < stack_upper_; |
940 return r; | 939 return r; |
941 } | 940 } |
942 | 941 |
943 Sample* sample_; | 942 Sample* sample_; |
944 const uword stack_lower_; | |
945 const uword stack_upper_; | 943 const uword stack_upper_; |
946 const uword original_pc_; | 944 const uword original_pc_; |
947 const uword original_fp_; | 945 const uword original_fp_; |
948 const uword original_sp_; | 946 const uword original_sp_; |
949 uword lower_bound_; | 947 uword lower_bound_; |
950 }; | 948 }; |
951 | 949 |
952 void Profiler::RecordSampleInterruptCallback( | 950 void Profiler::RecordSampleInterruptCallback( |
953 const InterruptedThreadState& state, | 951 const InterruptedThreadState& state, |
954 void* data) { | 952 void* data) { |
(...skipping 19 matching lines...) Expand all Loading... |
974 stack_lower = 0; | 972 stack_lower = 0; |
975 stack_upper = 0; | 973 stack_upper = 0; |
976 } | 974 } |
977 ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper, | 975 ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper, |
978 state.pc, state.fp, state.sp); | 976 state.pc, state.fp, state.sp); |
979 stackWalker.walk(); | 977 stackWalker.walk(); |
980 } | 978 } |
981 | 979 |
982 | 980 |
983 } // namespace dart | 981 } // namespace dart |
OLD | NEW |