| 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/atomic.h" | 10 #include "vm/atomic.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/metrics.h" | 15 #include "vm/metrics.h" |
| 16 #include "vm/random.h" | 16 #include "vm/random.h" |
| 17 #include "vm/tags.h" | 17 #include "vm/tags.h" |
| 18 #include "vm/thread.h" | 18 #include "vm/thread.h" |
| 19 #include "vm/os_thread.h" | 19 #include "vm/os_thread.h" |
| 20 #include "vm/timeline.h" | |
| 21 #include "vm/timer.h" | 20 #include "vm/timer.h" |
| 22 #include "vm/token_position.h" | 21 #include "vm/token_position.h" |
| 23 | 22 |
| 24 namespace dart { | 23 namespace dart { |
| 25 | 24 |
| 26 // Forward declarations. | 25 // Forward declarations. |
| 27 class ApiState; | 26 class ApiState; |
| 28 class BackgroundCompiler; | 27 class BackgroundCompiler; |
| 29 class Capability; | 28 class Capability; |
| 30 class CodeIndexTable; | 29 class CodeIndexTable; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 } | 534 } |
| 536 static intptr_t default_tag_offset() { | 535 static intptr_t default_tag_offset() { |
| 537 return OFFSET_OF(Isolate, default_tag_); | 536 return OFFSET_OF(Isolate, default_tag_); |
| 538 } | 537 } |
| 539 | 538 |
| 540 #define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \ | 539 #define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \ |
| 541 type* Get##variable##Metric() { return &metric_##variable##_; } | 540 type* Get##variable##Metric() { return &metric_##variable##_; } |
| 542 ISOLATE_METRIC_LIST(ISOLATE_METRIC_ACCESSOR); | 541 ISOLATE_METRIC_LIST(ISOLATE_METRIC_ACCESSOR); |
| 543 #undef ISOLATE_METRIC_ACCESSOR | 542 #undef ISOLATE_METRIC_ACCESSOR |
| 544 | 543 |
| 545 #ifndef PRODUCT | |
| 546 #define ISOLATE_TIMELINE_STREAM_ACCESSOR(name, not_used) \ | |
| 547 TimelineStream* Get##name##Stream() { return &stream_##name##_; } | |
| 548 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_ACCESSOR) | |
| 549 #undef ISOLATE_TIMELINE_STREAM_ACCESSOR | |
| 550 #else | |
| 551 #define ISOLATE_TIMELINE_STREAM_ACCESSOR(name, not_used) \ | |
| 552 TimelineStream* Get##name##Stream() { return NULL; } | |
| 553 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_ACCESSOR) | |
| 554 #undef ISOLATE_TIMELINE_STREAM_ACCESSOR | |
| 555 #endif // !PRODUCT | |
| 556 | |
| 557 static intptr_t IsolateListLength(); | 544 static intptr_t IsolateListLength(); |
| 558 | 545 |
| 559 RawGrowableObjectArray* tag_table() const { return tag_table_; } | 546 RawGrowableObjectArray* tag_table() const { return tag_table_; } |
| 560 void set_tag_table(const GrowableObjectArray& value); | 547 void set_tag_table(const GrowableObjectArray& value); |
| 561 | 548 |
| 562 RawUserTag* current_tag() const { return current_tag_; } | 549 RawUserTag* current_tag() const { return current_tag_; } |
| 563 void set_current_tag(const UserTag& tag); | 550 void set_current_tag(const UserTag& tag); |
| 564 | 551 |
| 565 RawUserTag* default_tag() const { return default_tag_; } | 552 RawUserTag* default_tag() const { return default_tag_; } |
| 566 void set_default_tag(const UserTag& tag); | 553 void set_default_tag(const UserTag& tag); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 // This guards spawn_count_. An isolate cannot complete shutdown and be | 849 // This guards spawn_count_. An isolate cannot complete shutdown and be |
| 863 // destroyed while there are child isolates in the midst of a spawn. | 850 // destroyed while there are child isolates in the midst of a spawn. |
| 864 Monitor* spawn_count_monitor_; | 851 Monitor* spawn_count_monitor_; |
| 865 intptr_t spawn_count_; | 852 intptr_t spawn_count_; |
| 866 | 853 |
| 867 #define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \ | 854 #define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \ |
| 868 type metric_##variable##_; | 855 type metric_##variable##_; |
| 869 ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE); | 856 ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE); |
| 870 #undef ISOLATE_METRIC_VARIABLE | 857 #undef ISOLATE_METRIC_VARIABLE |
| 871 | 858 |
| 872 #ifndef PRODUCT | |
| 873 #define ISOLATE_TIMELINE_STREAM_VARIABLE(name, not_used) \ | |
| 874 TimelineStream stream_##name##_; | |
| 875 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_VARIABLE) | |
| 876 #undef ISOLATE_TIMELINE_STREAM_VARIABLE | |
| 877 #endif // !PRODUCT | |
| 878 | 859 |
| 879 static Dart_IsolateCreateCallback create_callback_; | 860 static Dart_IsolateCreateCallback create_callback_; |
| 880 static Dart_IsolateShutdownCallback shutdown_callback_; | 861 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 881 static Dart_FileOpenCallback file_open_callback_; | 862 static Dart_FileOpenCallback file_open_callback_; |
| 882 static Dart_FileReadCallback file_read_callback_; | 863 static Dart_FileReadCallback file_read_callback_; |
| 883 static Dart_FileWriteCallback file_write_callback_; | 864 static Dart_FileWriteCallback file_write_callback_; |
| 884 static Dart_FileCloseCallback file_close_callback_; | 865 static Dart_FileCloseCallback file_close_callback_; |
| 885 static Dart_EntropySource entropy_source_callback_; | 866 static Dart_EntropySource entropy_source_callback_; |
| 886 static Dart_IsolateInterruptCallback vmstats_callback_; | 867 static Dart_IsolateInterruptCallback vmstats_callback_; |
| 887 | 868 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 899 #define REUSABLE_FRIEND_DECLARATION(name) \ | 880 #define REUSABLE_FRIEND_DECLARATION(name) \ |
| 900 friend class Reusable##name##HandleScope; | 881 friend class Reusable##name##HandleScope; |
| 901 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 882 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
| 902 #undef REUSABLE_FRIEND_DECLARATION | 883 #undef REUSABLE_FRIEND_DECLARATION |
| 903 | 884 |
| 904 friend class GCMarker; // VisitObjectPointers | 885 friend class GCMarker; // VisitObjectPointers |
| 905 friend class SafepointHandler; | 886 friend class SafepointHandler; |
| 906 friend class Scavenger; // VisitObjectPointers | 887 friend class Scavenger; // VisitObjectPointers |
| 907 friend class ServiceIsolate; | 888 friend class ServiceIsolate; |
| 908 friend class Thread; | 889 friend class Thread; |
| 909 friend class Timeline; | |
| 910 friend class IsolateTestHelper; | 890 friend class IsolateTestHelper; |
| 911 | 891 |
| 912 DISALLOW_COPY_AND_ASSIGN(Isolate); | 892 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 913 }; | 893 }; |
| 914 | 894 |
| 915 | 895 |
| 916 // When we need to execute code in an isolate, we use the | 896 // When we need to execute code in an isolate, we use the |
| 917 // StartIsolateScope. | 897 // StartIsolateScope. |
| 918 class StartIsolateScope { | 898 class StartIsolateScope { |
| 919 public: | 899 public: |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 intptr_t* spawn_count_; | 1015 intptr_t* spawn_count_; |
| 1036 | 1016 |
| 1037 Dart_IsolateFlags isolate_flags_; | 1017 Dart_IsolateFlags isolate_flags_; |
| 1038 bool paused_; | 1018 bool paused_; |
| 1039 bool errors_are_fatal_; | 1019 bool errors_are_fatal_; |
| 1040 }; | 1020 }; |
| 1041 | 1021 |
| 1042 } // namespace dart | 1022 } // namespace dart |
| 1043 | 1023 |
| 1044 #endif // VM_ISOLATE_H_ | 1024 #endif // VM_ISOLATE_H_ |
| OLD | NEW |