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

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

Issue 1363033003: Make TimelineEventBlocks reclaimable (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/isolate.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 "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"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 static intptr_t name##_entry_point_offset() { \ 254 static intptr_t name##_entry_point_offset() { \
255 return OFFSET_OF(Thread, name##_entry_point_); \ 255 return OFFSET_OF(Thread, name##_entry_point_); \
256 } 256 }
257 LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD) 257 LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD)
258 #undef DEFINE_OFFSET_METHOD 258 #undef DEFINE_OFFSET_METHOD
259 259
260 static bool CanLoadFromThread(const Object& object); 260 static bool CanLoadFromThread(const Object& object);
261 static intptr_t OffsetFromThread(const Object& object); 261 static intptr_t OffsetFromThread(const Object& object);
262 static intptr_t OffsetFromThread(const RuntimeEntry* runtime_entry); 262 static intptr_t OffsetFromThread(const RuntimeEntry* runtime_entry);
263 263
264 Mutex* timeline_block_lock() {
265 return &timeline_block_lock_;
266 }
267
268 // Only safe to access when holding |timeline_block_lock_|.
264 TimelineEventBlock* timeline_block() const { 269 TimelineEventBlock* timeline_block() const {
265 return state_.timeline_block; 270 return state_.timeline_block;
266 } 271 }
267 272
273 // Only safe to access when holding |timeline_block_lock_|.
268 void set_timeline_block(TimelineEventBlock* block) { 274 void set_timeline_block(TimelineEventBlock* block) {
269 state_.timeline_block = block; 275 state_.timeline_block = block;
270 } 276 }
271 277
272 void CloseTimelineBlock();
273 class Log* log() const; 278 class Log* log() const;
274 279
275 LongJumpScope* long_jump_base() const { return state_.long_jump_base; } 280 LongJumpScope* long_jump_base() const { return state_.long_jump_base; }
276 void set_long_jump_base(LongJumpScope* value) { 281 void set_long_jump_base(LongJumpScope* value) {
277 state_.long_jump_base = value; 282 state_.long_jump_base = value;
278 } 283 }
279 284
280 ThreadId id() const { 285 ThreadId id() const {
281 ASSERT(id_ != OSThread::kInvalidThreadId); 286 ASSERT(id_ != OSThread::kInvalidThreadId);
282 return id_; 287 return id_;
283 } 288 }
284 289
285 void SetThreadInterrupter(ThreadInterruptCallback callback, void* data); 290 void SetThreadInterrupter(ThreadInterruptCallback callback, void* data);
286 291
287 bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback, 292 bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback,
288 void** data) const; 293 void** data) const;
289 294
290 private: 295 private:
291 static ThreadLocalKey thread_key_; 296 static ThreadLocalKey thread_key_;
292 297
293 const ThreadId id_; 298 const ThreadId id_;
294 ThreadInterruptCallback thread_interrupt_callback_; 299 ThreadInterruptCallback thread_interrupt_callback_;
295 void* thread_interrupt_data_; 300 void* thread_interrupt_data_;
296 Isolate* isolate_; 301 Isolate* isolate_;
297 Heap* heap_; 302 Heap* heap_;
298 State state_; 303 State state_;
304 Mutex timeline_block_lock_;
299 StoreBufferBlock* store_buffer_block_; 305 StoreBufferBlock* store_buffer_block_;
300 class Log* log_; 306 class Log* log_;
301 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 307 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
302 type_name member_name; 308 type_name member_name;
303 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) 309 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS)
304 #undef DECLARE_MEMBERS 310 #undef DECLARE_MEMBERS
305 311
306 #define DECLARE_MEMBERS(name) \ 312 #define DECLARE_MEMBERS(name) \
307 uword name##_entry_point_; 313 uword name##_entry_point_;
308 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) 314 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 friend class ApiZone; 347 friend class ApiZone;
342 friend class Isolate; 348 friend class Isolate;
343 friend class StackZone; 349 friend class StackZone;
344 friend class ThreadRegistry; 350 friend class ThreadRegistry;
345 DISALLOW_COPY_AND_ASSIGN(Thread); 351 DISALLOW_COPY_AND_ASSIGN(Thread);
346 }; 352 };
347 353
348 } // namespace dart 354 } // namespace dart
349 355
350 #endif // VM_THREAD_H_ 356 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698