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