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

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

Issue 1275113003: Endless thread safe timeline recorder (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/timeline.h » ('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 "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/os_thread.h" 9 #include "vm/os_thread.h"
10 #include "vm/store_buffer.h" 10 #include "vm/store_buffer.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 class CHA; 14 class CHA;
15 class HandleScope; 15 class HandleScope;
16 class Heap; 16 class Heap;
17 class InterruptableThreadState; 17 class InterruptableThreadState;
18 class Isolate; 18 class Isolate;
19 class Object; 19 class Object;
20 class RawBool; 20 class RawBool;
21 class RawObject; 21 class RawObject;
22 class StackResource; 22 class StackResource;
23 class TimelineEventBlock;
23 class Zone; 24 class Zone;
24 25
25 26
26 // List of VM-global objects/addresses cached in each Thread object. 27 // List of VM-global objects/addresses cached in each Thread object.
27 #define CACHED_VM_OBJECTS_LIST(V) \ 28 #define CACHED_VM_OBJECTS_LIST(V) \
28 V(RawObject*, object_null_, Object::null(), NULL) \ 29 V(RawObject*, object_null_, Object::null(), NULL) \
29 V(RawBool*, bool_true_, Object::bool_true().raw(), NULL) \ 30 V(RawBool*, bool_true_, Object::bool_true().raw(), NULL) \
30 V(RawBool*, bool_false_, Object::bool_false().raw(), NULL) \ 31 V(RawBool*, bool_false_, Object::bool_false().raw(), NULL) \
31 32
32 #define CACHED_ADDRESSES_LIST(V) \ 33 #define CACHED_ADDRESSES_LIST(V) \
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 state_.no_safepoint_scope_depth -= 1; 191 state_.no_safepoint_scope_depth -= 1;
191 #endif 192 #endif
192 } 193 }
193 194
194 // Collection of isolate-specific state of a thread that is saved/restored 195 // Collection of isolate-specific state of a thread that is saved/restored
195 // on isolate exit/re-entry. 196 // on isolate exit/re-entry.
196 struct State { 197 struct State {
197 Zone* zone; 198 Zone* zone;
198 uword top_exit_frame_info; 199 uword top_exit_frame_info;
199 StackResource* top_resource; 200 StackResource* top_resource;
201 TimelineEventBlock* timeline_block;
200 // TODO(koda): Migrate individual fields of InterruptableThreadState. 202 // TODO(koda): Migrate individual fields of InterruptableThreadState.
201 InterruptableThreadState* thread_state; 203 InterruptableThreadState* thread_state;
202 #if defined(DEBUG) 204 #if defined(DEBUG)
203 HandleScope* top_handle_scope; 205 HandleScope* top_handle_scope;
204 intptr_t no_handle_scope_depth; 206 intptr_t no_handle_scope_depth;
205 int32_t no_safepoint_scope_depth; 207 int32_t no_safepoint_scope_depth;
206 #endif 208 #endif
207 }; 209 };
208 210
209 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ 211 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \
210 static intptr_t member_name##offset() { \ 212 static intptr_t member_name##offset() { \
211 return OFFSET_OF(Thread, member_name); \ 213 return OFFSET_OF(Thread, member_name); \
212 } 214 }
213 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) 215 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD)
214 #undef DEFINE_OFFSET_METHOD 216 #undef DEFINE_OFFSET_METHOD
215 217
216 static bool CanLoadFromThread(const Object& object); 218 static bool CanLoadFromThread(const Object& object);
217 static intptr_t OffsetFromThread(const Object& object); 219 static intptr_t OffsetFromThread(const Object& object);
218 220
221 TimelineEventBlock* timeline_block() const {
222 return state_.timeline_block;
223 }
224
225 void set_timeline_block(TimelineEventBlock* block) {
226 state_.timeline_block = block;
227 }
228
219 private: 229 private:
220 static ThreadLocalKey thread_key_; 230 static ThreadLocalKey thread_key_;
221 231
222 Isolate* isolate_; 232 Isolate* isolate_;
223 Heap* heap_; 233 Heap* heap_;
224 State state_; 234 State state_;
225 StoreBufferBlock* store_buffer_block_; 235 StoreBufferBlock* store_buffer_block_;
226 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 236 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
227 type_name member_name; 237 type_name member_name;
228 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) 238 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS)
(...skipping 22 matching lines...) Expand all
251 261
252 friend class ApiZone; 262 friend class ApiZone;
253 friend class Isolate; 263 friend class Isolate;
254 friend class StackZone; 264 friend class StackZone;
255 DISALLOW_COPY_AND_ASSIGN(Thread); 265 DISALLOW_COPY_AND_ASSIGN(Thread);
256 }; 266 };
257 267
258 } // namespace dart 268 } // namespace dart
259 269
260 #endif // VM_THREAD_H_ 270 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698