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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 class HandleScope; | 13 class HandleScope; |
14 class StackResource; | 14 class StackResource; |
15 class Zone; | 15 class Zone; |
16 | 16 |
17 // A BaseIsolate contains just enough functionality to allocate | 17 // A BaseIsolate contains just enough functionality to allocate |
18 // StackResources. This allows us to inline the StackResource | 18 // StackResources. This allows us to inline the StackResource |
19 // constructor/destructor for performance. | 19 // constructor/destructor for performance. |
20 class BaseIsolate { | 20 class BaseIsolate { |
21 public: | 21 public: |
22 StackResource* top_resource() const { return top_resource_; } | 22 StackResource* top_resource() const { return top_resource_; } |
23 void set_top_resource(StackResource* value) { top_resource_ = value; } | 23 void set_top_resource(StackResource* value) { top_resource_ = value; } |
24 static intptr_t top_resource_offset() { | 24 static intptr_t top_resource_offset() { |
25 return OFFSET_OF(BaseIsolate, top_resource_); | 25 return OFFSET_OF(BaseIsolate, top_resource_); |
26 } | 26 } |
27 | 27 |
28 // DEPRECATED: Use Thread::current_zone. | 28 // DEPRECATED: Use Thread::current_zone. |
29 Zone* current_zone() const { return current_zone_; } | 29 Zone* current_zone() const { |
| 30 AssertCurrentThreadIsMutator(); |
| 31 return current_zone_; |
| 32 } |
30 void set_current_zone(Zone* zone) { current_zone_ = zone; } | 33 void set_current_zone(Zone* zone) { current_zone_ = zone; } |
| 34 #if defined(DEBUG) |
| 35 void AssertCurrentThreadIsMutator() const; |
| 36 #else |
| 37 void AssertCurrentThreadIsMutator() const {} |
| 38 #endif // DEBUG |
31 | 39 |
32 HandleScope* top_handle_scope() const { | 40 HandleScope* top_handle_scope() const { |
33 #if defined(DEBUG) | 41 #if defined(DEBUG) |
34 return top_handle_scope_; | 42 return top_handle_scope_; |
35 #else | 43 #else |
36 return 0; | 44 return 0; |
37 #endif | 45 #endif |
38 } | 46 } |
39 | 47 |
40 void set_top_handle_scope(HandleScope* handle_scope) { | 48 void set_top_handle_scope(HandleScope* handle_scope) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #endif | 138 #endif |
131 int32_t no_callback_scope_depth_; | 139 int32_t no_callback_scope_depth_; |
132 | 140 |
133 private: | 141 private: |
134 DISALLOW_COPY_AND_ASSIGN(BaseIsolate); | 142 DISALLOW_COPY_AND_ASSIGN(BaseIsolate); |
135 }; | 143 }; |
136 | 144 |
137 } // namespace dart | 145 } // namespace dart |
138 | 146 |
139 #endif // VM_BASE_ISOLATE_H_ | 147 #endif // VM_BASE_ISOLATE_H_ |
OLD | NEW |