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

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

Issue 9328042: Move the thread local functions to the Thread class in runtime/platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/platform/thread_win.cc ('k') | runtime/vm/isolate.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) 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_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define VM_ISOLATE_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 "platform/thread.h"
10 #include "vm/store_buffer.h" 11 #include "vm/store_buffer.h"
11 #include "vm/timer.h" 12 #include "vm/timer.h"
12 13
13 namespace dart { 14 namespace dart {
14 15
15 // Forward declarations. 16 // Forward declarations.
16 class ApiState; 17 class ApiState;
17 class BigintStore; 18 class BigintStore;
18 class CodeIndexTable; 19 class CodeIndexTable;
19 class Debugger; 20 class Debugger;
20 class HandleScope; 21 class HandleScope;
21 class HandleVisitor; 22 class HandleVisitor;
22 class Heap; 23 class Heap;
23 class LongJump; 24 class LongJump;
24 class MessageHandler; 25 class MessageHandler;
25 class Mutex; 26 class Mutex;
26 class ObjectPointerVisitor; 27 class ObjectPointerVisitor;
27 class ObjectStore; 28 class ObjectStore;
28 class RawContext; 29 class RawContext;
29 class RawError; 30 class RawError;
30 class StackResource; 31 class StackResource;
31 class StubCode; 32 class StubCode;
32 class Zone; 33 class Zone;
33 34
35
34 class Isolate { 36 class Isolate {
35 public: 37 public:
36 ~Isolate(); 38 ~Isolate();
37 39
38 static inline Isolate* Current(); 40 static inline Isolate* Current() {
41 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key));
42 }
43
39 static void SetCurrent(Isolate* isolate); 44 static void SetCurrent(Isolate* isolate);
40 45
41 static void InitOnce(); 46 static void InitOnce();
42 static Isolate* Init(const char* name_prefix); 47 static Isolate* Init(const char* name_prefix);
43 void Shutdown(); 48 void Shutdown();
44 49
45 // Visit all object pointers. 50 // Visit all object pointers.
46 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); 51 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames);
47 52
48 void VisitWeakPersistentHandles(HandleVisitor* visitor); 53 void VisitWeakPersistentHandles(HandleVisitor* visitor);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 Isolate(); 240 Isolate();
236 241
237 void BuildName(const char* name_prefix); 242 void BuildName(const char* name_prefix);
238 void PrintInvokedFunctions(); 243 void PrintInvokedFunctions();
239 244
240 static uword GetSpecifiedStackSize(); 245 static uword GetSpecifiedStackSize();
241 246
242 static const uword kStackSizeBuffer = (128 * KB); 247 static const uword kStackSizeBuffer = (128 * KB);
243 static const uword kDefaultStackSize = (1 * MB); 248 static const uword kDefaultStackSize = (1 * MB);
244 249
250 static ThreadLocalKey isolate_key;
245 StoreBufferBlock store_buffer_; 251 StoreBufferBlock store_buffer_;
246 Dart_MessageNotifyCallback message_notify_callback_; 252 Dart_MessageNotifyCallback message_notify_callback_;
247 char* name_; 253 char* name_;
248 Dart_Port main_port_; 254 Dart_Port main_port_;
249 Heap* heap_; 255 Heap* heap_;
250 ObjectStore* object_store_; 256 ObjectStore* object_store_;
251 StackResource* top_resource_; 257 StackResource* top_resource_;
252 RawContext* top_context_; 258 RawContext* top_context_;
253 Zone* current_zone_; 259 Zone* current_zone_;
254 #if defined(DEBUG) 260 #if defined(DEBUG)
(...skipping 19 matching lines...) Expand all
274 MessageHandler* message_handler_; 280 MessageHandler* message_handler_;
275 281
276 static Dart_IsolateCreateCallback create_callback_; 282 static Dart_IsolateCreateCallback create_callback_;
277 static Dart_IsolateInterruptCallback interrupt_callback_; 283 static Dart_IsolateInterruptCallback interrupt_callback_;
278 284
279 DISALLOW_COPY_AND_ASSIGN(Isolate); 285 DISALLOW_COPY_AND_ASSIGN(Isolate);
280 }; 286 };
281 287
282 } // namespace dart 288 } // namespace dart
283 289
284 #if defined(TARGET_OS_LINUX)
285 #include "vm/isolate_linux.h"
286 #elif defined(TARGET_OS_MACOS)
287 #include "vm/isolate_macos.h"
288 #elif defined(TARGET_OS_WINDOWS)
289 #include "vm/isolate_win.h"
290 #else
291 #error Unknown target os.
292 #endif
293
294 #endif // VM_ISOLATE_H_ 290 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/platform/thread_win.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698