| 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 IncrementMemoryUsage(uint value) { | |
| 268 current_thread_memory_ += value; | |
| 269 if (current_thread_memory_ > memory_high_watermark_) { | |
| 270 memory_high_watermark_ = current_thread_memory_; | |
| 271 } | |
| 272 } | |
| 273 | |
| 274 void DecrementMemoryUsage(uint value) { | |
| 275 ASSERT(current_thread_memory_ >= value); | |
| 276 current_thread_memory_ -= value; | |
| 277 } | |
| 278 | |
| 279 uint memory_high_watermark() const { return memory_high_watermark_; } | |
| 280 | |
| 281 void ResetHighWatermark() { memory_high_watermark_ = current_thread_memory_; } | |
| 282 | |
| 283 // The reusable api local scope for this thread. | 267 // The reusable api local scope for this thread. |
| 284 ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; } | 268 ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; } |
| 285 void set_api_reusable_scope(ApiLocalScope* value) { | 269 void set_api_reusable_scope(ApiLocalScope* value) { |
| 286 ASSERT(value == NULL || api_reusable_scope_ == NULL); | 270 ASSERT(value == NULL || api_reusable_scope_ == NULL); |
| 287 api_reusable_scope_ = value; | 271 api_reusable_scope_ = value; |
| 288 } | 272 } |
| 289 | 273 |
| 290 // 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 |
| 291 // are allocated. | 275 // are allocated. |
| 292 ApiLocalScope* api_top_scope() const { return api_top_scope_; } | 276 ApiLocalScope* api_top_scope() const { return api_top_scope_; } |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 #undef DECLARE_MEMBERS | 674 #undef DECLARE_MEMBERS |
| 691 | 675 |
| 692 #define DECLARE_MEMBERS(returntype, name, ...) uword name##_entry_point_; | 676 #define DECLARE_MEMBERS(returntype, name, ...) uword name##_entry_point_; |
| 693 LEAF_RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) | 677 LEAF_RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) |
| 694 #undef DECLARE_MEMBERS | 678 #undef DECLARE_MEMBERS |
| 695 | 679 |
| 696 TimelineStream* dart_stream_; | 680 TimelineStream* dart_stream_; |
| 697 OSThread* os_thread_; | 681 OSThread* os_thread_; |
| 698 Monitor* thread_lock_; | 682 Monitor* thread_lock_; |
| 699 Zone* zone_; | 683 Zone* zone_; |
| 700 uint current_thread_memory_; | |
| 701 uint memory_high_watermark_; | |
| 702 ApiLocalScope* api_reusable_scope_; | 684 ApiLocalScope* api_reusable_scope_; |
| 703 ApiLocalScope* api_top_scope_; | 685 ApiLocalScope* api_top_scope_; |
| 704 StackResource* top_resource_; | 686 StackResource* top_resource_; |
| 705 LongJumpScope* long_jump_base_; | 687 LongJumpScope* long_jump_base_; |
| 706 int32_t no_callback_scope_depth_; | 688 int32_t no_callback_scope_depth_; |
| 707 #if defined(DEBUG) | 689 #if defined(DEBUG) |
| 708 HandleScope* top_handle_scope_; | 690 HandleScope* top_handle_scope_; |
| 709 int32_t no_handle_scope_depth_; | 691 int32_t no_handle_scope_depth_; |
| 710 int32_t no_safepoint_scope_depth_; | 692 int32_t no_safepoint_scope_depth_; |
| 711 #endif | 693 #endif |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 // Disable thread interrupts. | 779 // Disable thread interrupts. |
| 798 class DisableThreadInterruptsScope : public StackResource { | 780 class DisableThreadInterruptsScope : public StackResource { |
| 799 public: | 781 public: |
| 800 explicit DisableThreadInterruptsScope(Thread* thread); | 782 explicit DisableThreadInterruptsScope(Thread* thread); |
| 801 ~DisableThreadInterruptsScope(); | 783 ~DisableThreadInterruptsScope(); |
| 802 }; | 784 }; |
| 803 | 785 |
| 804 } // namespace dart | 786 } // namespace dart |
| 805 | 787 |
| 806 #endif // RUNTIME_VM_THREAD_H_ | 788 #endif // RUNTIME_VM_THREAD_H_ |
| OLD | NEW |