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

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

Issue 1016973002: Move CHA state keeping from Isolate to Thread. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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/vm/isolate.h ('k') | no next file » | 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 "vm/isolate.h" 8 #include "vm/isolate.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 // A VM thread; may be executing Dart code or performing helper tasks like 12 // A VM thread; may be executing Dart code or performing helper tasks like
13 // garbage collection. 13 // garbage collection or compilation.
14 class Thread { 14 class Thread {
15 public: 15 public:
16 static Thread* Current() { 16 static Thread* Current() {
17 // For now, there is still just one thread per isolate, and the Thread 17 // For now, there is still just one thread per isolate, and the Thread
18 // class just aliases the Isolate*. Once all interfaces and uses have been 18 // class just aliases the Isolate*. Once all interfaces and uses have been
19 // updated to distinguish between isolates and threads, Thread will get its 19 // updated to distinguish between isolates and threads, Thread will get its
20 // own thread-local storage key. 20 // own thread-local storage key and fields.
21 return reinterpret_cast<Thread*>(Isolate::Current()); 21 return reinterpret_cast<Thread*>(Isolate::Current());
22 } 22 }
23 // TODO(koda): Remove after pivoting to Thread* in native/runtime entries. 23 // TODO(koda): Remove after pivoting to Thread* in native/runtime entries.
24 static Thread* CurrentFromCurrentIsolate(BaseIsolate* isolate) { 24 static Thread* CurrentFromCurrentIsolate(BaseIsolate* isolate) {
25 ASSERT(Isolate::Current() == isolate); 25 ASSERT(Isolate::Current() == isolate);
26 return reinterpret_cast<Thread*>(isolate); 26 return reinterpret_cast<Thread*>(isolate);
27 } 27 }
28 28
29 // The topmost zone used for allocation in this thread. 29 // The topmost zone used for allocation in this thread.
30 Zone* zone() { 30 Zone* zone() {
31 return reinterpret_cast<BaseIsolate*>(this)->current_zone(); 31 return reinterpret_cast<BaseIsolate*>(this)->current_zone();
32 } 32 }
33 33
34 // The isolate that this thread is operating on. 34 // The isolate that this thread is operating on.
35 Isolate* isolate() { 35 Isolate* isolate() { return reinterpret_cast<Isolate*>(this); }
36 return reinterpret_cast<Isolate*>(this); 36 const Isolate* isolate() const {
37 return reinterpret_cast<const Isolate*>(this);
37 } 38 }
38 39
39 // The log for this thread. 40 // The log for this thread.
40 class Log* Log() { 41 class Log* Log() {
41 return reinterpret_cast<Isolate*>(this)->Log(); 42 return reinterpret_cast<Isolate*>(this)->Log();
42 } 43 }
43 44
45 // The (topmost) CHA for the compilation in this thread.
46 CHA* cha() const { return isolate()->cha(); }
47 void set_cha(CHA* value) { isolate()->set_cha(value); }
48
44 private: 49 private:
45 DISALLOW_COPY_AND_ASSIGN(Thread); 50 DISALLOW_COPY_AND_ASSIGN(Thread);
46 }; 51 };
47 52
48 } // namespace dart 53 } // namespace dart
49 54
50 #endif // VM_THREAD_H_ 55 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698