| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const int kMaximumDepth = 128; | 43 const int kMaximumDepth = 128; |
| 44 // Place some sane restrictions on user controlled flags. | 44 // Place some sane restrictions on user controlled flags. |
| 45 if (FLAG_profile_period < kMinimumProfilePeriod) { | 45 if (FLAG_profile_period < kMinimumProfilePeriod) { |
| 46 FLAG_profile_period = kMinimumProfilePeriod; | 46 FLAG_profile_period = kMinimumProfilePeriod; |
| 47 } | 47 } |
| 48 if (FLAG_profile_depth < kMinimumDepth) { | 48 if (FLAG_profile_depth < kMinimumDepth) { |
| 49 FLAG_profile_depth = kMinimumDepth; | 49 FLAG_profile_depth = kMinimumDepth; |
| 50 } else if (FLAG_profile_depth > kMaximumDepth) { | 50 } else if (FLAG_profile_depth > kMaximumDepth) { |
| 51 FLAG_profile_depth = kMaximumDepth; | 51 FLAG_profile_depth = kMaximumDepth; |
| 52 } | 52 } |
| 53 // We must always initialize the Sample, even when the profiler is disabled. |
| 53 Sample::InitOnce(); | 54 Sample::InitOnce(); |
| 54 if (!FLAG_profile) { | 55 if (!FLAG_profile) { |
| 55 return; | 56 return; |
| 56 } | 57 } |
| 57 ASSERT(!initialized_); | 58 ASSERT(!initialized_); |
| 58 sample_buffer_ = new SampleBuffer(); | 59 sample_buffer_ = new SampleBuffer(); |
| 59 NativeSymbolResolver::InitOnce(); | 60 NativeSymbolResolver::InitOnce(); |
| 60 ThreadInterrupter::InitOnce(); | |
| 61 ThreadInterrupter::SetInterruptPeriod(FLAG_profile_period); | 61 ThreadInterrupter::SetInterruptPeriod(FLAG_profile_period); |
| 62 ThreadInterrupter::Startup(); |
| 62 initialized_ = true; | 63 initialized_ = true; |
| 63 } | 64 } |
| 64 | 65 |
| 65 | 66 |
| 66 void Profiler::Shutdown() { | 67 void Profiler::Shutdown() { |
| 67 if (!FLAG_profile) { | 68 if (!FLAG_profile) { |
| 68 return; | 69 return; |
| 69 } | 70 } |
| 70 ASSERT(initialized_); | 71 ASSERT(initialized_); |
| 71 ThreadInterrupter::Shutdown(); | 72 ThreadInterrupter::Shutdown(); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 return false; | 836 return false; |
| 836 } | 837 } |
| 837 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); | 838 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); |
| 838 cursor += sizeof(fp); | 839 cursor += sizeof(fp); |
| 839 bool r = cursor >= lower_bound_ && cursor < stack_upper_; | 840 bool r = cursor >= lower_bound_ && cursor < stack_upper_; |
| 840 return r; | 841 return r; |
| 841 } | 842 } |
| 842 | 843 |
| 843 | 844 |
| 844 } // namespace dart | 845 } // namespace dart |
| OLD | NEW |