OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/become.h" | 10 #include "vm/become.h" |
(...skipping 7637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7648 result.set_has_initializer(false); | 7648 result.set_has_initializer(false); |
7649 result.set_is_unboxing_candidate(true); | 7649 result.set_is_unboxing_candidate(true); |
7650 result.set_kernel_field(NULL); | 7650 result.set_kernel_field(NULL); |
7651 Isolate* isolate = Isolate::Current(); | 7651 Isolate* isolate = Isolate::Current(); |
7652 | 7652 |
7653 // Use field guards if they are enabled and the isolate has never reloaded. | 7653 // Use field guards if they are enabled and the isolate has never reloaded. |
7654 // TODO(johnmccutchan): The reload case assumes the worst case (everything is | 7654 // TODO(johnmccutchan): The reload case assumes the worst case (everything is |
7655 // dynamic and possibly null). Attempt to relax this later. | 7655 // dynamic and possibly null). Attempt to relax this later. |
7656 const bool use_guarded_cid = | 7656 const bool use_guarded_cid = |
7657 FLAG_precompiled_mode || | 7657 FLAG_precompiled_mode || |
7658 (FLAG_use_field_guards && !isolate->HasAttemptedReload()); | 7658 (isolate->use_field_guards() && !isolate->HasAttemptedReload()); |
7659 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid); | 7659 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid); |
7660 result.set_is_nullable(use_guarded_cid ? false : true); | 7660 result.set_is_nullable(use_guarded_cid ? false : true); |
7661 result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); | 7661 result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); |
7662 // Presently, we only attempt to remember the list length for final fields. | 7662 // Presently, we only attempt to remember the list length for final fields. |
7663 if (is_final && use_guarded_cid) { | 7663 if (is_final && use_guarded_cid) { |
7664 result.set_guarded_list_length(Field::kUnknownFixedLength); | 7664 result.set_guarded_list_length(Field::kUnknownFixedLength); |
7665 } else { | 7665 } else { |
7666 result.set_guarded_list_length(Field::kNoFixedLength); | 7666 result.set_guarded_list_length(Field::kNoFixedLength); |
7667 } | 7667 } |
7668 } | 7668 } |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8159 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); | 8159 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); |
8160 } | 8160 } |
8161 | 8161 |
8162 // Expected class id or nullability of the field changed. | 8162 // Expected class id or nullability of the field changed. |
8163 return true; | 8163 return true; |
8164 } | 8164 } |
8165 | 8165 |
8166 | 8166 |
8167 void Field::RecordStore(const Object& value) const { | 8167 void Field::RecordStore(const Object& value) const { |
8168 ASSERT(IsOriginal()); | 8168 ASSERT(IsOriginal()); |
8169 if (!FLAG_use_field_guards) { | 8169 if (!Isolate::Current()->use_field_guards()) { |
8170 return; | 8170 return; |
8171 } | 8171 } |
8172 | 8172 |
8173 if (FLAG_trace_field_guards) { | 8173 if (FLAG_trace_field_guards) { |
8174 THR_Print("Store %s %s <- %s\n", ToCString(), GuardedPropertiesAsCString(), | 8174 THR_Print("Store %s %s <- %s\n", ToCString(), GuardedPropertiesAsCString(), |
8175 value.ToCString()); | 8175 value.ToCString()); |
8176 } | 8176 } |
8177 | 8177 |
8178 if (UpdateGuardedCidAndLength(value)) { | 8178 if (UpdateGuardedCidAndLength(value)) { |
8179 if (FLAG_trace_field_guards) { | 8179 if (FLAG_trace_field_guards) { |
(...skipping 14747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22927 return UserTag::null(); | 22927 return UserTag::null(); |
22928 } | 22928 } |
22929 | 22929 |
22930 | 22930 |
22931 const char* UserTag::ToCString() const { | 22931 const char* UserTag::ToCString() const { |
22932 const String& tag_label = String::Handle(label()); | 22932 const String& tag_label = String::Handle(label()); |
22933 return tag_label.ToCString(); | 22933 return tag_label.ToCString(); |
22934 } | 22934 } |
22935 | 22935 |
22936 } // namespace dart | 22936 } // namespace dart |
OLD | NEW |