| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 | 853 |
| 854 cls = Class::New<WeakProperty>(); | 854 cls = Class::New<WeakProperty>(); |
| 855 object_store->set_weak_property_class(cls); | 855 object_store->set_weak_property_class(cls); |
| 856 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); | 856 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); |
| 857 | 857 |
| 858 // Setup some default native field classes which can be extended for | 858 // Setup some default native field classes which can be extended for |
| 859 // specifying native fields in dart classes. | 859 // specifying native fields in dart classes. |
| 860 Library::InitNativeWrappersLibrary(isolate); | 860 Library::InitNativeWrappersLibrary(isolate); |
| 861 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); | 861 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); |
| 862 | 862 |
| 863 // Pre-register the scalarlist library so the native class implementations | |
| 864 // can be hooked up before compiling it. | |
| 865 LOAD_LIBRARY(Scalarlist, scalarlist); | |
| 866 ASSERT(!lib.IsNull()); | |
| 867 ASSERT(lib.raw() == Library::ScalarlistLibrary()); | |
| 868 #define REGISTER_SCALARLIST_CLASS(name, object_store_name) \ | |
| 869 cls = Class::New<name>(); \ | |
| 870 object_store->set_##object_store_name##_class(cls); \ | |
| 871 RegisterPrivateClass(cls, Symbols::_##name(), lib); \ | |
| 872 | |
| 873 REGISTER_SCALARLIST_CLASS(Int8Array, int8_array); | |
| 874 REGISTER_SCALARLIST_CLASS(Uint8Array, uint8_array); | |
| 875 REGISTER_SCALARLIST_CLASS(Uint8ClampedArray, uint8_clamped_array); | |
| 876 REGISTER_SCALARLIST_CLASS(Int16Array, int16_array); | |
| 877 REGISTER_SCALARLIST_CLASS(Uint16Array, uint16_array); | |
| 878 REGISTER_SCALARLIST_CLASS(Int32Array, int32_array); | |
| 879 REGISTER_SCALARLIST_CLASS(Uint32Array, uint32_array); | |
| 880 REGISTER_SCALARLIST_CLASS(Int64Array, int64_array); | |
| 881 REGISTER_SCALARLIST_CLASS(Uint64Array, uint64_array); | |
| 882 REGISTER_SCALARLIST_CLASS(Float32Array, float32_array); | |
| 883 REGISTER_SCALARLIST_CLASS(Float64Array, float64_array); | |
| 884 REGISTER_SCALARLIST_CLASS(ExternalInt8Array, external_int8_array); | |
| 885 REGISTER_SCALARLIST_CLASS(ExternalUint8Array, external_uint8_array); | |
| 886 REGISTER_SCALARLIST_CLASS(ExternalUint8ClampedArray, | |
| 887 external_uint8_clamped_array); | |
| 888 REGISTER_SCALARLIST_CLASS(ExternalInt16Array, external_int16_array); | |
| 889 REGISTER_SCALARLIST_CLASS(ExternalUint16Array, external_uint16_array); | |
| 890 REGISTER_SCALARLIST_CLASS(ExternalInt32Array, external_int32_array); | |
| 891 REGISTER_SCALARLIST_CLASS(ExternalUint32Array, external_uint32_array); | |
| 892 REGISTER_SCALARLIST_CLASS(ExternalInt64Array, external_int64_array); | |
| 893 REGISTER_SCALARLIST_CLASS(ExternalUint64Array, external_uint64_array); | |
| 894 REGISTER_SCALARLIST_CLASS(ExternalFloat32Array, external_float32_array); | |
| 895 REGISTER_SCALARLIST_CLASS(ExternalFloat64Array, external_float64_array); | |
| 896 #undef REGISTER_SCALARLIST_CLASS | |
| 897 | |
| 898 | |
| 899 // Pre-register the typeddata library so the native class implementations | 863 // Pre-register the typeddata library so the native class implementations |
| 900 // can be hooked up before compiling it. | 864 // can be hooked up before compiling it. |
| 901 LOAD_LIBRARY(TypedData, typeddata); | 865 LOAD_LIBRARY(TypedData, typeddata); |
| 902 ASSERT(!lib.IsNull()); | 866 ASSERT(!lib.IsNull()); |
| 903 ASSERT(lib.raw() == Library::TypedDataLibrary()); | 867 ASSERT(lib.raw() == Library::TypedDataLibrary()); |
| 904 const intptr_t typeddata_class_array_length = | 868 const intptr_t typeddata_class_array_length = |
| 905 RawObject::NumberOfTypedDataClasses() + 2; // +2 for Float32x4 & Uint32x4 | 869 RawObject::NumberOfTypedDataClasses(); |
| 906 Array& typeddata_classes = | 870 Array& typeddata_classes = |
| 907 Array::Handle(Array::New(typeddata_class_array_length)); | 871 Array::Handle(Array::New(typeddata_class_array_length)); |
| 908 int index = 0; | 872 int index = 0; |
| 909 #define REGISTER_TYPED_DATA_CLASS(clazz) \ | 873 #define REGISTER_TYPED_DATA_CLASS(clazz) \ |
| 910 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ | 874 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ |
| 911 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ | 875 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ |
| 912 typeddata_classes.SetAt(index, cls); \ | 876 typeddata_classes.SetAt(index, cls); \ |
| 913 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ | 877 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ |
| 914 | 878 |
| 915 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); | 879 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 929 pending_classes.Add(cls, Heap::kOld); | 893 pending_classes.Add(cls, Heap::kOld); |
| 930 #undef REGISTER_TYPED_DATA_VIEW_CLASS | 894 #undef REGISTER_TYPED_DATA_VIEW_CLASS |
| 931 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ | 895 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ |
| 932 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ | 896 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ |
| 933 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ | 897 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ |
| 934 typeddata_classes.SetAt(index, cls); \ | 898 typeddata_classes.SetAt(index, cls); \ |
| 935 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ | 899 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ |
| 936 | 900 |
| 937 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); | 901 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); |
| 938 #undef REGISTER_EXT_TYPED_DATA_CLASS | 902 #undef REGISTER_EXT_TYPED_DATA_CLASS |
| 939 // Add Float32x4 and Uint32x4 to dart:typeddata and register them in the | 903 // Register Float32x4 and Uint32x4 in the object store. |
| 940 // object store. | |
| 941 cls = Class::New<Float32x4>(); | 904 cls = Class::New<Float32x4>(); |
| 942 object_store->set_float32x4_class(cls); | 905 object_store->set_float32x4_class(cls); |
| 943 typeddata_classes.SetAt(typeddata_class_array_length-2, cls); | |
| 944 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib); | 906 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib); |
| 945 cls = Class::New<Uint32x4>(); | 907 cls = Class::New<Uint32x4>(); |
| 946 object_store->set_uint32x4_class(cls); | 908 object_store->set_uint32x4_class(cls); |
| 947 typeddata_classes.SetAt(typeddata_class_array_length-1, cls); | |
| 948 RegisterPrivateClass(cls, Symbols::_Uint32x4(), lib); | 909 RegisterPrivateClass(cls, Symbols::_Uint32x4(), lib); |
| 949 | 910 |
| 950 object_store->set_typeddata_classes(typeddata_classes); | 911 object_store->set_typeddata_classes(typeddata_classes); |
| 951 | 912 |
| 952 // Set the super type of class Stacktrace to Object type so that the | 913 // Set the super type of class Stacktrace to Object type so that the |
| 953 // 'toString' method is implemented. | 914 // 'toString' method is implemented. |
| 954 cls = object_store->stacktrace_class(); | 915 cls = object_store->stacktrace_class(); |
| 955 cls.set_super_type(type); | 916 cls.set_super_type(type); |
| 956 | 917 |
| 957 // Note: The abstract class Function is represented by VM class | 918 // Note: The abstract class Function is represented by VM class |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 INIT_LIBRARY(Core, core, true); | 994 INIT_LIBRARY(Core, core, true); |
| 1034 | 995 |
| 1035 INIT_LIBRARY(Async, async, true); | 996 INIT_LIBRARY(Async, async, true); |
| 1036 INIT_LIBRARY(Collection, collection, false); | 997 INIT_LIBRARY(Collection, collection, false); |
| 1037 INIT_LIBRARY(CollectionDev, collection_dev, false); | 998 INIT_LIBRARY(CollectionDev, collection_dev, false); |
| 1038 INIT_LIBRARY(Crypto, crypto, false); | 999 INIT_LIBRARY(Crypto, crypto, false); |
| 1039 INIT_LIBRARY(Isolate, isolate, true); | 1000 INIT_LIBRARY(Isolate, isolate, true); |
| 1040 INIT_LIBRARY(Json, json, true); | 1001 INIT_LIBRARY(Json, json, true); |
| 1041 INIT_LIBRARY(Math, math, true); | 1002 INIT_LIBRARY(Math, math, true); |
| 1042 INIT_LIBRARY(Mirrors, mirrors, true); | 1003 INIT_LIBRARY(Mirrors, mirrors, true); |
| 1043 INIT_LIBRARY(Scalarlist, scalarlist, true); | |
| 1044 INIT_LIBRARY(TypedData, typeddata, true); | 1004 INIT_LIBRARY(TypedData, typeddata, true); |
| 1045 INIT_LIBRARY(Utf, utf, false); | 1005 INIT_LIBRARY(Utf, utf, false); |
| 1046 INIT_LIBRARY(Uri, uri, false); | 1006 INIT_LIBRARY(Uri, uri, false); |
| 1047 | 1007 |
| 1048 Bootstrap::SetupNativeResolver(); | 1008 Bootstrap::SetupNativeResolver(); |
| 1049 | 1009 |
| 1050 // Remove the Object superclass cycle by setting the super type to null (not | 1010 // Remove the Object superclass cycle by setting the super type to null (not |
| 1051 // to the type of null). | 1011 // to the type of null). |
| 1052 cls = object_store->object_class(); | 1012 cls = object_store->object_class(); |
| 1053 cls.set_super_type(Type::Handle()); | 1013 cls.set_super_type(Type::Handle()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 | 1048 |
| 1089 cls = Class::New<Array>(); | 1049 cls = Class::New<Array>(); |
| 1090 object_store->set_array_class(cls); | 1050 object_store->set_array_class(cls); |
| 1091 | 1051 |
| 1092 cls = Class::New<ImmutableArray>(); | 1052 cls = Class::New<ImmutableArray>(); |
| 1093 object_store->set_immutable_array_class(cls); | 1053 object_store->set_immutable_array_class(cls); |
| 1094 | 1054 |
| 1095 cls = Class::New<GrowableObjectArray>(); | 1055 cls = Class::New<GrowableObjectArray>(); |
| 1096 object_store->set_growable_object_array_class(cls); | 1056 object_store->set_growable_object_array_class(cls); |
| 1097 | 1057 |
| 1098 #define REGISTER_SCALARLIST_CLASS(name, object_store_name) \ | 1058 cls = Class::New<Float32x4>(); |
| 1099 cls = Class::New<name>(); \ | 1059 object_store->set_float32x4_class(cls); |
| 1100 object_store->set_##object_store_name##_class(cls); \ | |
| 1101 | 1060 |
| 1102 REGISTER_SCALARLIST_CLASS(Int8Array, int8_array); | 1061 cls = Class::New<Uint32x4>(); |
| 1103 REGISTER_SCALARLIST_CLASS(Uint8Array, uint8_array); | 1062 object_store->set_uint32x4_class(cls); |
| 1104 REGISTER_SCALARLIST_CLASS(Uint8ClampedArray, uint8_clamped_array); | |
| 1105 REGISTER_SCALARLIST_CLASS(Int16Array, int16_array); | |
| 1106 REGISTER_SCALARLIST_CLASS(Uint16Array, uint16_array); | |
| 1107 REGISTER_SCALARLIST_CLASS(Int32Array, int32_array); | |
| 1108 REGISTER_SCALARLIST_CLASS(Uint32Array, uint32_array); | |
| 1109 REGISTER_SCALARLIST_CLASS(Int64Array, int64_array); | |
| 1110 REGISTER_SCALARLIST_CLASS(Uint64Array, uint64_array); | |
| 1111 REGISTER_SCALARLIST_CLASS(Float32Array, float32_array); | |
| 1112 REGISTER_SCALARLIST_CLASS(Float64Array, float64_array); | |
| 1113 REGISTER_SCALARLIST_CLASS(ExternalInt8Array, external_int8_array); | |
| 1114 REGISTER_SCALARLIST_CLASS(ExternalUint8Array, external_uint8_array); | |
| 1115 REGISTER_SCALARLIST_CLASS(ExternalUint8ClampedArray, | |
| 1116 external_uint8_clamped_array); | |
| 1117 REGISTER_SCALARLIST_CLASS(ExternalInt16Array, external_int16_array); | |
| 1118 REGISTER_SCALARLIST_CLASS(ExternalUint16Array, external_uint16_array); | |
| 1119 REGISTER_SCALARLIST_CLASS(ExternalInt32Array, external_int32_array); | |
| 1120 REGISTER_SCALARLIST_CLASS(ExternalUint32Array, external_uint32_array); | |
| 1121 REGISTER_SCALARLIST_CLASS(ExternalInt64Array, external_int64_array); | |
| 1122 REGISTER_SCALARLIST_CLASS(ExternalUint64Array, external_uint64_array); | |
| 1123 REGISTER_SCALARLIST_CLASS(ExternalFloat32Array, external_float32_array); | |
| 1124 REGISTER_SCALARLIST_CLASS(ExternalFloat64Array, external_float64_array); | |
| 1125 #undef REGISTER_SCALARLIST_CLASS | |
| 1126 | 1063 |
| 1127 #define REGISTER_TYPED_DATA_CLASS(clazz) \ | 1064 #define REGISTER_TYPED_DATA_CLASS(clazz) \ |
| 1128 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); | 1065 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); |
| 1129 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); | 1066 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); |
| 1130 #undef REGISTER_TYPED_DATA_CLASS | 1067 #undef REGISTER_TYPED_DATA_CLASS |
| 1131 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ | 1068 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ |
| 1132 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); | 1069 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); |
| 1133 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); | 1070 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); |
| 1134 cls = Class::NewTypedDataViewClass(kByteDataViewCid); | 1071 cls = Class::NewTypedDataViewClass(kByteDataViewCid); |
| 1135 #undef REGISTER_TYPED_DATA_VIEW_CLASS | 1072 #undef REGISTER_TYPED_DATA_VIEW_CLASS |
| 1136 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ | 1073 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ |
| 1137 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); | 1074 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); |
| 1138 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); | 1075 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); |
| 1139 #undef REGISTER_EXT_TYPED_DATA_CLASS | 1076 #undef REGISTER_EXT_TYPED_DATA_CLASS |
| 1140 // Add Float32x4 and Uint32x4 to the object store. | |
| 1141 cls = Class::New<Float32x4>(); | |
| 1142 object_store->set_float32x4_class(cls); | |
| 1143 cls = Class::New<Uint32x4>(); | |
| 1144 object_store->set_uint32x4_class(cls); | |
| 1145 | 1077 |
| 1146 cls = Class::New<Integer>(); | 1078 cls = Class::New<Integer>(); |
| 1147 object_store->set_integer_implementation_class(cls); | 1079 object_store->set_integer_implementation_class(cls); |
| 1148 | 1080 |
| 1149 cls = Class::New<Smi>(); | 1081 cls = Class::New<Smi>(); |
| 1150 object_store->set_smi_class(cls); | 1082 object_store->set_smi_class(cls); |
| 1151 | 1083 |
| 1152 cls = Class::New<Mint>(); | 1084 cls = Class::New<Mint>(); |
| 1153 object_store->set_mint_class(cls); | 1085 object_store->set_mint_class(cls); |
| 1154 | 1086 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 case kExternalTwoByteStringCid: | 1268 case kExternalTwoByteStringCid: |
| 1337 return Symbols::New("String"); | 1269 return Symbols::New("String"); |
| 1338 case kArrayCid: | 1270 case kArrayCid: |
| 1339 case kImmutableArrayCid: | 1271 case kImmutableArrayCid: |
| 1340 case kGrowableObjectArrayCid: | 1272 case kGrowableObjectArrayCid: |
| 1341 return Symbols::List().raw(); | 1273 return Symbols::List().raw(); |
| 1342 case kFloat32x4Cid: | 1274 case kFloat32x4Cid: |
| 1343 return Symbols::Float32x4().raw(); | 1275 return Symbols::Float32x4().raw(); |
| 1344 case kUint32x4Cid: | 1276 case kUint32x4Cid: |
| 1345 return Symbols::Uint32x4().raw(); | 1277 return Symbols::Uint32x4().raw(); |
| 1346 case kInt8ArrayCid: | 1278 case kTypedDataInt8ArrayCid: |
| 1347 case kExternalInt8ArrayCid: | 1279 case kExternalTypedDataInt8ArrayCid: |
| 1348 return Symbols::Int8List().raw(); | 1280 return Symbols::Int8List().raw(); |
| 1349 case kUint8ArrayCid: | 1281 case kTypedDataUint8ArrayCid: |
| 1350 case kExternalUint8ArrayCid: | 1282 case kExternalTypedDataUint8ArrayCid: |
| 1351 return Symbols::Uint8List().raw(); | 1283 return Symbols::Uint8List().raw(); |
| 1352 case kUint8ClampedArrayCid: | 1284 case kTypedDataUint8ClampedArrayCid: |
| 1353 case kExternalUint8ClampedArrayCid: | 1285 case kExternalTypedDataUint8ClampedArrayCid: |
| 1354 return Symbols::Uint8ClampedList().raw(); | 1286 return Symbols::Uint8ClampedList().raw(); |
| 1355 case kInt16ArrayCid: | 1287 case kTypedDataInt16ArrayCid: |
| 1356 case kExternalInt16ArrayCid: | 1288 case kExternalTypedDataInt16ArrayCid: |
| 1357 return Symbols::Int16List().raw(); | 1289 return Symbols::Int16List().raw(); |
| 1358 case kUint16ArrayCid: | 1290 case kTypedDataUint16ArrayCid: |
| 1359 case kExternalUint16ArrayCid: | 1291 case kExternalTypedDataUint16ArrayCid: |
| 1360 return Symbols::Uint16List().raw(); | 1292 return Symbols::Uint16List().raw(); |
| 1361 case kInt32ArrayCid: | 1293 case kTypedDataInt32ArrayCid: |
| 1362 case kExternalInt32ArrayCid: | 1294 case kExternalTypedDataInt32ArrayCid: |
| 1363 return Symbols::Int32List().raw(); | 1295 return Symbols::Int32List().raw(); |
| 1364 case kUint32ArrayCid: | 1296 case kTypedDataUint32ArrayCid: |
| 1365 case kExternalUint32ArrayCid: | 1297 case kExternalTypedDataUint32ArrayCid: |
| 1366 return Symbols::Uint32List().raw(); | 1298 return Symbols::Uint32List().raw(); |
| 1367 case kInt64ArrayCid: | 1299 case kTypedDataInt64ArrayCid: |
| 1368 case kExternalInt64ArrayCid: | 1300 case kExternalTypedDataInt64ArrayCid: |
| 1369 return Symbols::Int64List().raw(); | 1301 return Symbols::Int64List().raw(); |
| 1370 case kUint64ArrayCid: | 1302 case kTypedDataUint64ArrayCid: |
| 1371 case kExternalUint64ArrayCid: | 1303 case kExternalTypedDataUint64ArrayCid: |
| 1372 return Symbols::Uint64List().raw(); | 1304 return Symbols::Uint64List().raw(); |
| 1373 case kFloat32ArrayCid: | 1305 case kTypedDataFloat32x4ArrayCid: |
| 1374 case kExternalFloat32ArrayCid: | 1306 case kExternalTypedDataFloat32x4ArrayCid: |
| 1307 return Symbols::Float32x4List().raw(); |
| 1308 case kTypedDataFloat32ArrayCid: |
| 1309 case kExternalTypedDataFloat32ArrayCid: |
| 1375 return Symbols::Float32List().raw(); | 1310 return Symbols::Float32List().raw(); |
| 1376 case kFloat64ArrayCid: | 1311 case kTypedDataFloat64ArrayCid: |
| 1377 case kExternalFloat64ArrayCid: | 1312 case kExternalTypedDataFloat64ArrayCid: |
| 1378 return Symbols::Float64List().raw(); | 1313 return Symbols::Float64List().raw(); |
| 1379 default: | 1314 default: |
| 1380 if (!IsSignatureClass()) { | 1315 if (!IsSignatureClass()) { |
| 1381 const String& name = String::Handle(Name()); | 1316 const String& name = String::Handle(Name()); |
| 1382 return IdentifierPrettyName(name); | 1317 return IdentifierPrettyName(name); |
| 1383 } else { | 1318 } else { |
| 1384 return Name(); | 1319 return Name(); |
| 1385 } | 1320 } |
| 1386 } | 1321 } |
| 1387 UNREACHABLE(); | 1322 UNREACHABLE(); |
| (...skipping 5230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6618 RawLibrary* Library::MirrorsLibrary() { | 6553 RawLibrary* Library::MirrorsLibrary() { |
| 6619 return Isolate::Current()->object_store()->mirrors_library(); | 6554 return Isolate::Current()->object_store()->mirrors_library(); |
| 6620 } | 6555 } |
| 6621 | 6556 |
| 6622 | 6557 |
| 6623 RawLibrary* Library::NativeWrappersLibrary() { | 6558 RawLibrary* Library::NativeWrappersLibrary() { |
| 6624 return Isolate::Current()->object_store()->native_wrappers_library(); | 6559 return Isolate::Current()->object_store()->native_wrappers_library(); |
| 6625 } | 6560 } |
| 6626 | 6561 |
| 6627 | 6562 |
| 6628 RawLibrary* Library::ScalarlistLibrary() { | |
| 6629 return Isolate::Current()->object_store()->scalarlist_library(); | |
| 6630 } | |
| 6631 | |
| 6632 | |
| 6633 RawLibrary* Library::TypedDataLibrary() { | 6563 RawLibrary* Library::TypedDataLibrary() { |
| 6634 return Isolate::Current()->object_store()->typeddata_library(); | 6564 return Isolate::Current()->object_store()->typeddata_library(); |
| 6635 } | 6565 } |
| 6636 | 6566 |
| 6637 | 6567 |
| 6638 RawLibrary* Library::UriLibrary() { | 6568 RawLibrary* Library::UriLibrary() { |
| 6639 return Isolate::Current()->object_store()->uri_library(); | 6569 return Isolate::Current()->object_store()->uri_library(); |
| 6640 } | 6570 } |
| 6641 | 6571 |
| 6642 | 6572 |
| (...skipping 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8977 } | 8907 } |
| 8978 | 8908 |
| 8979 | 8909 |
| 8980 void Instance::SetNativeField(int index, intptr_t value) const { | 8910 void Instance::SetNativeField(int index, intptr_t value) const { |
| 8981 ASSERT(IsValidNativeIndex(index)); | 8911 ASSERT(IsValidNativeIndex(index)); |
| 8982 Object& native_fields = Object::Handle(*NativeFieldsAddr()); | 8912 Object& native_fields = Object::Handle(*NativeFieldsAddr()); |
| 8983 if (native_fields.IsNull()) { | 8913 if (native_fields.IsNull()) { |
| 8984 // Allocate backing storage for the native fields. | 8914 // Allocate backing storage for the native fields. |
| 8985 const Class& cls = Class::Handle(clazz()); | 8915 const Class& cls = Class::Handle(clazz()); |
| 8986 int num_native_fields = cls.num_native_fields(); | 8916 int num_native_fields = cls.num_native_fields(); |
| 8987 native_fields = IntPtrArray::New(num_native_fields); | 8917 native_fields = TypedData::New(kIntPtrCid, num_native_fields); |
| 8988 StorePointer(NativeFieldsAddr(), native_fields.raw()); | 8918 StorePointer(NativeFieldsAddr(), native_fields.raw()); |
| 8989 } | 8919 } |
| 8990 IntPtrArray::Cast(native_fields).SetAt(index, value); | 8920 intptr_t byte_offset = index * sizeof(intptr_t); |
| 8921 TypedData::Cast(native_fields).SetIntPtr(byte_offset, value); |
| 8991 } | 8922 } |
| 8992 | 8923 |
| 8993 | 8924 |
| 8994 bool Instance::IsClosure() const { | 8925 bool Instance::IsClosure() const { |
| 8995 const Class& cls = Class::Handle(clazz()); | 8926 const Class& cls = Class::Handle(clazz()); |
| 8996 return cls.IsSignatureClass(); | 8927 return cls.IsSignatureClass(); |
| 8997 } | 8928 } |
| 8998 | 8929 |
| 8999 | 8930 |
| 9000 bool Instance::IsCallable(Function* function, Context* context) const { | 8931 bool Instance::IsCallable(Function* function, Context* context) const { |
| (...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12725 } | 12656 } |
| 12726 return result.raw(); | 12657 return result.raw(); |
| 12727 } | 12658 } |
| 12728 | 12659 |
| 12729 | 12660 |
| 12730 const char* ExternalTypedData::ToCString() const { | 12661 const char* ExternalTypedData::ToCString() const { |
| 12731 return "ExternalTypedData"; | 12662 return "ExternalTypedData"; |
| 12732 } | 12663 } |
| 12733 | 12664 |
| 12734 | 12665 |
| 12735 void ByteArray::Copy(void* dst, | |
| 12736 const ByteArray& src, | |
| 12737 intptr_t src_offset, | |
| 12738 intptr_t length) { | |
| 12739 ASSERT(Utils::RangeCheck(src_offset, length, src.ByteLength())); | |
| 12740 { | |
| 12741 NoGCScope no_gc; | |
| 12742 if (length > 0) { | |
| 12743 memmove(dst, src.ByteAddr(src_offset), length); | |
| 12744 } | |
| 12745 } | |
| 12746 } | |
| 12747 | |
| 12748 | |
| 12749 void ByteArray::Copy(const ByteArray& dst, | |
| 12750 intptr_t dst_offset, | |
| 12751 const void* src, | |
| 12752 intptr_t length) { | |
| 12753 ASSERT(Utils::RangeCheck(dst_offset, length, dst.ByteLength())); | |
| 12754 { | |
| 12755 NoGCScope no_gc; | |
| 12756 if (length > 0) { | |
| 12757 memmove(dst.ByteAddr(dst_offset), src, length); | |
| 12758 } | |
| 12759 } | |
| 12760 } | |
| 12761 | |
| 12762 | |
| 12763 void ByteArray::Copy(const ByteArray& dst, | |
| 12764 intptr_t dst_offset, | |
| 12765 const ByteArray& src, | |
| 12766 intptr_t src_offset, | |
| 12767 intptr_t length) { | |
| 12768 ASSERT(Utils::RangeCheck(src_offset, length, src.ByteLength())); | |
| 12769 ASSERT(Utils::RangeCheck(dst_offset, length, dst.ByteLength())); | |
| 12770 { | |
| 12771 NoGCScope no_gc; | |
| 12772 if (length > 0) { | |
| 12773 memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length); | |
| 12774 } | |
| 12775 } | |
| 12776 } | |
| 12777 | |
| 12778 | |
| 12779 template<typename HandleT, typename RawT, typename ElementT> | |
| 12780 RawT* ByteArray::NewExternalImpl(intptr_t class_id, | |
| 12781 ElementT* data, | |
| 12782 intptr_t len, | |
| 12783 Heap::Space space) { | |
| 12784 if (len < 0 || len > HandleT::kMaxElements) { | |
| 12785 // This should be caught before we reach here. | |
| 12786 FATAL1("Fatal error in ByteArray::NewExternalImpl: invalid len %"Pd"\n", | |
| 12787 len); | |
| 12788 } | |
| 12789 HandleT& result = HandleT::Handle(); | |
| 12790 { | |
| 12791 RawObject* raw = Object::Allocate(class_id, HandleT::InstanceSize(), space); | |
| 12792 NoGCScope no_gc; | |
| 12793 result ^= raw; | |
| 12794 result.SetLength(len); | |
| 12795 result.SetData(data); | |
| 12796 } | |
| 12797 return result.raw(); | |
| 12798 } | |
| 12799 | |
| 12800 | |
| 12801 intptr_t ByteArray::ByteLength() const { | |
| 12802 // ByteArray is an abstract class. | |
| 12803 UNREACHABLE(); | |
| 12804 return 0; | |
| 12805 } | |
| 12806 | |
| 12807 | |
| 12808 FinalizablePersistentHandle* ByteArray::AddFinalizer( | |
| 12809 void* peer, | |
| 12810 Dart_WeakPersistentHandleFinalizer callback) const { | |
| 12811 SetPeer(peer); | |
| 12812 return dart::AddFinalizer(*this, peer, callback); | |
| 12813 } | |
| 12814 | |
| 12815 | |
| 12816 uint8_t* ByteArray::ByteAddr(intptr_t byte_offset) const { | |
| 12817 // ByteArray is an abstract class. | |
| 12818 UNREACHABLE(); | |
| 12819 return NULL; | |
| 12820 } | |
| 12821 | |
| 12822 | |
| 12823 const char* ByteArray::ToCString() const { | |
| 12824 // ByteArray is an abstract class. | |
| 12825 UNREACHABLE(); | |
| 12826 return "ByteArray"; | |
| 12827 } | |
| 12828 | |
| 12829 | |
| 12830 template<typename HandleT, typename RawT> | |
| 12831 RawT* ByteArray::NewImpl(intptr_t class_id, intptr_t len, Heap::Space space) { | |
| 12832 if (len < 0 || len > HandleT::kMaxElements) { | |
| 12833 // This should be caught before we reach here. | |
| 12834 FATAL1("Fatal error in ByteArray::NewImpl: invalid len %"Pd"\n", len); | |
| 12835 } | |
| 12836 HandleT& result = HandleT::Handle(); | |
| 12837 { | |
| 12838 RawObject* raw = Object::Allocate(class_id, | |
| 12839 HandleT::InstanceSize(len), | |
| 12840 space); | |
| 12841 NoGCScope no_gc; | |
| 12842 result ^= raw; | |
| 12843 result.SetLength(len); | |
| 12844 if (len > 0) { | |
| 12845 memset(result.ByteAddr(0), 0, result.ByteLength()); | |
| 12846 } | |
| 12847 } | |
| 12848 return result.raw(); | |
| 12849 } | |
| 12850 | |
| 12851 | |
| 12852 template<typename HandleT, typename RawT, typename ElementT> | |
| 12853 RawT* ByteArray::NewImpl(intptr_t class_id, | |
| 12854 const ElementT* data, | |
| 12855 intptr_t len, | |
| 12856 Heap::Space space) { | |
| 12857 if (len < 0 || len > HandleT::kMaxElements) { | |
| 12858 // This should be caught before we reach here. | |
| 12859 FATAL1("Fatal error in ByteArray::NewImpl: invalid len %"Pd"\n", len); | |
| 12860 } | |
| 12861 HandleT& result = HandleT::Handle(); | |
| 12862 { | |
| 12863 RawObject* raw = Object::Allocate(class_id, | |
| 12864 HandleT::InstanceSize(len), | |
| 12865 space); | |
| 12866 NoGCScope no_gc; | |
| 12867 result ^= raw; | |
| 12868 result.SetLength(len); | |
| 12869 if (len > 0) { | |
| 12870 memmove(result.ByteAddr(0), data, result.ByteLength()); | |
| 12871 } | |
| 12872 } | |
| 12873 return result.raw(); | |
| 12874 } | |
| 12875 | |
| 12876 | |
| 12877 RawInt8Array* Int8Array::New(intptr_t len, Heap::Space space) { | |
| 12878 ASSERT(Isolate::Current()->object_store()->int8_array_class() != | |
| 12879 Class::null()); | |
| 12880 return NewImpl<Int8Array, RawInt8Array>(kClassId, len, space); | |
| 12881 } | |
| 12882 | |
| 12883 | |
| 12884 RawInt8Array* Int8Array::New(const int8_t* data, | |
| 12885 intptr_t len, | |
| 12886 Heap::Space space) { | |
| 12887 ASSERT(Isolate::Current()->object_store()->int8_array_class() != | |
| 12888 Class::null()); | |
| 12889 return NewImpl<Int8Array, RawInt8Array>(kClassId, data, len, space); | |
| 12890 } | |
| 12891 | |
| 12892 | |
| 12893 const char* Int8Array::ToCString() const { | |
| 12894 return "_Int8Array"; | |
| 12895 } | |
| 12896 | |
| 12897 | |
| 12898 RawUint8Array* Uint8Array::New(intptr_t len, Heap::Space space) { | |
| 12899 ASSERT(Isolate::Current()->object_store()->uint8_array_class() != | |
| 12900 Class::null()); | |
| 12901 return NewImpl<Uint8Array, RawUint8Array>(kClassId, len, space); | |
| 12902 } | |
| 12903 | |
| 12904 | |
| 12905 RawUint8Array* Uint8Array::New(const uint8_t* data, | |
| 12906 intptr_t len, | |
| 12907 Heap::Space space) { | |
| 12908 ASSERT(Isolate::Current()->object_store()->uint8_array_class() != | |
| 12909 Class::null()); | |
| 12910 return NewImpl<Uint8Array, RawUint8Array>(kClassId, data, len, space); | |
| 12911 } | |
| 12912 | |
| 12913 | |
| 12914 const char* Uint8Array::ToCString() const { | |
| 12915 return "_Uint8Array"; | |
| 12916 } | |
| 12917 | |
| 12918 | |
| 12919 RawUint8ClampedArray* Uint8ClampedArray::New(intptr_t len, Heap::Space space) { | |
| 12920 ASSERT(Isolate::Current()->object_store()->uint8_clamped_array_class() != | |
| 12921 Class::null()); | |
| 12922 return NewImpl<Uint8ClampedArray, RawUint8ClampedArray>(kClassId, len, space); | |
| 12923 } | |
| 12924 | |
| 12925 | |
| 12926 RawUint8ClampedArray* Uint8ClampedArray::New(const uint8_t* data, | |
| 12927 intptr_t len, | |
| 12928 Heap::Space space) { | |
| 12929 ASSERT(Isolate::Current()->object_store()->uint8_clamped_array_class() != | |
| 12930 Class::null()); | |
| 12931 return NewImpl<Uint8ClampedArray, | |
| 12932 RawUint8ClampedArray>(kClassId, data, len, space); | |
| 12933 } | |
| 12934 | |
| 12935 | |
| 12936 const char* Uint8ClampedArray::ToCString() const { | |
| 12937 return "_Uint8ClampedArray"; | |
| 12938 } | |
| 12939 | |
| 12940 | |
| 12941 RawInt16Array* Int16Array::New(intptr_t len, Heap::Space space) { | |
| 12942 ASSERT(Isolate::Current()->object_store()->int16_array_class() != | |
| 12943 Class::null()); | |
| 12944 return NewImpl<Int16Array, RawInt16Array>(kClassId, len, space); | |
| 12945 } | |
| 12946 | |
| 12947 | |
| 12948 RawInt16Array* Int16Array::New(const int16_t* data, | |
| 12949 intptr_t len, | |
| 12950 Heap::Space space) { | |
| 12951 ASSERT(Isolate::Current()->object_store()->int16_array_class() != | |
| 12952 Class::null()); | |
| 12953 return NewImpl<Int16Array, RawInt16Array>(kClassId, data, len, space); | |
| 12954 } | |
| 12955 | |
| 12956 | |
| 12957 const char* Int16Array::ToCString() const { | |
| 12958 return "_Int16Array"; | |
| 12959 } | |
| 12960 | |
| 12961 | |
| 12962 RawUint16Array* Uint16Array::New(intptr_t len, Heap::Space space) { | |
| 12963 ASSERT(Isolate::Current()->object_store()->uint16_array_class() != | |
| 12964 Class::null()); | |
| 12965 return NewImpl<Uint16Array, RawUint16Array>(kClassId, len, space); | |
| 12966 } | |
| 12967 | |
| 12968 | |
| 12969 RawUint16Array* Uint16Array::New(const uint16_t* data, | |
| 12970 intptr_t len, | |
| 12971 Heap::Space space) { | |
| 12972 ASSERT(Isolate::Current()->object_store()->uint16_array_class() != | |
| 12973 Class::null()); | |
| 12974 return NewImpl<Uint16Array, RawUint16Array>(kClassId, data, len, space); | |
| 12975 } | |
| 12976 | |
| 12977 | |
| 12978 const char* Uint16Array::ToCString() const { | |
| 12979 return "_Uint16Array"; | |
| 12980 } | |
| 12981 | |
| 12982 | |
| 12983 RawInt32Array* Int32Array::New(intptr_t len, Heap::Space space) { | |
| 12984 ASSERT(Isolate::Current()->object_store()->int32_array_class() != | |
| 12985 Class::null()); | |
| 12986 return NewImpl<Int32Array, RawInt32Array>(kClassId, len, space); | |
| 12987 } | |
| 12988 | |
| 12989 | |
| 12990 RawInt32Array* Int32Array::New(const int32_t* data, | |
| 12991 intptr_t len, | |
| 12992 Heap::Space space) { | |
| 12993 ASSERT(Isolate::Current()->object_store()->int32_array_class() != | |
| 12994 Class::null()); | |
| 12995 return NewImpl<Int32Array, RawInt32Array>(kClassId, data, len, space); | |
| 12996 } | |
| 12997 | |
| 12998 | |
| 12999 const char* Int32Array::ToCString() const { | |
| 13000 return "_Int32Array"; | |
| 13001 } | |
| 13002 | |
| 13003 | |
| 13004 RawUint32Array* Uint32Array::New(intptr_t len, Heap::Space space) { | |
| 13005 ASSERT(Isolate::Current()->object_store()->uint32_array_class() != | |
| 13006 Class::null()); | |
| 13007 return NewImpl<Uint32Array, RawUint32Array>(kClassId, len, space); | |
| 13008 } | |
| 13009 | |
| 13010 | |
| 13011 RawUint32Array* Uint32Array::New(const uint32_t* data, | |
| 13012 intptr_t len, | |
| 13013 Heap::Space space) { | |
| 13014 ASSERT(Isolate::Current()->object_store()->uint32_array_class() != | |
| 13015 Class::null()); | |
| 13016 return NewImpl<Uint32Array, RawUint32Array>(kClassId, data, len, space); | |
| 13017 } | |
| 13018 | |
| 13019 | |
| 13020 const char* Uint32Array::ToCString() const { | |
| 13021 return "_Uint32Array"; | |
| 13022 } | |
| 13023 | |
| 13024 | |
| 13025 RawInt64Array* Int64Array::New(intptr_t len, Heap::Space space) { | |
| 13026 ASSERT(Isolate::Current()->object_store()->int64_array_class() != | |
| 13027 Class::null()); | |
| 13028 return NewImpl<Int64Array, RawInt64Array>(kClassId, len, space); | |
| 13029 } | |
| 13030 | |
| 13031 | |
| 13032 RawInt64Array* Int64Array::New(const int64_t* data, | |
| 13033 intptr_t len, | |
| 13034 Heap::Space space) { | |
| 13035 ASSERT(Isolate::Current()->object_store()->int64_array_class() != | |
| 13036 Class::null()); | |
| 13037 return NewImpl<Int64Array, RawInt64Array>(kClassId, data, len, space); | |
| 13038 } | |
| 13039 | |
| 13040 | |
| 13041 const char* Int64Array::ToCString() const { | |
| 13042 return "_Int64Array"; | |
| 13043 } | |
| 13044 | |
| 13045 | |
| 13046 RawUint64Array* Uint64Array::New(intptr_t len, Heap::Space space) { | |
| 13047 ASSERT(Isolate::Current()->object_store()->uint64_array_class() != | |
| 13048 Class::null()); | |
| 13049 return NewImpl<Uint64Array, RawUint64Array>(kClassId, len, space); | |
| 13050 } | |
| 13051 | |
| 13052 | |
| 13053 RawUint64Array* Uint64Array::New(const uint64_t* data, | |
| 13054 intptr_t len, | |
| 13055 Heap::Space space) { | |
| 13056 ASSERT(Isolate::Current()->object_store()->uint64_array_class() != | |
| 13057 Class::null()); | |
| 13058 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); | |
| 13059 } | |
| 13060 | |
| 13061 | |
| 13062 const char* Uint64Array::ToCString() const { | |
| 13063 return "_Uint64Array"; | |
| 13064 } | |
| 13065 | |
| 13066 | |
| 13067 RawFloat32Array* Float32Array::New(intptr_t len, Heap::Space space) { | |
| 13068 ASSERT(Isolate::Current()->object_store()->float32_array_class() != | |
| 13069 Class::null()); | |
| 13070 return NewImpl<Float32Array, RawFloat32Array>(kClassId, len, space); | |
| 13071 } | |
| 13072 | |
| 13073 | |
| 13074 RawFloat32Array* Float32Array::New(const float* data, | |
| 13075 intptr_t len, | |
| 13076 Heap::Space space) { | |
| 13077 ASSERT(Isolate::Current()->object_store()->float32_array_class() != | |
| 13078 Class::null()); | |
| 13079 return NewImpl<Float32Array, RawFloat32Array>(kClassId, data, len, space); | |
| 13080 } | |
| 13081 | |
| 13082 | |
| 13083 const char* Float32Array::ToCString() const { | |
| 13084 return "_Float32Array"; | |
| 13085 } | |
| 13086 | |
| 13087 | |
| 13088 RawFloat64Array* Float64Array::New(intptr_t len, Heap::Space space) { | |
| 13089 ASSERT(Isolate::Current()->object_store()->float64_array_class() != | |
| 13090 Class::null()); | |
| 13091 return NewImpl<Float64Array, RawFloat64Array>(kClassId, len, space); | |
| 13092 } | |
| 13093 | |
| 13094 | |
| 13095 RawFloat64Array* Float64Array::New(const double* data, | |
| 13096 intptr_t len, | |
| 13097 Heap::Space space) { | |
| 13098 ASSERT(Isolate::Current()->object_store()->float64_array_class() != | |
| 13099 Class::null()); | |
| 13100 return NewImpl<Float64Array, RawFloat64Array>(kClassId, data, len, space); | |
| 13101 } | |
| 13102 | |
| 13103 | |
| 13104 const char* Float64Array::ToCString() const { | |
| 13105 return "_Float64Array"; | |
| 13106 } | |
| 13107 | |
| 13108 | |
| 13109 RawExternalInt8Array* ExternalInt8Array::New(int8_t* data, | |
| 13110 intptr_t len, | |
| 13111 Heap::Space space) { | |
| 13112 ASSERT(Isolate::Current()->object_store()->external_int8_array_class() != | |
| 13113 Class::null()); | |
| 13114 return NewExternalImpl<ExternalInt8Array, | |
| 13115 RawExternalInt8Array>(kClassId, data, len, space); | |
| 13116 } | |
| 13117 | |
| 13118 | |
| 13119 const char* ExternalInt8Array::ToCString() const { | |
| 13120 return "_ExternalInt8Array"; | |
| 13121 } | |
| 13122 | |
| 13123 | |
| 13124 RawExternalUint8Array* ExternalUint8Array::New(uint8_t* data, | |
| 13125 intptr_t len, | |
| 13126 Heap::Space space) { | |
| 13127 ASSERT(Isolate::Current()->object_store()->external_uint8_array_class() != | |
| 13128 Class::null()); | |
| 13129 return NewExternalImpl<ExternalUint8Array, | |
| 13130 RawExternalUint8Array>(kClassId, data, len, space); | |
| 13131 } | |
| 13132 | |
| 13133 | |
| 13134 const char* ExternalUint8Array::ToCString() const { | |
| 13135 return "_ExternalUint8Array"; | |
| 13136 } | |
| 13137 | |
| 13138 | |
| 13139 RawExternalUint8ClampedArray* ExternalUint8ClampedArray::New( | |
| 13140 uint8_t* data, | |
| 13141 intptr_t len, | |
| 13142 Heap::Space space) { | |
| 13143 ASSERT(Isolate::Current()-> | |
| 13144 object_store()->external_uint8_clamped_array_class() != | |
| 13145 Class::null()); | |
| 13146 return NewExternalImpl<ExternalUint8ClampedArray, | |
| 13147 RawExternalUint8ClampedArray>(kClassId, data, | |
| 13148 len, space); | |
| 13149 } | |
| 13150 | |
| 13151 | |
| 13152 const char* ExternalUint8ClampedArray::ToCString() const { | |
| 13153 return "_ExternalUint8ClampedArray"; | |
| 13154 } | |
| 13155 | |
| 13156 | |
| 13157 RawExternalInt16Array* ExternalInt16Array::New(int16_t* data, | |
| 13158 intptr_t len, | |
| 13159 Heap::Space space) { | |
| 13160 ASSERT(Isolate::Current()->object_store()->external_int16_array_class() != | |
| 13161 Class::null()); | |
| 13162 return NewExternalImpl<ExternalInt16Array, | |
| 13163 RawExternalInt16Array>(kClassId, data, len, space); | |
| 13164 } | |
| 13165 | |
| 13166 | |
| 13167 const char* ExternalInt16Array::ToCString() const { | |
| 13168 return "_ExternalInt16Array"; | |
| 13169 } | |
| 13170 | |
| 13171 | |
| 13172 RawExternalUint16Array* ExternalUint16Array::New(uint16_t* data, | |
| 13173 intptr_t len, | |
| 13174 Heap::Space space) { | |
| 13175 ASSERT(Isolate::Current()->object_store()->external_uint16_array_class() != | |
| 13176 Class::null()); | |
| 13177 return NewExternalImpl<ExternalUint16Array, | |
| 13178 RawExternalUint16Array>(kClassId, data, len, space); | |
| 13179 } | |
| 13180 | |
| 13181 | |
| 13182 const char* ExternalUint16Array::ToCString() const { | |
| 13183 return "_ExternalUint16Array"; | |
| 13184 } | |
| 13185 | |
| 13186 | |
| 13187 RawExternalInt32Array* ExternalInt32Array::New(int32_t* data, | |
| 13188 intptr_t len, | |
| 13189 Heap::Space space) { | |
| 13190 ASSERT(Isolate::Current()->object_store()->external_int32_array_class() != | |
| 13191 Class::null()); | |
| 13192 return NewExternalImpl<ExternalInt32Array, | |
| 13193 RawExternalInt32Array>(kClassId, data, len, space); | |
| 13194 } | |
| 13195 | |
| 13196 | |
| 13197 const char* ExternalInt32Array::ToCString() const { | |
| 13198 return "_ExternalInt32Array"; | |
| 13199 } | |
| 13200 | |
| 13201 | |
| 13202 RawExternalUint32Array* ExternalUint32Array::New(uint32_t* data, | |
| 13203 intptr_t len, | |
| 13204 Heap::Space space) { | |
| 13205 ASSERT(Isolate::Current()->object_store()->external_uint32_array_class() != | |
| 13206 Class::null()); | |
| 13207 return NewExternalImpl<ExternalUint32Array, | |
| 13208 RawExternalUint32Array>(kClassId, data, len, space); | |
| 13209 } | |
| 13210 | |
| 13211 | |
| 13212 const char* ExternalUint32Array::ToCString() const { | |
| 13213 return "_ExternalUint32Array"; | |
| 13214 } | |
| 13215 | |
| 13216 | |
| 13217 RawExternalInt64Array* ExternalInt64Array::New(int64_t* data, | |
| 13218 intptr_t len, | |
| 13219 Heap::Space space) { | |
| 13220 ASSERT(Isolate::Current()->object_store()->external_int64_array_class() != | |
| 13221 Class::null()); | |
| 13222 return NewExternalImpl<ExternalInt64Array, | |
| 13223 RawExternalInt64Array>(kClassId, data, len, space); | |
| 13224 } | |
| 13225 | |
| 13226 | |
| 13227 const char* ExternalInt64Array::ToCString() const { | |
| 13228 return "_ExternalInt64Array"; | |
| 13229 } | |
| 13230 | |
| 13231 | |
| 13232 RawExternalUint64Array* ExternalUint64Array::New(uint64_t* data, | |
| 13233 intptr_t len, | |
| 13234 Heap::Space space) { | |
| 13235 ASSERT(Isolate::Current()->object_store()->external_uint64_array_class() != | |
| 13236 Class::null()); | |
| 13237 return NewExternalImpl<ExternalUint64Array, | |
| 13238 RawExternalUint64Array>(kClassId, data, len, space); | |
| 13239 } | |
| 13240 | |
| 13241 | |
| 13242 const char* ExternalUint64Array::ToCString() const { | |
| 13243 return "_ExternalUint64Array"; | |
| 13244 } | |
| 13245 | |
| 13246 | |
| 13247 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, | |
| 13248 intptr_t len, | |
| 13249 Heap::Space space) { | |
| 13250 ASSERT(Isolate::Current()->object_store()->external_float32_array_class() != | |
| 13251 Class::null()); | |
| 13252 return NewExternalImpl<ExternalFloat32Array, | |
| 13253 RawExternalFloat32Array>(kClassId, data, len, space); | |
| 13254 } | |
| 13255 | |
| 13256 | |
| 13257 const char* ExternalFloat32Array::ToCString() const { | |
| 13258 return "_ExternalFloat32Array"; | |
| 13259 } | |
| 13260 | |
| 13261 | |
| 13262 RawExternalFloat64Array* ExternalFloat64Array::New(double* data, | |
| 13263 intptr_t len, | |
| 13264 Heap::Space space) { | |
| 13265 ASSERT(Isolate::Current()->object_store()->external_float64_array_class() != | |
| 13266 Class::null()); | |
| 13267 return NewExternalImpl<ExternalFloat64Array, | |
| 13268 RawExternalFloat64Array>(kClassId, data, len, space); | |
| 13269 } | |
| 13270 | |
| 13271 | |
| 13272 const char* ExternalFloat64Array::ToCString() const { | |
| 13273 return "_ExternalFloat64Array"; | |
| 13274 } | |
| 13275 | |
| 13276 | |
| 13277 const char* Closure::ToCString(const Instance& closure) { | 12666 const char* Closure::ToCString(const Instance& closure) { |
| 13278 const Function& fun = Function::Handle(Closure::function(closure)); | 12667 const Function& fun = Function::Handle(Closure::function(closure)); |
| 13279 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); | 12668 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
| 13280 const char* fun_sig = String::Handle(fun.Signature()).ToCString(); | 12669 const char* fun_sig = String::Handle(fun.Signature()).ToCString(); |
| 13281 const char* from = is_implicit_closure ? " from " : ""; | 12670 const char* from = is_implicit_closure ? " from " : ""; |
| 13282 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; | 12671 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
| 13283 const char* format = "Closure: %s%s%s"; | 12672 const char* format = "Closure: %s%s%s"; |
| 13284 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1; | 12673 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1; |
| 13285 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 12674 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 13286 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc); | 12675 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13658 } | 13047 } |
| 13659 return result.raw(); | 13048 return result.raw(); |
| 13660 } | 13049 } |
| 13661 | 13050 |
| 13662 | 13051 |
| 13663 const char* WeakProperty::ToCString() const { | 13052 const char* WeakProperty::ToCString() const { |
| 13664 return "_WeakProperty"; | 13053 return "_WeakProperty"; |
| 13665 } | 13054 } |
| 13666 | 13055 |
| 13667 } // namespace dart | 13056 } // namespace dart |
| OLD | NEW |