Chromium Code Reviews| 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" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 | 147 |
| 148 // Limited public access to BaseIsolate::mutator_thread_ for code that | 148 // Limited public access to BaseIsolate::mutator_thread_ for code that |
| 149 // must treat the mutator as the default or a special case. Prefer code | 149 // must treat the mutator as the default or a special case. Prefer code |
| 150 // that works uniformly across all threads. | 150 // that works uniformly across all threads. |
| 151 bool HasMutatorThread() { | 151 bool HasMutatorThread() { |
| 152 return mutator_thread_ != NULL; | 152 return mutator_thread_ != NULL; |
| 153 } | 153 } |
| 154 bool MutatorThreadIsCurrentThread() { | 154 bool MutatorThreadIsCurrentThread() { |
| 155 return mutator_thread_ == Thread::Current(); | 155 return mutator_thread_ == Thread::Current(); |
| 156 } | 156 } |
| 157 bool IsMutatorThread(Thread* thread) { | |
| 158 ASSERT(thread != NULL); | |
| 159 return mutator_thread_ == thread; | |
| 160 } | |
|
siva
2015/10/26 23:45:26
Both these functions
MutatorThreadIsCurrentThrea
Cutch
2015/10/27 22:36:24
I've switched to using thread->IsMutatorThread() a
| |
| 157 | 161 |
| 158 const char* name() const { return name_; } | 162 const char* name() const { return name_; } |
| 159 const char* debugger_name() const { return debugger_name_; } | 163 const char* debugger_name() const { return debugger_name_; } |
| 160 void set_debugger_name(const char* name); | 164 void set_debugger_name(const char* name); |
| 161 | 165 |
| 162 int64_t start_time() const { return start_time_; } | 166 int64_t start_time() const { return start_time_; } |
| 163 | 167 |
| 164 Dart_Port main_port() const { return main_port_; } | 168 Dart_Port main_port() const { return main_port_; } |
| 165 void set_main_port(Dart_Port port) { | 169 void set_main_port(Dart_Port port) { |
| 166 ASSERT(main_port_ == 0); // Only set main port once. | 170 ASSERT(main_port_ == 0); // Only set main port once. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 void set_message_handler(MessageHandler* value) { message_handler_ = value; } | 324 void set_message_handler(MessageHandler* value) { message_handler_ = value; } |
| 321 | 325 |
| 322 bool is_runnable() const { return is_runnable_; } | 326 bool is_runnable() const { return is_runnable_; } |
| 323 void set_is_runnable(bool value) { is_runnable_ = value; } | 327 void set_is_runnable(bool value) { is_runnable_ = value; } |
| 324 | 328 |
| 325 IsolateSpawnState* spawn_state() const { return spawn_state_; } | 329 IsolateSpawnState* spawn_state() const { return spawn_state_; } |
| 326 void set_spawn_state(IsolateSpawnState* value) { spawn_state_ = value; } | 330 void set_spawn_state(IsolateSpawnState* value) { spawn_state_ = value; } |
| 327 | 331 |
| 328 Mutex* mutex() const { return mutex_; } | 332 Mutex* mutex() const { return mutex_; } |
| 329 | 333 |
| 334 bool HasDebugger() const { | |
| 335 return debugger_ != NULL; | |
| 336 } | |
| 337 | |
| 330 Debugger* debugger() const { | 338 Debugger* debugger() const { |
| 331 ASSERT(debugger_ != NULL); | 339 ASSERT(debugger_ != NULL); |
| 332 return debugger_; | 340 return debugger_; |
| 333 } | 341 } |
| 334 | 342 |
| 335 void set_single_step(bool value) { single_step_ = value; } | 343 void set_single_step(bool value) { single_step_ = value; } |
| 336 bool single_step() const { return single_step_; } | 344 bool single_step() const { return single_step_; } |
| 337 static intptr_t single_step_offset() { | 345 static intptr_t single_step_offset() { |
| 338 return OFFSET_OF(Isolate, single_step_); | 346 return OFFSET_OF(Isolate, single_step_); |
| 339 } | 347 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 563 intptr_t UnblockClassFinalization() { | 571 intptr_t UnblockClassFinalization() { |
| 564 ASSERT(defer_finalization_count_ > 0); | 572 ASSERT(defer_finalization_count_ > 0); |
| 565 return defer_finalization_count_--; | 573 return defer_finalization_count_--; |
| 566 } | 574 } |
| 567 | 575 |
| 568 bool AllowClassFinalization() { | 576 bool AllowClassFinalization() { |
| 569 ASSERT(defer_finalization_count_ >= 0); | 577 ASSERT(defer_finalization_count_ >= 0); |
| 570 return defer_finalization_count_ == 0; | 578 return defer_finalization_count_ == 0; |
| 571 } | 579 } |
| 572 | 580 |
| 573 Mutex* profiler_data_mutex() { | |
| 574 return &profiler_data_mutex_; | |
| 575 } | |
| 576 | |
| 577 void set_profiler_data(IsolateProfilerData* profiler_data) { | |
| 578 profiler_data_ = profiler_data; | |
| 579 } | |
| 580 | |
| 581 IsolateProfilerData* profiler_data() const { | |
| 582 return profiler_data_; | |
| 583 } | |
| 584 | |
| 585 void PrintJSON(JSONStream* stream, bool ref = true); | 581 void PrintJSON(JSONStream* stream, bool ref = true); |
| 586 | 582 |
| 587 CompilerStats* compiler_stats() { | 583 CompilerStats* compiler_stats() { |
| 588 return compiler_stats_; | 584 return compiler_stats_; |
| 589 } | 585 } |
| 590 | 586 |
| 591 // Returns the number of sampled threads. | |
| 592 intptr_t ProfileInterrupt(); | |
| 593 | |
| 594 VMTagCounters* vm_tag_counters() { | 587 VMTagCounters* vm_tag_counters() { |
| 595 return &vm_tag_counters_; | 588 return &vm_tag_counters_; |
| 596 } | 589 } |
| 597 | 590 |
| 598 uword user_tag() const { | 591 uword user_tag() const { |
| 599 return user_tag_; | 592 return user_tag_; |
| 600 } | 593 } |
| 601 static intptr_t user_tag_offset() { | 594 static intptr_t user_tag_offset() { |
| 602 return OFFSET_OF(Isolate, user_tag_); | 595 return OFFSET_OF(Isolate, user_tag_); |
| 603 } | 596 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 // Timestamps of last operation via service. | 799 // Timestamps of last operation via service. |
| 807 int64_t last_allocationprofile_accumulator_reset_timestamp_; | 800 int64_t last_allocationprofile_accumulator_reset_timestamp_; |
| 808 int64_t last_allocationprofile_gc_timestamp_; | 801 int64_t last_allocationprofile_gc_timestamp_; |
| 809 | 802 |
| 810 // Ring buffer of objects assigned an id. | 803 // Ring buffer of objects assigned an id. |
| 811 ObjectIdRing* object_id_ring_; | 804 ObjectIdRing* object_id_ring_; |
| 812 | 805 |
| 813 // Trace buffer support. | 806 // Trace buffer support. |
| 814 TraceBuffer* trace_buffer_; | 807 TraceBuffer* trace_buffer_; |
| 815 | 808 |
| 816 IsolateProfilerData* profiler_data_; | |
| 817 Mutex profiler_data_mutex_; | |
| 818 | |
| 819 VMTagCounters vm_tag_counters_; | 809 VMTagCounters vm_tag_counters_; |
| 820 RawGrowableObjectArray* tag_table_; | 810 RawGrowableObjectArray* tag_table_; |
| 821 | 811 |
| 822 RawGrowableObjectArray* deoptimized_code_array_; | 812 RawGrowableObjectArray* deoptimized_code_array_; |
| 823 | 813 |
| 824 // Background compilation. | 814 // Background compilation. |
| 825 BackgroundCompiler* background_compiler_; | 815 BackgroundCompiler* background_compiler_; |
| 826 RawGrowableObjectArray* background_compilation_queue_; | 816 RawGrowableObjectArray* background_compilation_queue_; |
| 827 | 817 |
| 828 // We use 6 list entries for each pending service extension calls. | 818 // We use 6 list entries for each pending service extension calls. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1045 uint8_t* serialized_message_; | 1035 uint8_t* serialized_message_; |
| 1046 intptr_t serialized_message_len_; | 1036 intptr_t serialized_message_len_; |
| 1047 Isolate::Flags isolate_flags_; | 1037 Isolate::Flags isolate_flags_; |
| 1048 bool paused_; | 1038 bool paused_; |
| 1049 bool errors_are_fatal_; | 1039 bool errors_are_fatal_; |
| 1050 }; | 1040 }; |
| 1051 | 1041 |
| 1052 } // namespace dart | 1042 } // namespace dart |
| 1053 | 1043 |
| 1054 #endif // VM_ISOLATE_H_ | 1044 #endif // VM_ISOLATE_H_ |
| OLD | NEW |