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/native_entry.h" | 5 #include "vm/native_entry.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 848 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
849 | 849 |
850 // Allocate field object. | 850 // Allocate field object. |
851 Field& field = Field::ZoneHandle(reader->zone(), NEW_OBJECT(Field)); | 851 Field& field = Field::ZoneHandle(reader->zone(), NEW_OBJECT(Field)); |
852 reader->AddBackRef(object_id, &field, kIsDeserialized); | 852 reader->AddBackRef(object_id, &field, kIsDeserialized); |
853 | 853 |
854 // Set all non object fields. | 854 // Set all non object fields. |
855 if (reader->snapshot_code()) { | 855 if (reader->snapshot_code()) { |
856 field.set_token_pos(TokenPosition::kNoSource); | 856 field.set_token_pos(TokenPosition::kNoSource); |
857 ASSERT(!FLAG_use_field_guards); | 857 ASSERT(!FLAG_use_field_guards); |
858 field.set_guarded_cid(kDynamicCid); | |
859 field.set_is_nullable(true); | |
860 } else { | 858 } else { |
861 field.set_token_pos( | 859 field.set_token_pos( |
862 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); | 860 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); |
863 field.set_guarded_cid(reader->Read<int32_t>()); | 861 field.set_guarded_cid(reader->Read<int32_t>()); |
864 field.set_is_nullable(reader->Read<int32_t>()); | 862 field.set_is_nullable(reader->Read<int32_t>()); |
865 } | 863 } |
866 field.set_kind_bits(reader->Read<uint8_t>()); | 864 field.set_kind_bits(reader->Read<uint8_t>()); |
867 | 865 |
868 // Set all the object fields. | 866 // Set all the object fields. |
869 RawObject** toobj = reader->snapshot_code() | 867 RawObject** toobj = reader->snapshot_code() |
870 ? field.raw()->to_precompiled_snapshot() | 868 ? field.raw()->to_precompiled_snapshot() |
871 : field.raw()->to(); | 869 : field.raw()->to(); |
872 READ_OBJECT_FIELDS(field, | 870 READ_OBJECT_FIELDS(field, |
873 field.raw()->from(), toobj, | 871 field.raw()->from(), toobj, |
874 kAsReference); | 872 kAsReference); |
875 | 873 |
876 if (reader->snapshot_code()) { | 874 if (!FLAG_use_field_guards) { |
877 ASSERT(!FLAG_use_field_guards); | 875 field.set_guarded_cid(kDynamicCid); |
| 876 field.set_is_nullable(true); |
878 field.set_guarded_list_length(Field::kNoFixedLength); | 877 field.set_guarded_list_length(Field::kNoFixedLength); |
879 field.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); | 878 field.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); |
880 } else { | 879 } else { |
881 field.InitializeGuardedListLengthInObjectOffset(); | 880 field.InitializeGuardedListLengthInObjectOffset(); |
882 } | 881 } |
883 | 882 |
884 return field.raw(); | 883 return field.raw(); |
885 } | 884 } |
886 | 885 |
887 | 886 |
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3653 // We do not allow objects with native fields in an isolate message. | 3652 // We do not allow objects with native fields in an isolate message. |
3654 writer->SetWriteException(Exceptions::kArgument, | 3653 writer->SetWriteException(Exceptions::kArgument, |
3655 "Illegal argument in isolate message" | 3654 "Illegal argument in isolate message" |
3656 " : (object is a UserTag)"); | 3655 " : (object is a UserTag)"); |
3657 } else { | 3656 } else { |
3658 UNREACHABLE(); | 3657 UNREACHABLE(); |
3659 } | 3658 } |
3660 } | 3659 } |
3661 | 3660 |
3662 } // namespace dart | 3661 } // namespace dart |
OLD | NEW |