| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/thread.h" | 5 #include "vm/thread.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_state.h" | 7 #include "vm/dart_api_state.h" |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void Thread::StoreBufferAcquire() { | 288 void Thread::StoreBufferAcquire() { |
| 289 store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock(); | 289 store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 | 292 |
| 293 bool Thread::IsMutatorThread() const { | 293 bool Thread::IsMutatorThread() const { |
| 294 return ((isolate_ != NULL) && (isolate_->mutator_thread() == this)); | 294 return ((isolate_ != NULL) && (isolate_->mutator_thread() == this)); |
| 295 } | 295 } |
| 296 | 296 |
| 297 | 297 |
| 298 bool Thread::CanCollectGarbage() const { |
| 299 // We have non mutator threads grow the heap instead of triggering |
| 300 // a garbage collection when they are at a safepoint (e.g: background |
| 301 // compiler thread finalizing and installing code at a safepoint). |
| 302 // Note: This code will change once the new Safepoint logic is in place. |
| 303 return (IsMutatorThread() || |
| 304 (isolate_ != NULL && !isolate_->thread_registry()->AtSafepoint())); |
| 305 } |
| 306 |
| 307 |
| 298 bool Thread::IsExecutingDartCode() const { | 308 bool Thread::IsExecutingDartCode() const { |
| 299 return (top_exit_frame_info() == 0) && | 309 return (top_exit_frame_info() == 0) && |
| 300 (vm_tag() == VMTag::kDartTagId); | 310 (vm_tag() == VMTag::kDartTagId); |
| 301 } | 311 } |
| 302 | 312 |
| 303 | 313 |
| 304 bool Thread::HasExitedDartCode() const { | 314 bool Thread::HasExitedDartCode() const { |
| 305 return (top_exit_frame_info() != 0) && | 315 return (top_exit_frame_info() != 0) && |
| 306 (vm_tag() != VMTag::kDartTagId); | 316 (vm_tag() != VMTag::kDartTagId); |
| 307 } | 317 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 466 |
| 457 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 467 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
| 458 if (thread() != NULL) { | 468 if (thread() != NULL) { |
| 459 OSThread* os_thread = thread()->os_thread(); | 469 OSThread* os_thread = thread()->os_thread(); |
| 460 ASSERT(os_thread != NULL); | 470 ASSERT(os_thread != NULL); |
| 461 os_thread->EnableThreadInterrupts(); | 471 os_thread->EnableThreadInterrupts(); |
| 462 } | 472 } |
| 463 } | 473 } |
| 464 | 474 |
| 465 } // namespace dart | 475 } // namespace dart |
| OLD | NEW |