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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 ASSERT(new_capacity < kMaxProfiledIsolates); | 194 ASSERT(new_capacity < kMaxProfiledIsolates); |
195 ASSERT(new_capacity > isolates_capacity_); | 195 ASSERT(new_capacity > isolates_capacity_); |
196 Isolate* isolate = NULL; | 196 Isolate* isolate = NULL; |
197 isolates_ = reinterpret_cast<Isolate**>( | 197 isolates_ = reinterpret_cast<Isolate**>( |
198 realloc(isolates_, sizeof(isolate) * new_capacity)); | 198 realloc(isolates_, sizeof(isolate) * new_capacity)); |
199 isolates_capacity_ = new_capacity; | 199 isolates_capacity_ = new_capacity; |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 void ProfilerManager::AddIsolate(Isolate* isolate) { | 203 void ProfilerManager::AddIsolate(Isolate* isolate) { |
| 204 if (isolates_ == NULL) { |
| 205 // We are shutting down. |
| 206 return; |
| 207 } |
204 // Must be called with monitor_ locked. | 208 // Must be called with monitor_ locked. |
205 if (isolates_size_ == isolates_capacity_) { | 209 if (isolates_size_ == isolates_capacity_) { |
206 ResizeIsolates(isolates_capacity_ == 0 ? 16 : isolates_capacity_ * 2); | 210 ResizeIsolates(isolates_capacity_ == 0 ? 16 : isolates_capacity_ * 2); |
207 } | 211 } |
208 isolates_[isolates_size_] = isolate; | 212 isolates_[isolates_size_] = isolate; |
209 isolates_size_++; | 213 isolates_size_++; |
210 } | 214 } |
211 | 215 |
212 | 216 |
213 intptr_t ProfilerManager::FindIsolate(Isolate* isolate) { | 217 intptr_t ProfilerManager::FindIsolate(Isolate* isolate) { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return false; | 563 return false; |
560 } | 564 } |
561 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); | 565 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); |
562 cursor += sizeof(fp); | 566 cursor += sizeof(fp); |
563 bool r = cursor >= stack_lower_ && cursor <= stack_upper_; | 567 bool r = cursor >= stack_lower_ && cursor <= stack_upper_; |
564 return r; | 568 return r; |
565 } | 569 } |
566 | 570 |
567 | 571 |
568 } // namespace dart | 572 } // namespace dart |
OLD | NEW |