| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/atomic.h" | 10 #include "vm/atomic.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 void set_compilation_allowed(bool allowed) { | 480 void set_compilation_allowed(bool allowed) { |
| 481 compilation_allowed_ = allowed; | 481 compilation_allowed_ = allowed; |
| 482 } | 482 } |
| 483 | 483 |
| 484 // In precompilation we finalize all regular classes before compiling. | 484 // In precompilation we finalize all regular classes before compiling. |
| 485 bool all_classes_finalized() const { return all_classes_finalized_; } | 485 bool all_classes_finalized() const { return all_classes_finalized_; } |
| 486 void set_all_classes_finalized(bool value) { | 486 void set_all_classes_finalized(bool value) { |
| 487 all_classes_finalized_ = value; | 487 all_classes_finalized_ = value; |
| 488 } | 488 } |
| 489 | 489 |
| 490 // True during top level parsing. |
| 491 bool IsTopLevelParsing() { |
| 492 const intptr_t value = |
| 493 AtomicOperations::LoadRelaxedIntPtr(&top_level_parsing_count_); |
| 494 ASSERT(value >= 0); |
| 495 return value > 0; |
| 496 } |
| 497 |
| 498 void IncrTopLevelParsingCount() { |
| 499 AtomicOperations::IncrementBy(&top_level_parsing_count_, 1); |
| 500 } |
| 501 void DecrTopLevelParsingCount() { |
| 502 AtomicOperations::DecrementBy(&top_level_parsing_count_, 1); |
| 503 } |
| 504 |
| 490 static const uint32_t kInvalidGen = 0; | 505 static const uint32_t kInvalidGen = 0; |
| 491 | 506 |
| 492 void IncrCHAInvalidationGen() { | 507 void IncrFieldInvalidationGen() { |
| 493 cha_invalidation_gen_++; | 508 AtomicOperations::IncrementBy(&field_invalidation_gen_, 1); |
| 494 if (cha_invalidation_gen_ == kInvalidGen) cha_invalidation_gen_++; | 509 if (field_invalidation_gen_ == kInvalidGen) { |
| 510 AtomicOperations::IncrementBy(&field_invalidation_gen_, 1); |
| 511 } |
| 495 } | 512 } |
| 496 void ResetCHAInvalidationGen() { cha_invalidation_gen_ = kInvalidGen; } | 513 intptr_t field_invalidation_gen() const { return field_invalidation_gen_; } |
| 497 uint32_t cha_invalidation_gen() const { return cha_invalidation_gen_; } | |
| 498 | 514 |
| 499 | 515 void IncrLoadingInvalidationGen() { |
| 500 void IncrFieldInvalidationGen() { | 516 AtomicOperations::IncrementBy(&loading_invalidation_gen_, 1); |
| 501 field_invalidation_gen_++; | 517 if (loading_invalidation_gen_ == kInvalidGen) { |
| 502 if (field_invalidation_gen_ == kInvalidGen) field_invalidation_gen_++; | 518 AtomicOperations::IncrementBy(&loading_invalidation_gen_, 1); |
| 519 } |
| 503 } | 520 } |
| 504 | 521 intptr_t loading_invalidation_gen() { |
| 505 void ResetFieldInvalidationGen() { field_invalidation_gen_ = kInvalidGen; } | 522 return AtomicOperations::LoadRelaxedIntPtr(&loading_invalidation_gen_); |
| 506 uint32_t field_invalidation_gen() const { return field_invalidation_gen_; } | |
| 507 | |
| 508 void IncrPrefixInvalidationGen() { | |
| 509 prefix_invalidation_gen_++; | |
| 510 if (prefix_invalidation_gen_ == kInvalidGen) prefix_invalidation_gen_++; | |
| 511 } | 523 } |
| 512 void ResetPrefixInvalidationGen() { prefix_invalidation_gen_ = kInvalidGen; } | |
| 513 uint32_t prefix_invalidation_gen() const { return prefix_invalidation_gen_; } | |
| 514 | 524 |
| 515 // Used by background compiler which field became boxed and must trigger | 525 // Used by background compiler which field became boxed and must trigger |
| 516 // deoptimization in the mutator thread. | 526 // deoptimization in the mutator thread. |
| 517 void AddDeoptimizingBoxedField(const Field& field); | 527 void AddDeoptimizingBoxedField(const Field& field); |
| 518 // Returns Field::null() if none available in the list. | 528 // Returns Field::null() if none available in the list. |
| 519 RawField* GetDeoptimizingBoxedField(); | 529 RawField* GetDeoptimizingBoxedField(); |
| 520 | 530 |
| 521 RawObject* InvokePendingServiceExtensionCalls(); | 531 RawObject* InvokePendingServiceExtensionCalls(); |
| 522 void AppendServiceExtensionCall(const Instance& closure, | 532 void AppendServiceExtensionCall(const Instance& closure, |
| 523 const String& method_name, | 533 const String& method_name, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 733 |
| 724 // Isolate list next pointer. | 734 // Isolate list next pointer. |
| 725 Isolate* next_; | 735 Isolate* next_; |
| 726 | 736 |
| 727 // Used to wake the isolate when it is in the pause event loop. | 737 // Used to wake the isolate when it is in the pause event loop. |
| 728 Monitor* pause_loop_monitor_; | 738 Monitor* pause_loop_monitor_; |
| 729 | 739 |
| 730 // Invalidation generations; used to track events occuring in parallel | 740 // Invalidation generations; used to track events occuring in parallel |
| 731 // to background compilation. The counters may overflow, which is OK | 741 // to background compilation. The counters may overflow, which is OK |
| 732 // since we check for equality to detect if an event occured. | 742 // since we check for equality to detect if an event occured. |
| 733 uint32_t cha_invalidation_gen_; | 743 intptr_t field_invalidation_gen_; |
| 734 uint32_t field_invalidation_gen_; | 744 intptr_t loading_invalidation_gen_; |
| 735 uint32_t prefix_invalidation_gen_; | 745 intptr_t top_level_parsing_count_; |
| 736 | 746 |
| 737 // Protect access to boxed_field_list_. | 747 // Protect access to boxed_field_list_. |
| 738 Mutex* boxed_field_list_mutex_; | 748 Mutex* boxed_field_list_mutex_; |
| 739 // List of fields that became boxed and that trigger deoptimization. | 749 // List of fields that became boxed and that trigger deoptimization. |
| 740 RawGrowableObjectArray* boxed_field_list_; | 750 RawGrowableObjectArray* boxed_field_list_; |
| 741 | 751 |
| 742 // This guards spawn_count_. An isolate cannot complete shutdown and be | 752 // This guards spawn_count_. An isolate cannot complete shutdown and be |
| 743 // destroyed while there are child isolates in the midst of a spawn. | 753 // destroyed while there are child isolates in the midst of a spawn. |
| 744 Monitor* spawn_count_monitor_; | 754 Monitor* spawn_count_monitor_; |
| 745 intptr_t spawn_count_; | 755 intptr_t spawn_count_; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 intptr_t* spawn_count_; | 913 intptr_t* spawn_count_; |
| 904 | 914 |
| 905 Dart_IsolateFlags isolate_flags_; | 915 Dart_IsolateFlags isolate_flags_; |
| 906 bool paused_; | 916 bool paused_; |
| 907 bool errors_are_fatal_; | 917 bool errors_are_fatal_; |
| 908 }; | 918 }; |
| 909 | 919 |
| 910 } // namespace dart | 920 } // namespace dart |
| 911 | 921 |
| 912 #endif // VM_ISOLATE_H_ | 922 #endif // VM_ISOLATE_H_ |
| OLD | NEW |