| 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 <cstdio> | 5 #include <cstdio> |
| 6 | 6 |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
| 8 | 8 |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/json_stream.h" | 10 #include "vm/json_stream.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 { | 165 { |
| 166 ScopedSignalBlocker ssb; | 166 ScopedSignalBlocker ssb; |
| 167 FreeIsolateProfilingData(isolate); | 167 FreeIsolateProfilingData(isolate); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 void ProfilerManager::ScheduleIsolateHelper(Isolate* isolate) { | 172 void ProfilerManager::ScheduleIsolateHelper(Isolate* isolate) { |
| 173 ScopedMonitor lock(monitor_); | 173 ScopedMonitor lock(monitor_); |
| 174 intptr_t i = FindIsolate(isolate); | |
| 175 if (i >= 0) { | |
| 176 // Already scheduled. | |
| 177 return; | |
| 178 } | |
| 179 { | 174 { |
| 180 ScopedMutex profiler_data_lock(isolate->profiler_data_mutex()); | 175 ScopedMutex profiler_data_lock(isolate->profiler_data_mutex()); |
| 181 IsolateProfilerData* profiler_data = isolate->profiler_data(); | 176 IsolateProfilerData* profiler_data = isolate->profiler_data(); |
| 182 if (profiler_data == NULL) { | 177 if (profiler_data == NULL) { |
| 183 return; | 178 return; |
| 184 } | 179 } |
| 185 profiler_data->Scheduled(OS::GetCurrentTimeMicros(), | 180 profiler_data->Scheduled(OS::GetCurrentTimeMicros(), |
| 186 Thread::GetCurrentThreadId()); | 181 Thread::GetCurrentThreadId()); |
| 187 } | 182 } |
| 183 intptr_t i = FindIsolate(isolate); |
| 184 if (i >= 0) { |
| 185 // Already scheduled. |
| 186 return; |
| 187 } |
| 188 AddIsolate(isolate); | 188 AddIsolate(isolate); |
| 189 lock.Notify(); | 189 lock.Notify(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| 193 void ProfilerManager::ScheduleIsolate(Isolate* isolate, bool inside_signal) { | 193 void ProfilerManager::ScheduleIsolate(Isolate* isolate, bool inside_signal) { |
| 194 if (!FLAG_profile) { | 194 if (!FLAG_profile) { |
| 195 return; | 195 return; |
| 196 } | 196 } |
| 197 ASSERT(initialized_); | 197 ASSERT(initialized_); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return false; | 644 return false; |
| 645 } | 645 } |
| 646 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); | 646 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); |
| 647 cursor += sizeof(fp); | 647 cursor += sizeof(fp); |
| 648 bool r = cursor >= lower_bound_ && cursor < stack_upper_; | 648 bool r = cursor >= lower_bound_ && cursor < stack_upper_; |
| 649 return r; | 649 return r; |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 } // namespace dart | 653 } // namespace dart |
| OLD | NEW |