| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 RUNTIME_VM_THREAD_H_ | 5 #ifndef RUNTIME_VM_THREAD_H_ |
| 6 #define RUNTIME_VM_THREAD_H_ | 6 #define RUNTIME_VM_THREAD_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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 void set_os_thread(OSThread* os_thread) { os_thread_ = os_thread; } | 257 void set_os_thread(OSThread* os_thread) { os_thread_ = os_thread; } |
| 258 | 258 |
| 259 // Monitor corresponding to this thread. | 259 // Monitor corresponding to this thread. |
| 260 Monitor* thread_lock() const { return thread_lock_; } | 260 Monitor* thread_lock() const { return thread_lock_; } |
| 261 | 261 |
| 262 // The topmost zone used for allocation in this thread. | 262 // The topmost zone used for allocation in this thread. |
| 263 Zone* zone() const { return zone_; } | 263 Zone* zone() const { return zone_; } |
| 264 | 264 |
| 265 bool ZoneIsOwnedByThread(Zone* zone) const; | 265 bool ZoneIsOwnedByThread(Zone* zone) const; |
| 266 | 266 |
| 267 void IncrementThreadMemoryUsage(intptr_t value) { | |
| 268 current_thread_memory_ += value; | |
| 269 if (current_thread_memory_ > thread_memory_high_watermark_) { | |
| 270 thread_memory_high_watermark_ = current_thread_memory_; | |
| 271 } | |
| 272 } | |
| 273 | |
| 274 void DecrementThreadMemoryUsage(intptr_t value) { | |
| 275 current_thread_memory_ -= value; | |
| 276 } | |
| 277 | |
| 278 intptr_t GetThreadHighWatermark() const { | |
| 279 return thread_memory_high_watermark_; | |
| 280 } | |
| 281 | |
| 282 void ClearThreadMemoryUsageStats() { | |
| 283 thread_memory_high_watermark_ = 0; | |
| 284 current_thread_memory_ = 0; | |
| 285 } | |
| 286 | |
| 287 // The reusable api local scope for this thread. | 267 // The reusable api local scope for this thread. |
| 288 ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; } | 268 ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; } |
| 289 void set_api_reusable_scope(ApiLocalScope* value) { | 269 void set_api_reusable_scope(ApiLocalScope* value) { |
| 290 ASSERT(value == NULL || api_reusable_scope_ == NULL); | 270 ASSERT(value == NULL || api_reusable_scope_ == NULL); |
| 291 api_reusable_scope_ = value; | 271 api_reusable_scope_ = value; |
| 292 } | 272 } |
| 293 | 273 |
| 294 // The api local scope for this thread, this where all local handles | 274 // The api local scope for this thread, this where all local handles |
| 295 // are allocated. | 275 // are allocated. |
| 296 ApiLocalScope* api_top_scope() const { return api_top_scope_; } | 276 ApiLocalScope* api_top_scope() const { return api_top_scope_; } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 #undef DECLARE_MEMBERS | 672 #undef DECLARE_MEMBERS |
| 693 | 673 |
| 694 #define DECLARE_MEMBERS(returntype, name, ...) uword name##_entry_point_; | 674 #define DECLARE_MEMBERS(returntype, name, ...) uword name##_entry_point_; |
| 695 LEAF_RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) | 675 LEAF_RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) |
| 696 #undef DECLARE_MEMBERS | 676 #undef DECLARE_MEMBERS |
| 697 | 677 |
| 698 TimelineStream* dart_stream_; | 678 TimelineStream* dart_stream_; |
| 699 OSThread* os_thread_; | 679 OSThread* os_thread_; |
| 700 Monitor* thread_lock_; | 680 Monitor* thread_lock_; |
| 701 Zone* zone_; | 681 Zone* zone_; |
| 702 intptr_t current_thread_memory_; | |
| 703 intptr_t thread_memory_high_watermark_; | |
| 704 ApiLocalScope* api_reusable_scope_; | 682 ApiLocalScope* api_reusable_scope_; |
| 705 ApiLocalScope* api_top_scope_; | 683 ApiLocalScope* api_top_scope_; |
| 706 StackResource* top_resource_; | 684 StackResource* top_resource_; |
| 707 LongJumpScope* long_jump_base_; | 685 LongJumpScope* long_jump_base_; |
| 708 int32_t no_callback_scope_depth_; | 686 int32_t no_callback_scope_depth_; |
| 709 #if defined(DEBUG) | 687 #if defined(DEBUG) |
| 710 HandleScope* top_handle_scope_; | 688 HandleScope* top_handle_scope_; |
| 711 int32_t no_handle_scope_depth_; | 689 int32_t no_handle_scope_depth_; |
| 712 int32_t no_safepoint_scope_depth_; | 690 int32_t no_safepoint_scope_depth_; |
| 713 #endif | 691 #endif |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 // Disable thread interrupts. | 777 // Disable thread interrupts. |
| 800 class DisableThreadInterruptsScope : public StackResource { | 778 class DisableThreadInterruptsScope : public StackResource { |
| 801 public: | 779 public: |
| 802 explicit DisableThreadInterruptsScope(Thread* thread); | 780 explicit DisableThreadInterruptsScope(Thread* thread); |
| 803 ~DisableThreadInterruptsScope(); | 781 ~DisableThreadInterruptsScope(); |
| 804 }; | 782 }; |
| 805 | 783 |
| 806 } // namespace dart | 784 } // namespace dart |
| 807 | 785 |
| 808 #endif // RUNTIME_VM_THREAD_H_ | 786 #endif // RUNTIME_VM_THREAD_H_ |
| OLD | NEW |