Chromium Code Reviews| 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 top_level_parsing() const { return top_level_parsing_; } | |
| 492 void set_top_level_parsing(bool value) { top_level_parsing_ = value; } | |
| 493 | |
| 490 static const uint32_t kInvalidGen = 0; | 494 static const uint32_t kInvalidGen = 0; |
| 491 | 495 |
| 492 void IncrCHAInvalidationGen() { | |
| 493 cha_invalidation_gen_++; | |
| 494 if (cha_invalidation_gen_ == kInvalidGen) cha_invalidation_gen_++; | |
| 495 } | |
| 496 void ResetCHAInvalidationGen() { cha_invalidation_gen_ = kInvalidGen; } | |
| 497 uint32_t cha_invalidation_gen() const { return cha_invalidation_gen_; } | |
| 498 | |
| 499 | |
| 500 void IncrFieldInvalidationGen() { | 496 void IncrFieldInvalidationGen() { |
| 501 field_invalidation_gen_++; | 497 field_invalidation_gen_++; |
| 502 if (field_invalidation_gen_ == kInvalidGen) field_invalidation_gen_++; | 498 if (field_invalidation_gen_ == kInvalidGen) field_invalidation_gen_++; |
| 503 } | 499 } |
| 504 | 500 |
| 505 void ResetFieldInvalidationGen() { field_invalidation_gen_ = kInvalidGen; } | 501 void ResetFieldInvalidationGen() { field_invalidation_gen_ = kInvalidGen; } |
| 506 uint32_t field_invalidation_gen() const { return field_invalidation_gen_; } | 502 uint32_t field_invalidation_gen() const { return field_invalidation_gen_; } |
| 507 | 503 |
| 508 void IncrPrefixInvalidationGen() { | 504 void IncrLoadingInvalidationGen() { |
| 509 prefix_invalidation_gen_++; | 505 loading_invalidation_gen_++; |
| 510 if (prefix_invalidation_gen_ == kInvalidGen) prefix_invalidation_gen_++; | 506 if (loading_invalidation_gen_ == kInvalidGen) loading_invalidation_gen_++; |
|
siva
2016/03/28 17:20:14
Why are you first incrementing and then checking,
srdjan
2016/03/28 19:54:54
Since we never reset the count, we may overflow an
| |
| 511 } | 507 } |
| 512 void ResetPrefixInvalidationGen() { prefix_invalidation_gen_ = kInvalidGen; } | 508 void ResetLoadingInvalidationGen() { |
| 513 uint32_t prefix_invalidation_gen() const { return prefix_invalidation_gen_; } | 509 loading_invalidation_gen_ = kInvalidGen; |
| 510 } | |
| 511 uint32_t loading_invalidation_gen() const { | |
| 512 return loading_invalidation_gen_; | |
| 513 } | |
| 514 | 514 |
| 515 // Used by background compiler which field became boxed and must trigger | 515 // Used by background compiler which field became boxed and must trigger |
| 516 // deoptimization in the mutator thread. | 516 // deoptimization in the mutator thread. |
| 517 void AddDeoptimizingBoxedField(const Field& field); | 517 void AddDeoptimizingBoxedField(const Field& field); |
| 518 // Returns Field::null() if none available in the list. | 518 // Returns Field::null() if none available in the list. |
| 519 RawField* GetDeoptimizingBoxedField(); | 519 RawField* GetDeoptimizingBoxedField(); |
| 520 | 520 |
| 521 RawObject* InvokePendingServiceExtensionCalls(); | 521 RawObject* InvokePendingServiceExtensionCalls(); |
| 522 void AppendServiceExtensionCall(const Instance& closure, | 522 void AppendServiceExtensionCall(const Instance& closure, |
| 523 const String& method_name, | 523 const String& method_name, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 kRegisteredNameIndex = 0, | 713 kRegisteredNameIndex = 0, |
| 714 kRegisteredHandlerIndex, | 714 kRegisteredHandlerIndex, |
| 715 kRegisteredEntrySize | 715 kRegisteredEntrySize |
| 716 }; | 716 }; |
| 717 RawGrowableObjectArray* registered_service_extension_handlers_; | 717 RawGrowableObjectArray* registered_service_extension_handlers_; |
| 718 | 718 |
| 719 Metric* metrics_list_head_; | 719 Metric* metrics_list_head_; |
| 720 | 720 |
| 721 bool compilation_allowed_; | 721 bool compilation_allowed_; |
| 722 bool all_classes_finalized_; | 722 bool all_classes_finalized_; |
| 723 bool top_level_parsing_; | |
| 723 | 724 |
| 724 // Isolate list next pointer. | 725 // Isolate list next pointer. |
| 725 Isolate* next_; | 726 Isolate* next_; |
| 726 | 727 |
| 727 // Used to wake the isolate when it is in the pause event loop. | 728 // Used to wake the isolate when it is in the pause event loop. |
| 728 Monitor* pause_loop_monitor_; | 729 Monitor* pause_loop_monitor_; |
| 729 | 730 |
| 730 // Invalidation generations; used to track events occuring in parallel | 731 // Invalidation generations; used to track events occuring in parallel |
| 731 // to background compilation. The counters may overflow, which is OK | 732 // to background compilation. The counters may overflow, which is OK |
| 732 // since we check for equality to detect if an event occured. | 733 // since we check for equality to detect if an event occured. |
| 733 uint32_t cha_invalidation_gen_; | |
| 734 uint32_t field_invalidation_gen_; | 734 uint32_t field_invalidation_gen_; |
| 735 uint32_t prefix_invalidation_gen_; | 735 uint32_t loading_invalidation_gen_; |
| 736 | 736 |
| 737 // Protect access to boxed_field_list_. | 737 // Protect access to boxed_field_list_. |
| 738 Mutex* boxed_field_list_mutex_; | 738 Mutex* boxed_field_list_mutex_; |
| 739 // List of fields that became boxed and that trigger deoptimization. | 739 // List of fields that became boxed and that trigger deoptimization. |
| 740 RawGrowableObjectArray* boxed_field_list_; | 740 RawGrowableObjectArray* boxed_field_list_; |
| 741 | 741 |
| 742 // This guards spawn_count_. An isolate cannot complete shutdown and be | 742 // This guards spawn_count_. An isolate cannot complete shutdown and be |
| 743 // destroyed while there are child isolates in the midst of a spawn. | 743 // destroyed while there are child isolates in the midst of a spawn. |
| 744 Monitor* spawn_count_monitor_; | 744 Monitor* spawn_count_monitor_; |
| 745 intptr_t spawn_count_; | 745 intptr_t spawn_count_; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 intptr_t* spawn_count_; | 903 intptr_t* spawn_count_; |
| 904 | 904 |
| 905 Dart_IsolateFlags isolate_flags_; | 905 Dart_IsolateFlags isolate_flags_; |
| 906 bool paused_; | 906 bool paused_; |
| 907 bool errors_are_fatal_; | 907 bool errors_are_fatal_; |
| 908 }; | 908 }; |
| 909 | 909 |
| 910 } // namespace dart | 910 } // namespace dart |
| 911 | 911 |
| 912 #endif // VM_ISOLATE_H_ | 912 #endif // VM_ISOLATE_H_ |
| OLD | NEW |