| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_BASE_ISOLATE_H_ | 5 #ifndef VM_BASE_ISOLATE_H_ |
| 6 #define VM_BASE_ISOLATE_H_ | 6 #define VM_BASE_ISOLATE_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #endif | 57 #endif |
| 58 } | 58 } |
| 59 | 59 |
| 60 void DecrementNoHandleScopeDepth() { | 60 void DecrementNoHandleScopeDepth() { |
| 61 #if defined(DEBUG) | 61 #if defined(DEBUG) |
| 62 ASSERT(no_handle_scope_depth_ > 0); | 62 ASSERT(no_handle_scope_depth_ > 0); |
| 63 no_handle_scope_depth_ -= 1; | 63 no_handle_scope_depth_ -= 1; |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| 66 | 66 |
| 67 int32_t no_gc_scope_depth() const { | 67 int32_t no_safepoint_scope_depth() const { |
| 68 #if defined(DEBUG) | 68 #if defined(DEBUG) |
| 69 return no_gc_scope_depth_; | 69 return no_safepoint_scope_depth_; |
| 70 #else | 70 #else |
| 71 return 0; | 71 return 0; |
| 72 #endif | 72 #endif |
| 73 } | 73 } |
| 74 | 74 |
| 75 void IncrementNoGCScopeDepth() { | 75 void IncrementNoSafepointScopeDepth() { |
| 76 #if defined(DEBUG) | 76 #if defined(DEBUG) |
| 77 ASSERT(no_gc_scope_depth_ < INT_MAX); | 77 ASSERT(no_safepoint_scope_depth_ < INT_MAX); |
| 78 no_gc_scope_depth_ += 1; | 78 no_safepoint_scope_depth_ += 1; |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 | 81 |
| 82 void DecrementNoGCScopeDepth() { | 82 void DecrementNoSafepointScopeDepth() { |
| 83 #if defined(DEBUG) | 83 #if defined(DEBUG) |
| 84 ASSERT(no_gc_scope_depth_ > 0); | 84 ASSERT(no_safepoint_scope_depth_ > 0); |
| 85 no_gc_scope_depth_ -= 1; | 85 no_safepoint_scope_depth_ -= 1; |
| 86 #endif | 86 #endif |
| 87 } | 87 } |
| 88 | 88 |
| 89 int32_t no_callback_scope_depth() const { | 89 int32_t no_callback_scope_depth() const { |
| 90 return no_callback_scope_depth_; | 90 return no_callback_scope_depth_; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void IncrementNoCallbackScopeDepth() { | 93 void IncrementNoCallbackScopeDepth() { |
| 94 ASSERT(no_callback_scope_depth_ < INT_MAX); | 94 ASSERT(no_callback_scope_depth_ < INT_MAX); |
| 95 no_callback_scope_depth_ += 1; | 95 no_callback_scope_depth_ += 1; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void DecrementNoCallbackScopeDepth() { | 98 void DecrementNoCallbackScopeDepth() { |
| 99 ASSERT(no_callback_scope_depth_ > 0); | 99 ASSERT(no_callback_scope_depth_ > 0); |
| 100 no_callback_scope_depth_ -= 1; | 100 no_callback_scope_depth_ -= 1; |
| 101 } | 101 } |
| 102 | 102 |
| 103 #if defined(DEBUG) | 103 #if defined(DEBUG) |
| 104 static void AssertCurrent(BaseIsolate* isolate); | 104 static void AssertCurrent(BaseIsolate* isolate); |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 BaseIsolate() | 108 BaseIsolate() |
| 109 : top_resource_(NULL), | 109 : top_resource_(NULL), |
| 110 current_zone_(NULL), | 110 current_zone_(NULL), |
| 111 #if defined(DEBUG) | 111 #if defined(DEBUG) |
| 112 top_handle_scope_(NULL), | 112 top_handle_scope_(NULL), |
| 113 no_handle_scope_depth_(0), | 113 no_handle_scope_depth_(0), |
| 114 no_gc_scope_depth_(0), | 114 no_safepoint_scope_depth_(0), |
| 115 #endif | 115 #endif |
| 116 no_callback_scope_depth_(0) | 116 no_callback_scope_depth_(0) |
| 117 {} | 117 {} |
| 118 | 118 |
| 119 ~BaseIsolate() { | 119 ~BaseIsolate() { |
| 120 // Do not delete stack resources: top_resource_ and current_zone_. | 120 // Do not delete stack resources: top_resource_ and current_zone_. |
| 121 } | 121 } |
| 122 | 122 |
| 123 StackResource* top_resource_; | 123 StackResource* top_resource_; |
| 124 Zone* current_zone_; | 124 Zone* current_zone_; |
| 125 #if defined(DEBUG) | 125 #if defined(DEBUG) |
| 126 HandleScope* top_handle_scope_; | 126 HandleScope* top_handle_scope_; |
| 127 int32_t no_handle_scope_depth_; | 127 int32_t no_handle_scope_depth_; |
| 128 int32_t no_gc_scope_depth_; | 128 int32_t no_safepoint_scope_depth_; |
| 129 #endif | 129 #endif |
| 130 int32_t no_callback_scope_depth_; | 130 int32_t no_callback_scope_depth_; |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 DISALLOW_COPY_AND_ASSIGN(BaseIsolate); | 133 DISALLOW_COPY_AND_ASSIGN(BaseIsolate); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace dart | 136 } // namespace dart |
| 137 | 137 |
| 138 #endif // VM_BASE_ISOLATE_H_ | 138 #endif // VM_BASE_ISOLATE_H_ |
| OLD | NEW |