| 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 #include "vm/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 } | 715 } |
| 716 return kError; | 716 return kError; |
| 717 } | 717 } |
| 718 } | 718 } |
| 719 return kOK; | 719 return kOK; |
| 720 } | 720 } |
| 721 | 721 |
| 722 | 722 |
| 723 void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) { | 723 void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) { |
| 724 api_flags->version = DART_FLAGS_CURRENT_VERSION; | 724 api_flags->version = DART_FLAGS_CURRENT_VERSION; |
| 725 api_flags->enable_type_checks = FLAG_enable_type_checks; | 725 #define INIT_FROM_FLAG(name, isolate_flag, flag) api_flags->isolate_flag = flag; |
| 726 api_flags->enable_asserts = FLAG_enable_asserts; | 726 ISOLATE_FLAG_LIST(INIT_FROM_FLAG) |
| 727 api_flags->enable_error_on_bad_type = FLAG_error_on_bad_type; | 727 #undef INIT_FROM_FLAG |
| 728 api_flags->enable_error_on_bad_override = FLAG_error_on_bad_override; | |
| 729 api_flags->use_field_guards = FLAG_use_field_guards; | |
| 730 } | 728 } |
| 731 | 729 |
| 732 | 730 |
| 733 void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const { | 731 void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const { |
| 734 api_flags->version = DART_FLAGS_CURRENT_VERSION; | 732 api_flags->version = DART_FLAGS_CURRENT_VERSION; |
| 735 api_flags->enable_type_checks = type_checks(); | 733 #define INIT_FROM_FIELD(name, isolate_flag, flag) \ |
| 736 api_flags->enable_asserts = asserts(); | 734 api_flags->isolate_flag = name(); |
| 737 api_flags->enable_error_on_bad_type = error_on_bad_type(); | 735 ISOLATE_FLAG_LIST(INIT_FROM_FIELD) |
| 738 api_flags->enable_error_on_bad_override = error_on_bad_override(); | 736 #undef INIT_FROM_FIELD |
| 739 api_flags->use_field_guards = use_field_guards(); | |
| 740 } | 737 } |
| 741 | 738 |
| 742 | 739 |
| 743 #if !defined(PRODUCT) | 740 #if !defined(PRODUCT) |
| 744 void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) { | 741 void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) { |
| 745 type_checks_ = api_flags.enable_type_checks; | 742 #define SET_FROM_FLAG(name, isolate_flag, flag) \ |
| 746 asserts_ = api_flags.enable_asserts; | 743 name##_ = api_flags.isolate_flag; |
| 747 error_on_bad_type_ = api_flags.enable_error_on_bad_type; | 744 ISOLATE_FLAG_LIST(SET_FROM_FLAG) |
| 748 error_on_bad_override_ = api_flags.enable_error_on_bad_override; | 745 #undef SET_FROM_FLAG |
| 749 use_field_guards_ = api_flags.use_field_guards; | |
| 750 // Leave others at defaults. | 746 // Leave others at defaults. |
| 751 } | 747 } |
| 752 #endif // !defined(PRODUCT) | 748 #endif // !defined(PRODUCT) |
| 753 | 749 |
| 754 | 750 |
| 755 #if defined(DEBUG) | 751 #if defined(DEBUG) |
| 756 // static | 752 // static |
| 757 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { | 753 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { |
| 758 ASSERT(isolate == Isolate::Current()); | 754 ASSERT(isolate == Isolate::Current()); |
| 759 } | 755 } |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2953 void IsolateSpawnState::DecrementSpawnCount() { | 2949 void IsolateSpawnState::DecrementSpawnCount() { |
| 2954 ASSERT(spawn_count_monitor_ != NULL); | 2950 ASSERT(spawn_count_monitor_ != NULL); |
| 2955 ASSERT(spawn_count_ != NULL); | 2951 ASSERT(spawn_count_ != NULL); |
| 2956 MonitorLocker ml(spawn_count_monitor_); | 2952 MonitorLocker ml(spawn_count_monitor_); |
| 2957 ASSERT(*spawn_count_ > 0); | 2953 ASSERT(*spawn_count_ > 0); |
| 2958 *spawn_count_ = *spawn_count_ - 1; | 2954 *spawn_count_ = *spawn_count_ - 1; |
| 2959 ml.Notify(); | 2955 ml.Notify(); |
| 2960 } | 2956 } |
| 2961 | 2957 |
| 2962 } // namespace dart | 2958 } // namespace dart |
| OLD | NEW |