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 "vm/base_isolate.h" | 10 #include "vm/base_isolate.h" |
11 #include "vm/class_table.h" | 11 #include "vm/class_table.h" |
12 #include "vm/counters.h" | 12 #include "vm/counters.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/metrics.h" |
15 #include "vm/random.h" | 16 #include "vm/random.h" |
16 #include "vm/store_buffer.h" | 17 #include "vm/store_buffer.h" |
17 #include "vm/tags.h" | 18 #include "vm/tags.h" |
18 #include "vm/thread.h" | 19 #include "vm/thread.h" |
19 #include "vm/trace_buffer.h" | 20 #include "vm/trace_buffer.h" |
20 #include "vm/timer.h" | 21 #include "vm/timer.h" |
21 | 22 |
22 namespace dart { | 23 namespace dart { |
23 | 24 |
24 // Forward declarations. | 25 // Forward declarations. |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 uword user_tag() const { | 549 uword user_tag() const { |
549 return user_tag_; | 550 return user_tag_; |
550 } | 551 } |
551 static intptr_t user_tag_offset() { | 552 static intptr_t user_tag_offset() { |
552 return OFFSET_OF(Isolate, user_tag_); | 553 return OFFSET_OF(Isolate, user_tag_); |
553 } | 554 } |
554 static intptr_t current_tag_offset() { | 555 static intptr_t current_tag_offset() { |
555 return OFFSET_OF(Isolate, current_tag_); | 556 return OFFSET_OF(Isolate, current_tag_); |
556 } | 557 } |
557 | 558 |
| 559 #define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \ |
| 560 type* Get##variable##Metric() { return &metric_##variable##_; } |
| 561 ISOLATE_METRIC_LIST(ISOLATE_METRIC_ACCESSOR); |
| 562 #undef ISOLATE_METRIC_ACCESSOR |
| 563 |
| 564 static intptr_t IsolateListLength(); |
| 565 |
558 RawGrowableObjectArray* tag_table() const { return tag_table_; } | 566 RawGrowableObjectArray* tag_table() const { return tag_table_; } |
559 void set_tag_table(const GrowableObjectArray& value); | 567 void set_tag_table(const GrowableObjectArray& value); |
560 | 568 |
561 RawUserTag* current_tag() const { return current_tag_; } | 569 RawUserTag* current_tag() const { return current_tag_; } |
562 void set_current_tag(const UserTag& tag); | 570 void set_current_tag(const UserTag& tag); |
563 | 571 |
| 572 Metric* metrics_list_head() { |
| 573 return metrics_list_head_; |
| 574 } |
| 575 |
| 576 void set_metrics_list_head(Metric* metric) { |
| 577 metrics_list_head_ = metric; |
| 578 } |
| 579 |
564 #if defined(DEBUG) | 580 #if defined(DEBUG) |
565 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ | 581 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ |
566 void set_reusable_##object##_handle_scope_active(bool value) { \ | 582 void set_reusable_##object##_handle_scope_active(bool value) { \ |
567 reusable_##object##_handle_scope_active_ = value; \ | 583 reusable_##object##_handle_scope_active_ = value; \ |
568 } \ | 584 } \ |
569 bool reusable_##object##_handle_scope_active() const { \ | 585 bool reusable_##object##_handle_scope_active() const { \ |
570 return reusable_##object##_handle_scope_active_; \ | 586 return reusable_##object##_handle_scope_active_; \ |
571 } | 587 } |
572 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS) | 588 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS) |
573 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS | 589 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 | 674 |
659 IsolateProfilerData* profiler_data_; | 675 IsolateProfilerData* profiler_data_; |
660 Mutex profiler_data_mutex_; | 676 Mutex profiler_data_mutex_; |
661 InterruptableThreadState* thread_state_; | 677 InterruptableThreadState* thread_state_; |
662 | 678 |
663 VMTagCounters vm_tag_counters_; | 679 VMTagCounters vm_tag_counters_; |
664 uword user_tag_; | 680 uword user_tag_; |
665 RawGrowableObjectArray* tag_table_; | 681 RawGrowableObjectArray* tag_table_; |
666 RawUserTag* current_tag_; | 682 RawUserTag* current_tag_; |
667 | 683 |
| 684 Metric* metrics_list_head_; |
| 685 |
668 Counters counters_; | 686 Counters counters_; |
669 | 687 |
670 // Isolate list next pointer. | 688 // Isolate list next pointer. |
671 Isolate* next_; | 689 Isolate* next_; |
672 | 690 |
673 // Reusable handles support. | 691 // Reusable handles support. |
674 #define REUSABLE_HANDLE_FIELDS(object) \ | 692 #define REUSABLE_HANDLE_FIELDS(object) \ |
675 object* object##_handle_; | 693 object* object##_handle_; |
676 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) | 694 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) |
677 #undef REUSABLE_HANDLE_FIELDS | 695 #undef REUSABLE_HANDLE_FIELDS |
678 | 696 |
679 #if defined(DEBUG) | 697 #if defined(DEBUG) |
680 #define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \ | 698 #define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \ |
681 bool reusable_##object##_handle_scope_active_; | 699 bool reusable_##object##_handle_scope_active_; |
682 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE); | 700 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE); |
683 #undef REUSABLE_HANDLE_SCOPE_VARIABLE | 701 #undef REUSABLE_HANDLE_SCOPE_VARIABLE |
684 #endif // defined(DEBUG) | 702 #endif // defined(DEBUG) |
685 | 703 |
| 704 #define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \ |
| 705 type metric_##variable##_; |
| 706 ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE); |
| 707 #undef ISOLATE_METRIC_VARIABLE |
| 708 |
686 VMHandles reusable_handles_; | 709 VMHandles reusable_handles_; |
687 | 710 |
688 static Dart_IsolateCreateCallback create_callback_; | 711 static Dart_IsolateCreateCallback create_callback_; |
689 static Dart_IsolateInterruptCallback interrupt_callback_; | 712 static Dart_IsolateInterruptCallback interrupt_callback_; |
690 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; | 713 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; |
691 static Dart_IsolateShutdownCallback shutdown_callback_; | 714 static Dart_IsolateShutdownCallback shutdown_callback_; |
692 static Dart_FileOpenCallback file_open_callback_; | 715 static Dart_FileOpenCallback file_open_callback_; |
693 static Dart_FileReadCallback file_read_callback_; | 716 static Dart_FileReadCallback file_read_callback_; |
694 static Dart_FileWriteCallback file_write_callback_; | 717 static Dart_FileWriteCallback file_write_callback_; |
695 static Dart_FileCloseCallback file_close_callback_; | 718 static Dart_FileCloseCallback file_close_callback_; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 char* script_url_; | 824 char* script_url_; |
802 char* library_url_; | 825 char* library_url_; |
803 char* class_name_; | 826 char* class_name_; |
804 char* function_name_; | 827 char* function_name_; |
805 char* exception_callback_name_; | 828 char* exception_callback_name_; |
806 }; | 829 }; |
807 | 830 |
808 } // namespace dart | 831 } // namespace dart |
809 | 832 |
810 #endif // VM_ISOLATE_H_ | 833 #endif // VM_ISOLATE_H_ |
OLD | NEW |