| 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 #ifndef VM_ISOLATE_H_ | 5 #ifndef VM_ISOLATE_H_ |
| 6 #define VM_ISOLATE_H_ | 6 #define VM_ISOLATE_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/thread.h" | 10 #include "platform/thread.h" |
| 11 #include "vm/base_isolate.h" | 11 #include "vm/base_isolate.h" |
| 12 #include "vm/class_table.h" | 12 #include "vm/class_table.h" |
| 13 #include "vm/handles.h" | 13 #include "vm/handles.h" |
| 14 #include "vm/megamorphic_cache_table.h" | 14 #include "vm/megamorphic_cache_table.h" |
| 15 #include "vm/random.h" | 15 #include "vm/random.h" |
| 16 #include "vm/store_buffer.h" | 16 #include "vm/store_buffer.h" |
| 17 #include "vm/tags.h" |
| 17 #include "vm/timer.h" | 18 #include "vm/timer.h" |
| 18 | 19 |
| 19 namespace dart { | 20 namespace dart { |
| 20 | 21 |
| 21 // Forward declarations. | 22 // Forward declarations. |
| 22 class AbstractType; | 23 class AbstractType; |
| 23 class ApiState; | 24 class ApiState; |
| 24 class Array; | 25 class Array; |
| 25 class Class; | 26 class Class; |
| 26 class CodeIndexTable; | 27 class CodeIndexTable; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 438 |
| 438 void set_thread_state(InterruptableThreadState* state) { | 439 void set_thread_state(InterruptableThreadState* state) { |
| 439 ASSERT((thread_state_ == NULL) || (state == NULL)); | 440 ASSERT((thread_state_ == NULL) || (state == NULL)); |
| 440 thread_state_ = state; | 441 thread_state_ = state; |
| 441 } | 442 } |
| 442 | 443 |
| 443 InterruptableThreadState* thread_state() const { | 444 InterruptableThreadState* thread_state() const { |
| 444 return thread_state_; | 445 return thread_state_; |
| 445 } | 446 } |
| 446 | 447 |
| 448 void ProfileInterrupt(); |
| 449 |
| 450 VMTagCounters* vm_tag_counters() { |
| 451 return &vm_tag_counters_; |
| 452 } |
| 453 |
| 447 #if defined(DEBUG) | 454 #if defined(DEBUG) |
| 448 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ | 455 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ |
| 449 void set_reusable_##object##_handle_scope_active(bool value) { \ | 456 void set_reusable_##object##_handle_scope_active(bool value) { \ |
| 450 reusable_##object##_handle_scope_active_ = value; \ | 457 reusable_##object##_handle_scope_active_ = value; \ |
| 451 } \ | 458 } \ |
| 452 bool reusable_##object##_handle_scope_active() const { \ | 459 bool reusable_##object##_handle_scope_active() const { \ |
| 453 return reusable_##object##_handle_scope_active_; \ | 460 return reusable_##object##_handle_scope_active_; \ |
| 454 } | 461 } |
| 455 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS) | 462 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS) |
| 456 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS | 463 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS |
| 457 #endif // defined(DEBUG) | 464 #endif // defined(DEBUG) |
| 458 | 465 |
| 459 #define REUSABLE_HANDLE(object) \ | 466 #define REUSABLE_HANDLE(object) \ |
| 460 object& object##Handle() const { \ | 467 object& object##Handle() const { \ |
| 461 return *object##_handle_; \ | 468 return *object##_handle_; \ |
| 462 } | 469 } |
| 463 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) | 470 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) |
| 464 #undef REUSABLE_HANDLE | 471 #undef REUSABLE_HANDLE |
| 465 | 472 |
| 466 static void VisitIsolates(IsolateVisitor* visitor); | 473 static void VisitIsolates(IsolateVisitor* visitor); |
| 467 | 474 |
| 468 private: | 475 private: |
| 469 Isolate(); | 476 Isolate(); |
| 470 | 477 |
| 471 void BuildName(const char* name_prefix); | 478 void BuildName(const char* name_prefix); |
| 472 void PrintInvokedFunctions(); | 479 void PrintInvokedFunctions(); |
| 473 | 480 |
| 481 void ProfileIdle(); |
| 482 |
| 474 template<class T> T* AllocateReusableHandle(); | 483 template<class T> T* AllocateReusableHandle(); |
| 475 | 484 |
| 476 static ThreadLocalKey isolate_key; | 485 static ThreadLocalKey isolate_key; |
| 477 | 486 |
| 478 StoreBuffer store_buffer_; | 487 StoreBuffer store_buffer_; |
| 479 ClassTable class_table_; | 488 ClassTable class_table_; |
| 480 MegamorphicCacheTable megamorphic_cache_table_; | 489 MegamorphicCacheTable megamorphic_cache_table_; |
| 481 Dart_MessageNotifyCallback message_notify_callback_; | 490 Dart_MessageNotifyCallback message_notify_callback_; |
| 482 char* name_; | 491 char* name_; |
| 483 int64_t start_time_; | 492 int64_t start_time_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 524 |
| 516 bool cha_used_; | 525 bool cha_used_; |
| 517 | 526 |
| 518 // Ring buffer of objects assigned an id. | 527 // Ring buffer of objects assigned an id. |
| 519 ObjectIdRing* object_id_ring_; | 528 ObjectIdRing* object_id_ring_; |
| 520 | 529 |
| 521 IsolateProfilerData* profiler_data_; | 530 IsolateProfilerData* profiler_data_; |
| 522 Mutex profiler_data_mutex_; | 531 Mutex profiler_data_mutex_; |
| 523 InterruptableThreadState* thread_state_; | 532 InterruptableThreadState* thread_state_; |
| 524 | 533 |
| 534 VMTagCounters vm_tag_counters_; |
| 535 |
| 525 // Isolate list next pointer. | 536 // Isolate list next pointer. |
| 526 Isolate* next_; | 537 Isolate* next_; |
| 527 | 538 |
| 528 // Reusable handles support. | 539 // Reusable handles support. |
| 529 #define REUSABLE_HANDLE_FIELDS(object) \ | 540 #define REUSABLE_HANDLE_FIELDS(object) \ |
| 530 object* object##_handle_; | 541 object* object##_handle_; |
| 531 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) | 542 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) |
| 532 #undef REUSABLE_HANDLE_FIELDS | 543 #undef REUSABLE_HANDLE_FIELDS |
| 533 | 544 |
| 534 #if defined(DEBUG) | 545 #if defined(DEBUG) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 char* script_url_; | 667 char* script_url_; |
| 657 char* library_url_; | 668 char* library_url_; |
| 658 char* class_name_; | 669 char* class_name_; |
| 659 char* function_name_; | 670 char* function_name_; |
| 660 char* exception_callback_name_; | 671 char* exception_callback_name_; |
| 661 }; | 672 }; |
| 662 | 673 |
| 663 } // namespace dart | 674 } // namespace dart |
| 664 | 675 |
| 665 #endif // VM_ISOLATE_H_ | 676 #endif // VM_ISOLATE_H_ |
| OLD | NEW |