| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 cls = Class::New<Instance>(kVoidCid); | 708 cls = Class::New<Instance>(kVoidCid); |
| 709 cls.set_num_type_arguments(0); | 709 cls.set_num_type_arguments(0); |
| 710 cls.set_num_own_type_arguments(0); | 710 cls.set_num_own_type_arguments(0); |
| 711 cls.set_is_type_finalized(); | 711 cls.set_is_type_finalized(); |
| 712 cls.set_is_finalized(); | 712 cls.set_is_finalized(); |
| 713 void_class_ = cls.raw(); | 713 void_class_ = cls.raw(); |
| 714 | 714 |
| 715 cls = Class::New<Type>(); | 715 cls = Class::New<Type>(); |
| 716 cls.set_is_type_finalized(); | 716 cls.set_is_type_finalized(); |
| 717 cls.set_is_finalized(); | 717 cls.set_is_finalized(); |
| 718 isolate->object_store()->set_type_class(cls); | |
| 719 | 718 |
| 720 cls = dynamic_class_; | 719 cls = dynamic_class_; |
| 721 dynamic_type_ = Type::NewNonParameterizedType(cls); | 720 dynamic_type_ = Type::NewNonParameterizedType(cls); |
| 722 | 721 |
| 723 cls = void_class_; | 722 cls = void_class_; |
| 724 void_type_ = Type::NewNonParameterizedType(cls); | 723 void_type_ = Type::NewNonParameterizedType(cls); |
| 725 | 724 |
| 726 // Allocate and initialize singleton true and false boolean objects. | 725 // Allocate and initialize singleton true and false boolean objects. |
| 727 cls = Class::New<Bool>(); | 726 cls = Class::New<Bool>(); |
| 728 isolate->object_store()->set_bool_class(cls); | 727 isolate->object_store()->set_bool_class(cls); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 | 944 |
| 946 // canonical_type_arguments_ are Smi terminated. | 945 // canonical_type_arguments_ are Smi terminated. |
| 947 // Last element contains the count of used slots. | 946 // Last element contains the count of used slots. |
| 948 const intptr_t kInitialCanonicalTypeArgumentsSize = 4; | 947 const intptr_t kInitialCanonicalTypeArgumentsSize = 4; |
| 949 array = Array::New(kInitialCanonicalTypeArgumentsSize + 1); | 948 array = Array::New(kInitialCanonicalTypeArgumentsSize + 1); |
| 950 array.SetAt(kInitialCanonicalTypeArgumentsSize, | 949 array.SetAt(kInitialCanonicalTypeArgumentsSize, |
| 951 Smi::Handle(isolate, Smi::New(0))); | 950 Smi::Handle(isolate, Smi::New(0))); |
| 952 object_store->set_canonical_type_arguments(array); | 951 object_store->set_canonical_type_arguments(array); |
| 953 | 952 |
| 954 // Setup type class early in the process. | 953 // Setup type class early in the process. |
| 955 cls = Class::New<Type>(); | 954 const Class& type_cls = Class::Handle(isolate, Class::New<Type>()); |
| 956 object_store->set_type_class(cls); | 955 const Class& type_ref_cls = Class::Handle(isolate, Class::New<TypeRef>()); |
| 957 | 956 const Class& type_parameter_cls = Class::Handle(isolate, |
| 958 cls = Class::New<TypeRef>(); | 957 Class::New<TypeParameter>()); |
| 959 object_store->set_type_ref_class(cls); | 958 const Class& bounded_type_cls = Class::Handle(isolate, |
| 960 | 959 Class::New<BoundedType>()); |
| 961 cls = Class::New<TypeParameter>(); | 960 const Class& mixin_app_type_cls = Class::Handle(isolate, |
| 962 object_store->set_type_parameter_class(cls); | 961 Class::New<MixinAppType>()); |
| 963 | 962 const Class& library_prefix_cls = Class::Handle(isolate, |
| 964 cls = Class::New<BoundedType>(); | 963 Class::New<LibraryPrefix>()); |
| 965 object_store->set_bounded_type_class(cls); | |
| 966 | |
| 967 cls = Class::New<MixinAppType>(); | |
| 968 object_store->set_mixin_app_type_class(cls); | |
| 969 | |
| 970 cls = Class::New<LibraryPrefix>(); | |
| 971 object_store->set_library_prefix_class(cls); | |
| 972 | 964 |
| 973 // Pre-allocate the OneByteString class needed by the symbol table. | 965 // Pre-allocate the OneByteString class needed by the symbol table. |
| 974 cls = Class::NewStringClass(kOneByteStringCid); | 966 cls = Class::NewStringClass(kOneByteStringCid); |
| 975 object_store->set_one_byte_string_class(cls); | 967 object_store->set_one_byte_string_class(cls); |
| 976 | 968 |
| 977 // Pre-allocate the TwoByteString class needed by the symbol table. | 969 // Pre-allocate the TwoByteString class needed by the symbol table. |
| 978 cls = Class::NewStringClass(kTwoByteStringCid); | 970 cls = Class::NewStringClass(kTwoByteStringCid); |
| 979 object_store->set_two_byte_string_class(cls); | 971 object_store->set_two_byte_string_class(cls); |
| 980 | 972 |
| 981 // Setup the symbol table for the symbols created in the isolate. | 973 // Setup the symbol table for the symbols created in the isolate. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 pending_classes.Add(cls); | 1058 pending_classes.Add(cls); |
| 1067 | 1059 |
| 1068 cls = Class::New<ReceivePort>(); | 1060 cls = Class::New<ReceivePort>(); |
| 1069 RegisterPrivateClass(cls, Symbols::_RawReceivePortImpl(), isolate_lib); | 1061 RegisterPrivateClass(cls, Symbols::_RawReceivePortImpl(), isolate_lib); |
| 1070 pending_classes.Add(cls); | 1062 pending_classes.Add(cls); |
| 1071 | 1063 |
| 1072 cls = Class::New<SendPort>(); | 1064 cls = Class::New<SendPort>(); |
| 1073 RegisterPrivateClass(cls, Symbols::_SendPortImpl(), isolate_lib); | 1065 RegisterPrivateClass(cls, Symbols::_SendPortImpl(), isolate_lib); |
| 1074 pending_classes.Add(cls); | 1066 pending_classes.Add(cls); |
| 1075 | 1067 |
| 1076 cls = Class::New<Stacktrace>(); | 1068 const Class& stacktrace_cls = Class::Handle(isolate, |
| 1077 object_store->set_stacktrace_class(cls); | 1069 Class::New<Stacktrace>()); |
| 1078 RegisterClass(cls, Symbols::StackTrace(), core_lib); | 1070 RegisterClass(stacktrace_cls, Symbols::StackTrace(), core_lib); |
| 1079 pending_classes.Add(cls); | 1071 pending_classes.Add(stacktrace_cls); |
| 1080 // Super type set below, after Object is allocated. | 1072 // Super type set below, after Object is allocated. |
| 1081 | 1073 |
| 1082 cls = Class::New<JSRegExp>(); | 1074 cls = Class::New<JSRegExp>(); |
| 1083 RegisterPrivateClass(cls, Symbols::JSSyntaxRegExp(), core_lib); | 1075 RegisterPrivateClass(cls, Symbols::JSSyntaxRegExp(), core_lib); |
| 1084 pending_classes.Add(cls); | 1076 pending_classes.Add(cls); |
| 1085 | 1077 |
| 1086 // Initialize the base interfaces used by the core VM classes. | 1078 // Initialize the base interfaces used by the core VM classes. |
| 1087 | 1079 |
| 1088 // Allocate and initialize the pre-allocated classes in the core library. | 1080 // Allocate and initialize the pre-allocated classes in the core library. |
| 1089 // The script and token index of these pre-allocated classes is set up in | 1081 // The script and token index of these pre-allocated classes is set up in |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1106 pending_classes.Add(cls); | 1098 pending_classes.Add(cls); |
| 1107 | 1099 |
| 1108 cls = Class::New<Instance>(kNullCid); | 1100 cls = Class::New<Instance>(kNullCid); |
| 1109 object_store->set_null_class(cls); | 1101 object_store->set_null_class(cls); |
| 1110 cls.set_num_type_arguments(0); | 1102 cls.set_num_type_arguments(0); |
| 1111 cls.set_num_own_type_arguments(0); | 1103 cls.set_num_own_type_arguments(0); |
| 1112 cls.set_is_prefinalized(); | 1104 cls.set_is_prefinalized(); |
| 1113 RegisterClass(cls, Symbols::Null(), core_lib); | 1105 RegisterClass(cls, Symbols::Null(), core_lib); |
| 1114 pending_classes.Add(cls); | 1106 pending_classes.Add(cls); |
| 1115 | 1107 |
| 1116 cls = object_store->library_prefix_class(); | 1108 ASSERT(!library_prefix_cls.IsNull()); |
| 1117 ASSERT(!cls.IsNull()); | 1109 RegisterPrivateClass(library_prefix_cls, Symbols::_LibraryPrefix(), core_lib); |
| 1118 RegisterPrivateClass(cls, Symbols::_LibraryPrefix(), core_lib); | 1110 pending_classes.Add(library_prefix_cls); |
| 1119 pending_classes.Add(cls); | |
| 1120 | 1111 |
| 1121 cls = object_store->type_class(); | 1112 RegisterPrivateClass(type_cls, Symbols::Type(), core_lib); |
| 1122 RegisterPrivateClass(cls, Symbols::Type(), core_lib); | 1113 pending_classes.Add(type_cls); |
| 1123 pending_classes.Add(cls); | |
| 1124 | 1114 |
| 1125 cls = object_store->type_ref_class(); | 1115 RegisterPrivateClass(type_ref_cls, Symbols::TypeRef(), core_lib); |
| 1126 RegisterPrivateClass(cls, Symbols::TypeRef(), core_lib); | 1116 pending_classes.Add(type_ref_cls); |
| 1127 pending_classes.Add(cls); | |
| 1128 | 1117 |
| 1129 cls = object_store->type_parameter_class(); | 1118 RegisterPrivateClass(type_parameter_cls, Symbols::TypeParameter(), core_lib); |
| 1130 RegisterPrivateClass(cls, Symbols::TypeParameter(), core_lib); | 1119 pending_classes.Add(type_parameter_cls); |
| 1131 pending_classes.Add(cls); | |
| 1132 | 1120 |
| 1133 cls = object_store->bounded_type_class(); | 1121 RegisterPrivateClass(bounded_type_cls, Symbols::BoundedType(), core_lib); |
| 1134 RegisterPrivateClass(cls, Symbols::BoundedType(), core_lib); | 1122 pending_classes.Add(bounded_type_cls); |
| 1135 pending_classes.Add(cls); | |
| 1136 | 1123 |
| 1137 cls = object_store->mixin_app_type_class(); | 1124 RegisterPrivateClass(mixin_app_type_cls, Symbols::MixinAppType(), core_lib); |
| 1138 RegisterPrivateClass(cls, Symbols::MixinAppType(), core_lib); | 1125 pending_classes.Add(mixin_app_type_cls); |
| 1139 pending_classes.Add(cls); | |
| 1140 | 1126 |
| 1141 cls = Class::New<Integer>(); | 1127 cls = Class::New<Integer>(); |
| 1142 object_store->set_integer_implementation_class(cls); | 1128 object_store->set_integer_implementation_class(cls); |
| 1143 RegisterPrivateClass(cls, Symbols::IntegerImplementation(), core_lib); | 1129 RegisterPrivateClass(cls, Symbols::IntegerImplementation(), core_lib); |
| 1144 pending_classes.Add(cls); | 1130 pending_classes.Add(cls); |
| 1145 | 1131 |
| 1146 cls = Class::New<Smi>(); | 1132 cls = Class::New<Smi>(); |
| 1147 object_store->set_smi_class(cls); | 1133 object_store->set_smi_class(cls); |
| 1148 RegisterPrivateClass(cls, Symbols::_Smi(), core_lib); | 1134 RegisterPrivateClass(cls, Symbols::_Smi(), core_lib); |
| 1149 pending_classes.Add(cls); | 1135 pending_classes.Add(cls); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 lib = Library::LookupLibrary(Symbols::DartTypedData()); | 1229 lib = Library::LookupLibrary(Symbols::DartTypedData()); |
| 1244 if (lib.IsNull()) { | 1230 if (lib.IsNull()) { |
| 1245 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); | 1231 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); |
| 1246 lib.SetLoadRequested(); | 1232 lib.SetLoadRequested(); |
| 1247 lib.Register(); | 1233 lib.Register(); |
| 1248 isolate->object_store()->set_bootstrap_library(ObjectStore::kTypedData, | 1234 isolate->object_store()->set_bootstrap_library(ObjectStore::kTypedData, |
| 1249 lib); | 1235 lib); |
| 1250 } | 1236 } |
| 1251 ASSERT(!lib.IsNull()); | 1237 ASSERT(!lib.IsNull()); |
| 1252 ASSERT(lib.raw() == Library::TypedDataLibrary()); | 1238 ASSERT(lib.raw() == Library::TypedDataLibrary()); |
| 1253 const intptr_t typed_data_class_array_length = | |
| 1254 RawObject::NumberOfTypedDataClasses(); | |
| 1255 Array& typed_data_classes = | |
| 1256 Array::Handle(Array::New(typed_data_class_array_length)); | |
| 1257 int index = 0; | |
| 1258 #define REGISTER_TYPED_DATA_CLASS(clazz) \ | 1239 #define REGISTER_TYPED_DATA_CLASS(clazz) \ |
| 1259 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ | 1240 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ |
| 1260 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ | |
| 1261 typed_data_classes.SetAt(index, cls); \ | |
| 1262 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ | 1241 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ |
| 1263 | 1242 |
| 1264 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); | 1243 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); |
| 1265 #undef REGISTER_TYPED_DATA_CLASS | 1244 #undef REGISTER_TYPED_DATA_CLASS |
| 1266 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ | 1245 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ |
| 1267 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \ | 1246 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \ |
| 1268 index = kTypedData##clazz##ViewCid - kTypedDataInt8ArrayCid; \ | |
| 1269 typed_data_classes.SetAt(index, cls); \ | |
| 1270 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \ | 1247 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \ |
| 1271 pending_classes.Add(cls); \ | 1248 pending_classes.Add(cls); \ |
| 1272 | 1249 |
| 1273 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); | 1250 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); |
| 1274 cls = Class::NewTypedDataViewClass(kByteDataViewCid); | 1251 cls = Class::NewTypedDataViewClass(kByteDataViewCid); |
| 1275 index = kByteDataViewCid - kTypedDataInt8ArrayCid; | |
| 1276 typed_data_classes.SetAt(index, cls); | |
| 1277 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib); | 1252 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib); |
| 1278 pending_classes.Add(cls); | 1253 pending_classes.Add(cls); |
| 1279 #undef REGISTER_TYPED_DATA_VIEW_CLASS | 1254 #undef REGISTER_TYPED_DATA_VIEW_CLASS |
| 1280 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ | 1255 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ |
| 1281 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ | 1256 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ |
| 1282 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ | |
| 1283 typed_data_classes.SetAt(index, cls); \ | |
| 1284 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ | 1257 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ |
| 1285 | 1258 |
| 1286 cls = Class::New<Instance>(kByteBufferCid); | 1259 cls = Class::New<Instance>(kByteBufferCid); |
| 1287 cls.set_instance_size(0); | 1260 cls.set_instance_size(0); |
| 1288 cls.set_next_field_offset(-kWordSize); | 1261 cls.set_next_field_offset(-kWordSize); |
| 1289 index = kByteBufferCid - kTypedDataInt8ArrayCid; | |
| 1290 typed_data_classes.SetAt(index, cls); | |
| 1291 RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib); | 1262 RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib); |
| 1292 pending_classes.Add(cls); | 1263 pending_classes.Add(cls); |
| 1293 | 1264 |
| 1294 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); | 1265 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); |
| 1295 #undef REGISTER_EXT_TYPED_DATA_CLASS | 1266 #undef REGISTER_EXT_TYPED_DATA_CLASS |
| 1296 // Register Float32x4 and Int32x4 in the object store. | 1267 // Register Float32x4 and Int32x4 in the object store. |
| 1297 cls = Class::New<Float32x4>(); | 1268 cls = Class::New<Float32x4>(); |
| 1298 object_store->set_float32x4_class(cls); | 1269 object_store->set_float32x4_class(cls); |
| 1299 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib); | 1270 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib); |
| 1300 cls = Class::New<Int32x4>(); | 1271 cls = Class::New<Int32x4>(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1324 | 1295 |
| 1325 cls = Class::New<Instance>(kIllegalCid); | 1296 cls = Class::New<Instance>(kIllegalCid); |
| 1326 RegisterClass(cls, Symbols::Float64x2(), lib); | 1297 RegisterClass(cls, Symbols::Float64x2(), lib); |
| 1327 cls.set_num_type_arguments(0); | 1298 cls.set_num_type_arguments(0); |
| 1328 cls.set_num_own_type_arguments(0); | 1299 cls.set_num_own_type_arguments(0); |
| 1329 cls.set_is_prefinalized(); | 1300 cls.set_is_prefinalized(); |
| 1330 pending_classes.Add(cls); | 1301 pending_classes.Add(cls); |
| 1331 type = Type::NewNonParameterizedType(cls); | 1302 type = Type::NewNonParameterizedType(cls); |
| 1332 object_store->set_float64x2_type(type); | 1303 object_store->set_float64x2_type(type); |
| 1333 | 1304 |
| 1334 object_store->set_typed_data_classes(typed_data_classes); | |
| 1335 | |
| 1336 // Set the super type of class Stacktrace to Object type so that the | 1305 // Set the super type of class Stacktrace to Object type so that the |
| 1337 // 'toString' method is implemented. | 1306 // 'toString' method is implemented. |
| 1338 cls = object_store->stacktrace_class(); | |
| 1339 type = object_store->object_type(); | 1307 type = object_store->object_type(); |
| 1340 cls.set_super_type(type); | 1308 stacktrace_cls.set_super_type(type); |
| 1341 | 1309 |
| 1342 // Abstract class that represents the Dart class Function. | 1310 // Abstract class that represents the Dart class Function. |
| 1343 cls = Class::New<Instance>(kIllegalCid); | 1311 cls = Class::New<Instance>(kIllegalCid); |
| 1344 cls.set_num_type_arguments(0); | 1312 cls.set_num_type_arguments(0); |
| 1345 cls.set_num_own_type_arguments(0); | 1313 cls.set_num_own_type_arguments(0); |
| 1346 cls.set_is_prefinalized(); | 1314 cls.set_is_prefinalized(); |
| 1347 RegisterClass(cls, Symbols::Function(), core_lib); | 1315 RegisterClass(cls, Symbols::Function(), core_lib); |
| 1348 pending_classes.Add(cls); | 1316 pending_classes.Add(cls); |
| 1349 type = Type::NewNonParameterizedType(cls); | 1317 type = Type::NewNonParameterizedType(cls); |
| 1350 object_store->set_function_type(type); | 1318 object_store->set_function_type(type); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1423 |
| 1456 void Object::InitFromSnapshot(Isolate* isolate) { | 1424 void Object::InitFromSnapshot(Isolate* isolate) { |
| 1457 TIMERSCOPE(isolate, time_bootstrap); | 1425 TIMERSCOPE(isolate, time_bootstrap); |
| 1458 ObjectStore* object_store = isolate->object_store(); | 1426 ObjectStore* object_store = isolate->object_store(); |
| 1459 | 1427 |
| 1460 Class& cls = Class::Handle(); | 1428 Class& cls = Class::Handle(); |
| 1461 | 1429 |
| 1462 // Set up empty classes in the object store, these will get | 1430 // Set up empty classes in the object store, these will get |
| 1463 // initialized correctly when we read from the snapshot. | 1431 // initialized correctly when we read from the snapshot. |
| 1464 // This is done to allow bootstrapping of reading classes from the snapshot. | 1432 // This is done to allow bootstrapping of reading classes from the snapshot. |
| 1433 // Some classes are not stored in the object store. Yet we still need to |
| 1434 // create their Class object so that they get put into the class_table |
| 1435 // (as a side effect of Class::New()). |
| 1436 |
| 1465 cls = Class::New<Instance>(kInstanceCid); | 1437 cls = Class::New<Instance>(kInstanceCid); |
| 1466 object_store->set_object_class(cls); | 1438 object_store->set_object_class(cls); |
| 1467 | 1439 |
| 1468 cls = Class::New<LibraryPrefix>(); | 1440 cls = Class::New<LibraryPrefix>(); |
| 1469 object_store->set_library_prefix_class(cls); | |
| 1470 | |
| 1471 cls = Class::New<Type>(); | 1441 cls = Class::New<Type>(); |
| 1472 object_store->set_type_class(cls); | |
| 1473 | |
| 1474 cls = Class::New<TypeRef>(); | 1442 cls = Class::New<TypeRef>(); |
| 1475 object_store->set_type_ref_class(cls); | |
| 1476 | |
| 1477 cls = Class::New<TypeParameter>(); | 1443 cls = Class::New<TypeParameter>(); |
| 1478 object_store->set_type_parameter_class(cls); | |
| 1479 | |
| 1480 cls = Class::New<BoundedType>(); | 1444 cls = Class::New<BoundedType>(); |
| 1481 object_store->set_bounded_type_class(cls); | |
| 1482 | |
| 1483 cls = Class::New<MixinAppType>(); | 1445 cls = Class::New<MixinAppType>(); |
| 1484 object_store->set_mixin_app_type_class(cls); | |
| 1485 | 1446 |
| 1486 cls = Class::New<Array>(); | 1447 cls = Class::New<Array>(); |
| 1487 object_store->set_array_class(cls); | 1448 object_store->set_array_class(cls); |
| 1488 | 1449 |
| 1489 cls = Class::New<Array>(kImmutableArrayCid); | 1450 cls = Class::New<Array>(kImmutableArrayCid); |
| 1490 object_store->set_immutable_array_class(cls); | 1451 object_store->set_immutable_array_class(cls); |
| 1491 | 1452 |
| 1492 cls = Class::New<GrowableObjectArray>(); | 1453 cls = Class::New<GrowableObjectArray>(); |
| 1493 object_store->set_growable_object_array_class(cls); | 1454 object_store->set_growable_object_array_class(cls); |
| 1494 | 1455 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 | 1510 |
| 1550 cls = Class::New<Bool>(); | 1511 cls = Class::New<Bool>(); |
| 1551 object_store->set_bool_class(cls); | 1512 object_store->set_bool_class(cls); |
| 1552 | 1513 |
| 1553 cls = Class::New<Instance>(kNullCid); | 1514 cls = Class::New<Instance>(kNullCid); |
| 1554 object_store->set_null_class(cls); | 1515 object_store->set_null_class(cls); |
| 1555 | 1516 |
| 1556 cls = Class::New<Capability>(); | 1517 cls = Class::New<Capability>(); |
| 1557 cls = Class::New<ReceivePort>(); | 1518 cls = Class::New<ReceivePort>(); |
| 1558 cls = Class::New<SendPort>(); | 1519 cls = Class::New<SendPort>(); |
| 1559 | |
| 1560 cls = Class::New<Stacktrace>(); | 1520 cls = Class::New<Stacktrace>(); |
| 1561 object_store->set_stacktrace_class(cls); | |
| 1562 | |
| 1563 cls = Class::New<JSRegExp>(); | 1521 cls = Class::New<JSRegExp>(); |
| 1564 | |
| 1565 // Some classes are not stored in the object store. Yet we still need to | |
| 1566 // create their Class object so that they get put into the class_table | |
| 1567 // (as a side effect of Class::New()). | |
| 1568 cls = Class::New<Number>(); | 1522 cls = Class::New<Number>(); |
| 1569 | 1523 |
| 1570 cls = Class::New<WeakProperty>(); | 1524 cls = Class::New<WeakProperty>(); |
| 1571 object_store->set_weak_property_class(cls); | 1525 object_store->set_weak_property_class(cls); |
| 1572 | 1526 |
| 1573 cls = Class::New<MirrorReference>(); | 1527 cls = Class::New<MirrorReference>(); |
| 1574 | |
| 1575 cls = Class::New<UserTag>(); | 1528 cls = Class::New<UserTag>(); |
| 1576 } | 1529 } |
| 1577 | 1530 |
| 1578 | 1531 |
| 1579 void Object::Print() const { | 1532 void Object::Print() const { |
| 1580 OS::Print("%s\n", ToCString()); | 1533 OS::Print("%s\n", ToCString()); |
| 1581 } | 1534 } |
| 1582 | 1535 |
| 1583 | 1536 |
| 1584 static void AddNameProperties(JSONObject* jsobj, | 1537 static void AddNameProperties(JSONObject* jsobj, |
| (...skipping 8593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10178 | 10131 |
| 10179 | 10132 |
| 10180 void LibraryPrefix::InvalidateDependentCode() const { | 10133 void LibraryPrefix::InvalidateDependentCode() const { |
| 10181 PrefixDependentArray a(*this); | 10134 PrefixDependentArray a(*this); |
| 10182 a.DisableCode(); | 10135 a.DisableCode(); |
| 10183 set_is_loaded(); | 10136 set_is_loaded(); |
| 10184 } | 10137 } |
| 10185 | 10138 |
| 10186 | 10139 |
| 10187 RawLibraryPrefix* LibraryPrefix::New() { | 10140 RawLibraryPrefix* LibraryPrefix::New() { |
| 10188 ASSERT(Isolate::Current()->object_store()->library_prefix_class() != | |
| 10189 Class::null()); | |
| 10190 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, | 10141 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, |
| 10191 LibraryPrefix::InstanceSize(), | 10142 LibraryPrefix::InstanceSize(), |
| 10192 Heap::kOld); | 10143 Heap::kOld); |
| 10193 return reinterpret_cast<RawLibraryPrefix*>(raw); | 10144 return reinterpret_cast<RawLibraryPrefix*>(raw); |
| 10194 } | 10145 } |
| 10195 | 10146 |
| 10196 | 10147 |
| 10197 RawLibraryPrefix* LibraryPrefix::New(const String& name, | 10148 RawLibraryPrefix* LibraryPrefix::New(const String& name, |
| 10198 const Namespace& import, | 10149 const Namespace& import, |
| 10199 bool deferred_load, | 10150 bool deferred_load, |
| (...skipping 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14758 StorePointer(&raw_ptr()->type_class_, value.raw()); | 14709 StorePointer(&raw_ptr()->type_class_, value.raw()); |
| 14759 } | 14710 } |
| 14760 | 14711 |
| 14761 | 14712 |
| 14762 void Type::set_arguments(const TypeArguments& value) const { | 14713 void Type::set_arguments(const TypeArguments& value) const { |
| 14763 StorePointer(&raw_ptr()->arguments_, value.raw()); | 14714 StorePointer(&raw_ptr()->arguments_, value.raw()); |
| 14764 } | 14715 } |
| 14765 | 14716 |
| 14766 | 14717 |
| 14767 RawType* Type::New(Heap::Space space) { | 14718 RawType* Type::New(Heap::Space space) { |
| 14768 ASSERT(Isolate::Current()->object_store()->type_class() != Class::null()); | |
| 14769 RawObject* raw = Object::Allocate(Type::kClassId, | 14719 RawObject* raw = Object::Allocate(Type::kClassId, |
| 14770 Type::InstanceSize(), | 14720 Type::InstanceSize(), |
| 14771 space); | 14721 space); |
| 14772 return reinterpret_cast<RawType*>(raw); | 14722 return reinterpret_cast<RawType*>(raw); |
| 14773 } | 14723 } |
| 14774 | 14724 |
| 14775 | 14725 |
| 14776 RawType* Type::New(const Object& clazz, | 14726 RawType* Type::New(const Object& clazz, |
| 14777 const TypeArguments& arguments, | 14727 const TypeArguments& arguments, |
| 14778 intptr_t token_pos, | 14728 intptr_t token_pos, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14968 } | 14918 } |
| 14969 } | 14919 } |
| 14970 } | 14920 } |
| 14971 (*trail)->Add(*this); | 14921 (*trail)->Add(*this); |
| 14972 (*trail)->Add(buddy); | 14922 (*trail)->Add(buddy); |
| 14973 return false; | 14923 return false; |
| 14974 } | 14924 } |
| 14975 | 14925 |
| 14976 | 14926 |
| 14977 RawTypeRef* TypeRef::New() { | 14927 RawTypeRef* TypeRef::New() { |
| 14978 ASSERT(Isolate::Current()->object_store()->type_ref_class() != Class::null()); | |
| 14979 RawObject* raw = Object::Allocate(TypeRef::kClassId, | 14928 RawObject* raw = Object::Allocate(TypeRef::kClassId, |
| 14980 TypeRef::InstanceSize(), | 14929 TypeRef::InstanceSize(), |
| 14981 Heap::kOld); | 14930 Heap::kOld); |
| 14982 return reinterpret_cast<RawTypeRef*>(raw); | 14931 return reinterpret_cast<RawTypeRef*>(raw); |
| 14983 } | 14932 } |
| 14984 | 14933 |
| 14985 | 14934 |
| 14986 RawTypeRef* TypeRef::New(const AbstractType& type) { | 14935 RawTypeRef* TypeRef::New(const AbstractType& type) { |
| 14987 const TypeRef& result = TypeRef::Handle(TypeRef::New()); | 14936 const TypeRef& result = TypeRef::Handle(TypeRef::New()); |
| 14988 result.set_type(type); | 14937 result.set_type(type); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15166 ASSERT(IsFinalized()); | 15115 ASSERT(IsFinalized()); |
| 15167 uint32_t result = Class::Handle(parameterized_class()).id(); | 15116 uint32_t result = Class::Handle(parameterized_class()).id(); |
| 15168 // No need to include the hash of the bound, since the type parameter is fully | 15117 // No need to include the hash of the bound, since the type parameter is fully |
| 15169 // identified by its class and index. | 15118 // identified by its class and index. |
| 15170 result = CombineHashes(result, index()); | 15119 result = CombineHashes(result, index()); |
| 15171 return FinalizeHash(result); | 15120 return FinalizeHash(result); |
| 15172 } | 15121 } |
| 15173 | 15122 |
| 15174 | 15123 |
| 15175 RawTypeParameter* TypeParameter::New() { | 15124 RawTypeParameter* TypeParameter::New() { |
| 15176 ASSERT(Isolate::Current()->object_store()->type_parameter_class() != | |
| 15177 Class::null()); | |
| 15178 RawObject* raw = Object::Allocate(TypeParameter::kClassId, | 15125 RawObject* raw = Object::Allocate(TypeParameter::kClassId, |
| 15179 TypeParameter::InstanceSize(), | 15126 TypeParameter::InstanceSize(), |
| 15180 Heap::kOld); | 15127 Heap::kOld); |
| 15181 return reinterpret_cast<RawTypeParameter*>(raw); | 15128 return reinterpret_cast<RawTypeParameter*>(raw); |
| 15182 } | 15129 } |
| 15183 | 15130 |
| 15184 | 15131 |
| 15185 RawTypeParameter* TypeParameter::New(const Class& parameterized_class, | 15132 RawTypeParameter* TypeParameter::New(const Class& parameterized_class, |
| 15186 intptr_t index, | 15133 intptr_t index, |
| 15187 const String& name, | 15134 const String& name, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15387 uint32_t result = AbstractType::Handle(type()).Hash(); | 15334 uint32_t result = AbstractType::Handle(type()).Hash(); |
| 15388 // No need to include the hash of the bound, since the bound is defined by the | 15335 // No need to include the hash of the bound, since the bound is defined by the |
| 15389 // type parameter (modulo instantiation state). | 15336 // type parameter (modulo instantiation state). |
| 15390 result = CombineHashes(result, | 15337 result = CombineHashes(result, |
| 15391 TypeParameter::Handle(type_parameter()).Hash()); | 15338 TypeParameter::Handle(type_parameter()).Hash()); |
| 15392 return FinalizeHash(result); | 15339 return FinalizeHash(result); |
| 15393 } | 15340 } |
| 15394 | 15341 |
| 15395 | 15342 |
| 15396 RawBoundedType* BoundedType::New() { | 15343 RawBoundedType* BoundedType::New() { |
| 15397 ASSERT(Isolate::Current()->object_store()->bounded_type_class() != | |
| 15398 Class::null()); | |
| 15399 RawObject* raw = Object::Allocate(BoundedType::kClassId, | 15344 RawObject* raw = Object::Allocate(BoundedType::kClassId, |
| 15400 BoundedType::InstanceSize(), | 15345 BoundedType::InstanceSize(), |
| 15401 Heap::kOld); | 15346 Heap::kOld); |
| 15402 return reinterpret_cast<RawBoundedType*>(raw); | 15347 return reinterpret_cast<RawBoundedType*>(raw); |
| 15403 } | 15348 } |
| 15404 | 15349 |
| 15405 | 15350 |
| 15406 RawBoundedType* BoundedType::New(const AbstractType& type, | 15351 RawBoundedType* BoundedType::New(const AbstractType& type, |
| 15407 const AbstractType& bound, | 15352 const AbstractType& bound, |
| 15408 const TypeParameter& type_parameter) { | 15353 const TypeParameter& type_parameter) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15494 StorePointer(&raw_ptr()->super_type_, value.raw()); | 15439 StorePointer(&raw_ptr()->super_type_, value.raw()); |
| 15495 } | 15440 } |
| 15496 | 15441 |
| 15497 | 15442 |
| 15498 void MixinAppType::set_mixin_types(const Array& value) const { | 15443 void MixinAppType::set_mixin_types(const Array& value) const { |
| 15499 StorePointer(&raw_ptr()->mixin_types_, value.raw()); | 15444 StorePointer(&raw_ptr()->mixin_types_, value.raw()); |
| 15500 } | 15445 } |
| 15501 | 15446 |
| 15502 | 15447 |
| 15503 RawMixinAppType* MixinAppType::New() { | 15448 RawMixinAppType* MixinAppType::New() { |
| 15504 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() != | |
| 15505 Class::null()); | |
| 15506 // MixinAppType objects do not survive finalization, so allocate | 15449 // MixinAppType objects do not survive finalization, so allocate |
| 15507 // on new heap. | 15450 // on new heap. |
| 15508 RawObject* raw = Object::Allocate(MixinAppType::kClassId, | 15451 RawObject* raw = Object::Allocate(MixinAppType::kClassId, |
| 15509 MixinAppType::InstanceSize(), | 15452 MixinAppType::InstanceSize(), |
| 15510 Heap::kNew); | 15453 Heap::kNew); |
| 15511 return reinterpret_cast<RawMixinAppType*>(raw); | 15454 return reinterpret_cast<RawMixinAppType*>(raw); |
| 15512 } | 15455 } |
| 15513 | 15456 |
| 15514 | 15457 |
| 15515 RawMixinAppType* MixinAppType::New(const AbstractType& super_type, | 15458 RawMixinAppType* MixinAppType::New(const AbstractType& super_type, |
| (...skipping 4363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19879 | 19822 |
| 19880 | 19823 |
| 19881 bool Stacktrace::expand_inlined() const { | 19824 bool Stacktrace::expand_inlined() const { |
| 19882 return raw_ptr()->expand_inlined_; | 19825 return raw_ptr()->expand_inlined_; |
| 19883 } | 19826 } |
| 19884 | 19827 |
| 19885 | 19828 |
| 19886 RawStacktrace* Stacktrace::New(const Array& code_array, | 19829 RawStacktrace* Stacktrace::New(const Array& code_array, |
| 19887 const Array& pc_offset_array, | 19830 const Array& pc_offset_array, |
| 19888 Heap::Space space) { | 19831 Heap::Space space) { |
| 19889 ASSERT(Isolate::Current()->object_store()->stacktrace_class() != | |
| 19890 Class::null()); | |
| 19891 Stacktrace& result = Stacktrace::Handle(); | 19832 Stacktrace& result = Stacktrace::Handle(); |
| 19892 { | 19833 { |
| 19893 RawObject* raw = Object::Allocate(Stacktrace::kClassId, | 19834 RawObject* raw = Object::Allocate(Stacktrace::kClassId, |
| 19894 Stacktrace::InstanceSize(), | 19835 Stacktrace::InstanceSize(), |
| 19895 space); | 19836 space); |
| 19896 NoGCScope no_gc; | 19837 NoGCScope no_gc; |
| 19897 result ^= raw; | 19838 result ^= raw; |
| 19898 } | 19839 } |
| 19899 result.set_code_array(code_array); | 19840 result.set_code_array(code_array); |
| 19900 result.set_pc_offset_array(pc_offset_array); | 19841 result.set_pc_offset_array(pc_offset_array); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20420 return tag_label.ToCString(); | 20361 return tag_label.ToCString(); |
| 20421 } | 20362 } |
| 20422 | 20363 |
| 20423 | 20364 |
| 20424 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20365 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20425 Instance::PrintJSONImpl(stream, ref); | 20366 Instance::PrintJSONImpl(stream, ref); |
| 20426 } | 20367 } |
| 20427 | 20368 |
| 20428 | 20369 |
| 20429 } // namespace dart | 20370 } // namespace dart |
| OLD | NEW |