| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 352 |
| 353 | 353 |
| 354 void Thread::ClearReusableHandles() { | 354 void Thread::ClearReusableHandles() { |
| 355 #define CLEAR_REUSABLE_HANDLE(object) \ | 355 #define CLEAR_REUSABLE_HANDLE(object) \ |
| 356 *object##_handle_ = object::null(); | 356 *object##_handle_ = object::null(); |
| 357 REUSABLE_HANDLE_LIST(CLEAR_REUSABLE_HANDLE) | 357 REUSABLE_HANDLE_LIST(CLEAR_REUSABLE_HANDLE) |
| 358 #undef CLEAR_REUSABLE_HANDLE | 358 #undef CLEAR_REUSABLE_HANDLE |
| 359 } | 359 } |
| 360 | 360 |
| 361 | 361 |
| 362 void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 362 void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor, |
| 363 bool validate_frames) { |
| 363 ASSERT(visitor != NULL); | 364 ASSERT(visitor != NULL); |
| 364 | 365 |
| 366 if (zone_ != NULL) { |
| 367 zone_->VisitObjectPointers(visitor); |
| 368 } |
| 369 |
| 365 // Visit objects in thread specific handles area. | 370 // Visit objects in thread specific handles area. |
| 366 reusable_handles_.VisitObjectPointers(visitor); | 371 reusable_handles_.VisitObjectPointers(visitor); |
| 367 | 372 |
| 368 visitor->VisitPointer( | 373 visitor->VisitPointer( |
| 369 reinterpret_cast<RawObject**>(&pending_functions_)); | 374 reinterpret_cast<RawObject**>(&pending_functions_)); |
| 370 visitor->VisitPointer( | 375 visitor->VisitPointer( |
| 371 reinterpret_cast<RawObject**>(&sticky_error_)); | 376 reinterpret_cast<RawObject**>(&sticky_error_)); |
| 372 | 377 |
| 373 // Visit the api local scope as it has all the api local handles. | 378 // Visit the api local scope as it has all the api local handles. |
| 374 ApiLocalScope* scope = api_top_scope_; | 379 ApiLocalScope* scope = api_top_scope_; |
| 375 while (scope != NULL) { | 380 while (scope != NULL) { |
| 376 scope->local_handles()->VisitObjectPointers(visitor); | 381 scope->local_handles()->VisitObjectPointers(visitor); |
| 377 scope = scope->previous(); | 382 scope = scope->previous(); |
| 378 } | 383 } |
| 384 |
| 385 // Iterate over all the stack frames and visit objects on the stack. |
| 386 StackFrameIterator frames_iterator(top_exit_frame_info(), |
| 387 validate_frames); |
| 388 StackFrame* frame = frames_iterator.NextFrame(); |
| 389 while (frame != NULL) { |
| 390 frame->VisitObjectPointers(visitor); |
| 391 frame = frames_iterator.NextFrame(); |
| 392 } |
| 379 } | 393 } |
| 380 | 394 |
| 381 | 395 |
| 382 bool Thread::CanLoadFromThread(const Object& object) { | 396 bool Thread::CanLoadFromThread(const Object& object) { |
| 383 #define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \ | 397 #define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \ |
| 384 if (object.raw() == expr) return true; | 398 if (object.raw() == expr) return true; |
| 385 CACHED_VM_OBJECTS_LIST(CHECK_OBJECT) | 399 CACHED_VM_OBJECTS_LIST(CHECK_OBJECT) |
| 386 #undef CHECK_OBJECT | 400 #undef CHECK_OBJECT |
| 387 return false; | 401 return false; |
| 388 } | 402 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 520 |
| 507 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 521 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
| 508 if (thread() != NULL) { | 522 if (thread() != NULL) { |
| 509 OSThread* os_thread = thread()->os_thread(); | 523 OSThread* os_thread = thread()->os_thread(); |
| 510 ASSERT(os_thread != NULL); | 524 ASSERT(os_thread != NULL); |
| 511 os_thread->EnableThreadInterrupts(); | 525 os_thread->EnableThreadInterrupts(); |
| 512 } | 526 } |
| 513 } | 527 } |
| 514 | 528 |
| 515 } // namespace dart | 529 } // namespace dart |
| OLD | NEW |