Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: runtime/vm/object.cc

Issue 730543002: Remove use of IterableMixinWorkaround from _List, _ImmutableList and _GrowableList. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 // initialize array class first. 1014 // initialize array class first.
1015 cls = Class::New<Array>(); 1015 cls = Class::New<Array>();
1016 object_store->set_array_class(cls); 1016 object_store->set_array_class(cls);
1017 1017
1018 // Array and ImmutableArray are the only VM classes that are parameterized. 1018 // Array and ImmutableArray are the only VM classes that are parameterized.
1019 // Since they are pre-finalized, CalculateFieldOffsets() is not called, so we 1019 // Since they are pre-finalized, CalculateFieldOffsets() is not called, so we
1020 // need to set the offset of their type_arguments_ field, which is explicitly 1020 // need to set the offset of their type_arguments_ field, which is explicitly
1021 // declared in RawArray. 1021 // declared in RawArray.
1022 cls.set_type_arguments_field_offset(Array::type_arguments_offset()); 1022 cls.set_type_arguments_field_offset(Array::type_arguments_offset());
1023 cls.set_num_type_arguments(1); 1023 cls.set_num_type_arguments(1);
1024 cls.set_num_own_type_arguments(1);
1025 1024
1026 // Set up the growable object array class (Has to be done after the array 1025 // Set up the growable object array class (Has to be done after the array
1027 // class is setup as one of its field is an array object). 1026 // class is setup as one of its field is an array object).
1028 cls = Class::New<GrowableObjectArray>(); 1027 cls = Class::New<GrowableObjectArray>();
1029 object_store->set_growable_object_array_class(cls); 1028 object_store->set_growable_object_array_class(cls);
1030 cls.set_type_arguments_field_offset( 1029 cls.set_type_arguments_field_offset(
1031 GrowableObjectArray::type_arguments_offset()); 1030 GrowableObjectArray::type_arguments_offset());
1032 cls.set_num_type_arguments(1); 1031 cls.set_num_type_arguments(1);
1033 cls.set_num_own_type_arguments(1);
1034 1032
1035 // canonical_type_arguments_ are Smi terminated. 1033 // canonical_type_arguments_ are Smi terminated.
1036 // Last element contains the count of used slots. 1034 // Last element contains the count of used slots.
1037 const intptr_t kInitialCanonicalTypeArgumentsSize = 4; 1035 const intptr_t kInitialCanonicalTypeArgumentsSize = 4;
1038 array = Array::New(kInitialCanonicalTypeArgumentsSize + 1); 1036 array = Array::New(kInitialCanonicalTypeArgumentsSize + 1);
1039 array.SetAt(kInitialCanonicalTypeArgumentsSize, 1037 array.SetAt(kInitialCanonicalTypeArgumentsSize,
1040 Smi::Handle(isolate, Smi::New(0))); 1038 Smi::Handle(isolate, Smi::New(0)));
1041 object_store->set_canonical_type_arguments(array); 1039 object_store->set_canonical_type_arguments(array);
1042 1040
1043 // Setup type class early in the process. 1041 // Setup type class early in the process.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 object_store->set_array_type(type); 1096 object_store->set_array_type(type);
1099 1097
1100 cls = object_store->growable_object_array_class(); // Was allocated above. 1098 cls = object_store->growable_object_array_class(); // Was allocated above.
1101 RegisterPrivateClass(cls, Symbols::_GrowableList(), core_lib); 1099 RegisterPrivateClass(cls, Symbols::_GrowableList(), core_lib);
1102 pending_classes.Add(cls); 1100 pending_classes.Add(cls);
1103 1101
1104 cls = Class::New<Array>(kImmutableArrayCid); 1102 cls = Class::New<Array>(kImmutableArrayCid);
1105 object_store->set_immutable_array_class(cls); 1103 object_store->set_immutable_array_class(cls);
1106 cls.set_type_arguments_field_offset(Array::type_arguments_offset()); 1104 cls.set_type_arguments_field_offset(Array::type_arguments_offset());
1107 cls.set_num_type_arguments(1); 1105 cls.set_num_type_arguments(1);
1108 cls.set_num_own_type_arguments(1);
1109 ASSERT(object_store->immutable_array_class() != object_store->array_class()); 1106 ASSERT(object_store->immutable_array_class() != object_store->array_class());
1110 cls.set_is_prefinalized(); 1107 cls.set_is_prefinalized();
1111 RegisterPrivateClass(cls, Symbols::_ImmutableList(), core_lib); 1108 RegisterPrivateClass(cls, Symbols::_ImmutableList(), core_lib);
1112 pending_classes.Add(cls); 1109 pending_classes.Add(cls);
1113 1110
1114 cls = object_store->one_byte_string_class(); // Was allocated above. 1111 cls = object_store->one_byte_string_class(); // Was allocated above.
1115 RegisterPrivateClass(cls, Symbols::OneByteString(), core_lib); 1112 RegisterPrivateClass(cls, Symbols::OneByteString(), core_lib);
1116 pending_classes.Add(cls); 1113 pending_classes.Add(cls);
1117 1114
1118 cls = object_store->two_byte_string_class(); // Was allocated above. 1115 cls = object_store->two_byte_string_class(); // Was allocated above.
(...skipping 19297 matching lines...) Expand 10 before | Expand all | Expand 10 after
20416 return tag_label.ToCString(); 20413 return tag_label.ToCString();
20417 } 20414 }
20418 20415
20419 20416
20420 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20417 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20421 Instance::PrintJSONImpl(stream, ref); 20418 Instance::PrintJSONImpl(stream, ref);
20422 } 20419 }
20423 20420
20424 20421
20425 } // namespace dart 20422 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698