Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: runtime/vm/thread.h

Issue 1473403003: Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone e… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-patch Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VM_THREAD_H_ 5 #ifndef VM_THREAD_H_
6 #define VM_THREAD_H_ 6 #define VM_THREAD_H_
7 7
8 #include "include/dart_api.h"
8 #include "vm/globals.h" 9 #include "vm/globals.h"
9 #include "vm/handles.h" 10 #include "vm/handles.h"
10 #include "vm/os_thread.h" 11 #include "vm/os_thread.h"
11 #include "vm/store_buffer.h" 12 #include "vm/store_buffer.h"
12 #include "vm/runtime_entry_list.h" 13 #include "vm/runtime_entry_list.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 class AbstractType; 17 class AbstractType;
18 class ApiLocalScope;
17 class Array; 19 class Array;
18 class CHA; 20 class CHA;
19 class Class; 21 class Class;
20 class Code; 22 class Code;
21 class Error; 23 class Error;
22 class ExceptionHandlers; 24 class ExceptionHandlers;
23 class Field; 25 class Field;
24 class Function; 26 class Function;
25 class GrowableObjectArray; 27 class GrowableObjectArray;
26 class HandleScope; 28 class HandleScope;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 131
130 // OSThread corresponding to this thread. 132 // OSThread corresponding to this thread.
131 OSThread* os_thread() const { return os_thread_; } 133 OSThread* os_thread() const { return os_thread_; }
132 void set_os_thread(OSThread* os_thread) { 134 void set_os_thread(OSThread* os_thread) {
133 os_thread_ = os_thread; 135 os_thread_ = os_thread;
134 } 136 }
135 137
136 // The topmost zone used for allocation in this thread. 138 // The topmost zone used for allocation in this thread.
137 Zone* zone() const { return zone_; } 139 Zone* zone() const { return zone_; }
138 140
141 // The reusable api local scope for this thread.
142 ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; }
143 void set_api_reusable_scope(ApiLocalScope* value) {
144 ASSERT(value == NULL || api_reusable_scope_ == NULL);
145 api_reusable_scope_ = value;
146 }
147
148 // The api local scope for this thread, this where all local handles
149 // are allocated.
150 ApiLocalScope* api_top_scope() const { return api_top_scope_; }
151 void set_api_top_scope(ApiLocalScope* value) { api_top_scope_ = value; }
152
139 // The isolate that this thread is operating on, or NULL if none. 153 // The isolate that this thread is operating on, or NULL if none.
140 Isolate* isolate() const { return isolate_; } 154 Isolate* isolate() const { return isolate_; }
141 static intptr_t isolate_offset() { 155 static intptr_t isolate_offset() {
142 return OFFSET_OF(Thread, isolate_); 156 return OFFSET_OF(Thread, isolate_);
143 } 157 }
144 bool IsMutatorThread() const; 158 bool IsMutatorThread() const;
145 159
146 // Is |this| executing Dart code? 160 // Is |this| executing Dart code?
147 bool IsExecutingDartCode() const; 161 bool IsExecutingDartCode() const;
148 162
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 206 }
193 207
194 StackResource* top_resource() const { return top_resource_; } 208 StackResource* top_resource() const { return top_resource_; }
195 void set_top_resource(StackResource* value) { 209 void set_top_resource(StackResource* value) {
196 top_resource_ = value; 210 top_resource_ = value;
197 } 211 }
198 static intptr_t top_resource_offset() { 212 static intptr_t top_resource_offset() {
199 return OFFSET_OF(Thread, top_resource_); 213 return OFFSET_OF(Thread, top_resource_);
200 } 214 }
201 215
216 // Heap of the isolate that this thread is operating on.
217 Heap* heap() const { return heap_; }
202 static intptr_t heap_offset() { 218 static intptr_t heap_offset() {
203 return OFFSET_OF(Thread, heap_); 219 return OFFSET_OF(Thread, heap_);
204 } 220 }
205 221
206 int32_t no_handle_scope_depth() const { 222 int32_t no_handle_scope_depth() const {
207 #if defined(DEBUG) 223 #if defined(DEBUG)
208 return no_handle_scope_depth_; 224 return no_handle_scope_depth_;
209 #else 225 #else
210 return 0; 226 return 0;
211 #endif 227 #endif
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 371
356 #define REUSABLE_HANDLE(object) \ 372 #define REUSABLE_HANDLE(object) \
357 object& object##Handle() const { \ 373 object& object##Handle() const { \
358 return *object##_handle_; \ 374 return *object##_handle_; \
359 } 375 }
360 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) 376 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE)
361 #undef REUSABLE_HANDLE 377 #undef REUSABLE_HANDLE
362 378
363 RawGrowableObjectArray* pending_functions(); 379 RawGrowableObjectArray* pending_functions();
364 380
381 // Visit all object pointers.
365 void VisitObjectPointers(ObjectPointerVisitor* visitor); 382 void VisitObjectPointers(ObjectPointerVisitor* visitor);
383
384 bool IsValidLocalHandle(Dart_Handle object) const;
385 int CountLocalHandles() const;
386 int ZoneSizeInBytes() const;
387 void UnwindScopes(uword stack_marker);
388
366 void InitVMConstants(); 389 void InitVMConstants();
367 390
368 private: 391 private:
369 template<class T> T* AllocateReusableHandle(); 392 template<class T> T* AllocateReusableHandle();
370 393
371 OSThread* os_thread_; 394 OSThread* os_thread_;
372 Isolate* isolate_; 395 Isolate* isolate_;
373 Heap* heap_; 396 Heap* heap_;
374 Zone* zone_; 397 Zone* zone_;
398 ApiLocalScope* api_reusable_scope_;
399 ApiLocalScope* api_top_scope_;
375 uword top_exit_frame_info_; 400 uword top_exit_frame_info_;
376 StackResource* top_resource_; 401 StackResource* top_resource_;
377 LongJumpScope* long_jump_base_; 402 LongJumpScope* long_jump_base_;
378 StoreBufferBlock* store_buffer_block_; 403 StoreBufferBlock* store_buffer_block_;
379 int32_t no_callback_scope_depth_; 404 int32_t no_callback_scope_depth_;
380 #if defined(DEBUG) 405 #if defined(DEBUG)
381 HandleScope* top_handle_scope_; 406 HandleScope* top_handle_scope_;
382 intptr_t no_handle_scope_depth_; 407 intptr_t no_handle_scope_depth_;
383 int32_t no_safepoint_scope_depth_; 408 int32_t no_safepoint_scope_depth_;
384 #endif 409 #endif
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // Disable thread interrupts. 488 // Disable thread interrupts.
464 class DisableThreadInterruptsScope : public StackResource { 489 class DisableThreadInterruptsScope : public StackResource {
465 public: 490 public:
466 explicit DisableThreadInterruptsScope(Thread* thread); 491 explicit DisableThreadInterruptsScope(Thread* thread);
467 ~DisableThreadInterruptsScope(); 492 ~DisableThreadInterruptsScope();
468 }; 493 };
469 494
470 } // namespace dart 495 } // namespace dart
471 496
472 #endif // VM_THREAD_H_ 497 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698