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

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

Issue 1409173002: More work for background compilation; move pending_functions_ from ObjectStore to Thread. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Better code. Created 5 years, 2 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/parser.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/handles.h" 9 #include "vm/handles.h"
10 #include "vm/os_thread.h" 10 #include "vm/os_thread.h"
(...skipping 17 matching lines...) Expand all
28 class Instance; 28 class Instance;
29 class Isolate; 29 class Isolate;
30 class Library; 30 class Library;
31 class Log; 31 class Log;
32 class LongJumpScope; 32 class LongJumpScope;
33 class Object; 33 class Object;
34 class PcDescriptors; 34 class PcDescriptors;
35 class RawBool; 35 class RawBool;
36 class RawObject; 36 class RawObject;
37 class RawCode; 37 class RawCode;
38 class RawGrowableObjectArray;
38 class RawString; 39 class RawString;
39 class RuntimeEntry; 40 class RuntimeEntry;
40 class StackResource; 41 class StackResource;
41 class String; 42 class String;
42 class TimelineEventBlock; 43 class TimelineEventBlock;
43 class TypeArguments; 44 class TypeArguments;
44 class TypeParameter; 45 class TypeParameter;
45 class Zone; 46 class Zone;
46 47
47 #define REUSABLE_HANDLE_LIST(V) \ 48 #define REUSABLE_HANDLE_LIST(V) \
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 398
398 void ClearReusableHandles(); 399 void ClearReusableHandles();
399 400
400 #define REUSABLE_HANDLE(object) \ 401 #define REUSABLE_HANDLE(object) \
401 object& object##Handle() const { \ 402 object& object##Handle() const { \
402 return *object##_handle_; \ 403 return *object##_handle_; \
403 } 404 }
404 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) 405 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE)
405 #undef REUSABLE_HANDLE 406 #undef REUSABLE_HANDLE
406 407
408 RawGrowableObjectArray* pending_functions();
409
407 void VisitObjectPointers(ObjectPointerVisitor* visitor); 410 void VisitObjectPointers(ObjectPointerVisitor* visitor);
408 411
409 private: 412 private:
410 template<class T> T* AllocateReusableHandle(); 413 template<class T> T* AllocateReusableHandle();
411 414
412 static ThreadLocalKey thread_key_; 415 static ThreadLocalKey thread_key_;
413 416
414 const ThreadId id_; 417 const ThreadId id_;
415 ThreadInterruptCallback thread_interrupt_callback_; 418 ThreadInterruptCallback thread_interrupt_callback_;
416 void* thread_interrupt_data_; 419 void* thread_interrupt_data_;
417 Isolate* isolate_; 420 Isolate* isolate_;
418 Heap* heap_; 421 Heap* heap_;
419 State state_; 422 State state_;
420 Mutex timeline_block_lock_; 423 Mutex timeline_block_lock_;
421 TimelineEventBlock* timeline_block_; 424 TimelineEventBlock* timeline_block_;
422 StoreBufferBlock* store_buffer_block_; 425 StoreBufferBlock* store_buffer_block_;
423 class Log* log_; 426 class Log* log_;
424 intptr_t deopt_id_; // Compilation specific counter.
425 uword vm_tag_;
426 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 427 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
427 type_name member_name; 428 type_name member_name;
428 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) 429 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS)
429 #undef DECLARE_MEMBERS 430 #undef DECLARE_MEMBERS
430 431
431 #define DECLARE_MEMBERS(name) \ 432 #define DECLARE_MEMBERS(name) \
432 uword name##_entry_point_; 433 uword name##_entry_point_;
433 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) 434 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS)
434 #undef DECLARE_MEMBERS 435 #undef DECLARE_MEMBERS
435 436
(...skipping 10 matching lines...) Expand all
446 447
447 #if defined(DEBUG) 448 #if defined(DEBUG)
448 #define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \ 449 #define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \
449 bool reusable_##object##_handle_scope_active_; 450 bool reusable_##object##_handle_scope_active_;
450 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE); 451 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE);
451 #undef REUSABLE_HANDLE_SCOPE_VARIABLE 452 #undef REUSABLE_HANDLE_SCOPE_VARIABLE
452 #endif // defined(DEBUG) 453 #endif // defined(DEBUG)
453 454
454 VMHandles reusable_handles_; 455 VMHandles reusable_handles_;
455 456
457 // Compiler state:
456 CHA* cha_; 458 CHA* cha_;
459 intptr_t deopt_id_; // Compilation specific counter.
460 uword vm_tag_;
461 RawGrowableObjectArray* pending_functions_;
462
457 int32_t no_callback_scope_depth_; 463 int32_t no_callback_scope_depth_;
458 464
459 // All |Thread|s are registered in the thread list. 465 // All |Thread|s are registered in the thread list.
460 Thread* thread_list_next_; 466 Thread* thread_list_next_;
461 467
462 static Thread* thread_list_head_; 468 static Thread* thread_list_head_;
463 static Mutex* thread_list_lock_; 469 static Mutex* thread_list_lock_;
464 470
465 static void AddThreadToList(Thread* thread); 471 static void AddThreadToList(Thread* thread);
466 static void RemoveThreadFromList(Thread* thread); 472 static void RemoveThreadFromList(Thread* thread);
467 473
468 explicit Thread(bool init_vm_constants = true); 474 explicit Thread(bool init_vm_constants = true);
469 475
470 void InitVMConstants(); 476 void InitVMConstants();
471 477
472 void ClearState() { 478 void ClearState();
473 memset(&state_, 0, sizeof(state_));
474 }
475 479
476 void StoreBufferRelease( 480 void StoreBufferRelease(
477 StoreBuffer::ThresholdPolicy policy = StoreBuffer::kCheckThreshold); 481 StoreBuffer::ThresholdPolicy policy = StoreBuffer::kCheckThreshold);
478 void StoreBufferAcquire(); 482 void StoreBufferAcquire();
479 483
480 void set_zone(Zone* zone) { 484 void set_zone(Zone* zone) {
481 state_.zone = zone; 485 state_.zone = zone;
482 } 486 }
483 487
484 void set_top_exit_frame_info(uword top_exit_frame_info) { 488 void set_top_exit_frame_info(uword top_exit_frame_info) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 }; 528 };
525 529
526 #if defined(TARGET_OS_WINDOWS) 530 #if defined(TARGET_OS_WINDOWS)
527 // Clears the state of the current thread and frees the allocation. 531 // Clears the state of the current thread and frees the allocation.
528 void WindowsThreadCleanUp(); 532 void WindowsThreadCleanUp();
529 #endif 533 #endif
530 534
531 } // namespace dart 535 } // namespace dart
532 536
533 #endif // VM_THREAD_H_ 537 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698