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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 RegisterPrivateClass(cls, Symbols::_Double(), core_lib); | 817 RegisterPrivateClass(cls, Symbols::_Double(), core_lib); |
818 pending_classes.Add(cls, Heap::kOld); | 818 pending_classes.Add(cls, Heap::kOld); |
819 | 819 |
820 cls = Class::New<WeakProperty>(); | 820 cls = Class::New<WeakProperty>(); |
821 object_store->set_weak_property_class(cls); | 821 object_store->set_weak_property_class(cls); |
822 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); | 822 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); |
823 | 823 |
824 Library::InitScalarlistLibrary(isolate); | 824 Library::InitScalarlistLibrary(isolate); |
825 Library& scalarlist_lib = Library::Handle(Library::ScalarlistLibrary()); | 825 Library& scalarlist_lib = Library::Handle(Library::ScalarlistLibrary()); |
826 | 826 |
| 827 cls = Class::New<Float32x4>(); |
| 828 object_store->set_float32x4_class(cls); |
| 829 RegisterPrivateClass(cls, Symbols::_Float32x4(), scalarlist_lib); |
| 830 |
| 831 cls = Class::New<Uint32x4>(); |
| 832 object_store->set_uint32x4_class(cls); |
| 833 RegisterPrivateClass(cls, Symbols::_Uint32x4(), scalarlist_lib); |
| 834 |
827 cls = Class::New<Int8Array>(); | 835 cls = Class::New<Int8Array>(); |
828 object_store->set_int8_array_class(cls); | 836 object_store->set_int8_array_class(cls); |
829 RegisterPrivateClass(cls, Symbols::_Int8Array(), scalarlist_lib); | 837 RegisterPrivateClass(cls, Symbols::_Int8Array(), scalarlist_lib); |
830 | 838 |
831 cls = Class::New<Uint8Array>(); | 839 cls = Class::New<Uint8Array>(); |
832 object_store->set_uint8_array_class(cls); | 840 object_store->set_uint8_array_class(cls); |
833 RegisterPrivateClass(cls, Symbols::_Uint8Array(), scalarlist_lib); | 841 RegisterPrivateClass(cls, Symbols::_Uint8Array(), scalarlist_lib); |
834 | 842 |
835 cls = Class::New<Uint8ClampedArray>(); | 843 cls = Class::New<Uint8ClampedArray>(); |
836 object_store->set_uint8_clamped_array_class(cls); | 844 object_store->set_uint8_clamped_array_class(cls); |
(...skipping 16 matching lines...) Expand all Loading... |
853 RegisterPrivateClass(cls, Symbols::_Uint32Array(), scalarlist_lib); | 861 RegisterPrivateClass(cls, Symbols::_Uint32Array(), scalarlist_lib); |
854 | 862 |
855 cls = Class::New<Int64Array>(); | 863 cls = Class::New<Int64Array>(); |
856 object_store->set_int64_array_class(cls); | 864 object_store->set_int64_array_class(cls); |
857 RegisterPrivateClass(cls, Symbols::_Int64Array(), scalarlist_lib); | 865 RegisterPrivateClass(cls, Symbols::_Int64Array(), scalarlist_lib); |
858 | 866 |
859 cls = Class::New<Uint64Array>(); | 867 cls = Class::New<Uint64Array>(); |
860 object_store->set_uint64_array_class(cls); | 868 object_store->set_uint64_array_class(cls); |
861 RegisterPrivateClass(cls, Symbols::_Uint64Array(), scalarlist_lib); | 869 RegisterPrivateClass(cls, Symbols::_Uint64Array(), scalarlist_lib); |
862 | 870 |
| 871 cls = Class::New<Float32x4Array>(); |
| 872 object_store->set_float32x4_array_class(cls); |
| 873 RegisterPrivateClass(cls, Symbols::_Float32x4Array(), scalarlist_lib); |
| 874 |
863 cls = Class::New<Float32Array>(); | 875 cls = Class::New<Float32Array>(); |
864 object_store->set_float32_array_class(cls); | 876 object_store->set_float32_array_class(cls); |
865 RegisterPrivateClass(cls, Symbols::_Float32Array(), scalarlist_lib); | 877 RegisterPrivateClass(cls, Symbols::_Float32Array(), scalarlist_lib); |
866 | 878 |
867 cls = Class::New<Float64Array>(); | 879 cls = Class::New<Float64Array>(); |
868 object_store->set_float64_array_class(cls); | 880 object_store->set_float64_array_class(cls); |
869 RegisterPrivateClass(cls, Symbols::_Float64Array(), scalarlist_lib); | 881 RegisterPrivateClass(cls, Symbols::_Float64Array(), scalarlist_lib); |
870 | 882 |
871 cls = Class::New<ExternalInt8Array>(); | 883 cls = Class::New<ExternalInt8Array>(); |
872 object_store->set_external_int8_array_class(cls); | 884 object_store->set_external_int8_array_class(cls); |
(...skipping 26 matching lines...) Expand all Loading... |
899 RegisterPrivateClass(cls, Symbols::_ExternalUint32Array(), scalarlist_lib); | 911 RegisterPrivateClass(cls, Symbols::_ExternalUint32Array(), scalarlist_lib); |
900 | 912 |
901 cls = Class::New<ExternalInt64Array>(); | 913 cls = Class::New<ExternalInt64Array>(); |
902 object_store->set_external_int64_array_class(cls); | 914 object_store->set_external_int64_array_class(cls); |
903 RegisterPrivateClass(cls, Symbols::_ExternalInt64Array(), scalarlist_lib); | 915 RegisterPrivateClass(cls, Symbols::_ExternalInt64Array(), scalarlist_lib); |
904 | 916 |
905 cls = Class::New<ExternalUint64Array>(); | 917 cls = Class::New<ExternalUint64Array>(); |
906 object_store->set_external_uint64_array_class(cls); | 918 object_store->set_external_uint64_array_class(cls); |
907 RegisterPrivateClass(cls, Symbols::_ExternalUint64Array(), scalarlist_lib); | 919 RegisterPrivateClass(cls, Symbols::_ExternalUint64Array(), scalarlist_lib); |
908 | 920 |
| 921 cls = Class::New<ExternalFloat32x4Array>(); |
| 922 object_store->set_external_float32x4_array_class(cls); |
| 923 RegisterPrivateClass(cls, Symbols::_ExternalFloat32x4Array(), |
| 924 scalarlist_lib); |
| 925 |
909 cls = Class::New<ExternalFloat32Array>(); | 926 cls = Class::New<ExternalFloat32Array>(); |
910 object_store->set_external_float32_array_class(cls); | 927 object_store->set_external_float32_array_class(cls); |
911 RegisterPrivateClass(cls, Symbols::_ExternalFloat32Array(), scalarlist_lib); | 928 RegisterPrivateClass(cls, Symbols::_ExternalFloat32Array(), scalarlist_lib); |
912 | 929 |
913 cls = Class::New<ExternalFloat64Array>(); | 930 cls = Class::New<ExternalFloat64Array>(); |
914 object_store->set_external_float64_array_class(cls); | 931 object_store->set_external_float64_array_class(cls); |
915 RegisterPrivateClass(cls, Symbols::_ExternalFloat64Array(), scalarlist_lib); | 932 RegisterPrivateClass(cls, Symbols::_ExternalFloat64Array(), scalarlist_lib); |
916 | 933 |
917 // Set the super type of class Stacktrace to Object type so that the | 934 // Set the super type of class Stacktrace to Object type so that the |
918 // 'toString' method is implemented. | 935 // 'toString' method is implemented. |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 | 1166 |
1150 cls = Class::New<Array>(); | 1167 cls = Class::New<Array>(); |
1151 object_store->set_array_class(cls); | 1168 object_store->set_array_class(cls); |
1152 | 1169 |
1153 cls = Class::New<ImmutableArray>(); | 1170 cls = Class::New<ImmutableArray>(); |
1154 object_store->set_immutable_array_class(cls); | 1171 object_store->set_immutable_array_class(cls); |
1155 | 1172 |
1156 cls = Class::New<GrowableObjectArray>(); | 1173 cls = Class::New<GrowableObjectArray>(); |
1157 object_store->set_growable_object_array_class(cls); | 1174 object_store->set_growable_object_array_class(cls); |
1158 | 1175 |
| 1176 cls = Class::New<Float32x4>(); |
| 1177 object_store->set_float32x4_class(cls); |
| 1178 |
| 1179 cls = Class::New<Uint32x4>(); |
| 1180 object_store->set_uint32x4_class(cls); |
| 1181 |
1159 cls = Class::New<Int8Array>(); | 1182 cls = Class::New<Int8Array>(); |
1160 object_store->set_int8_array_class(cls); | 1183 object_store->set_int8_array_class(cls); |
1161 | 1184 |
1162 cls = Class::New<Uint8Array>(); | 1185 cls = Class::New<Uint8Array>(); |
1163 object_store->set_uint8_array_class(cls); | 1186 object_store->set_uint8_array_class(cls); |
1164 | 1187 |
1165 cls = Class::New<Uint8ClampedArray>(); | 1188 cls = Class::New<Uint8ClampedArray>(); |
1166 object_store->set_uint8_clamped_array_class(cls); | 1189 object_store->set_uint8_clamped_array_class(cls); |
1167 | 1190 |
1168 cls = Class::New<Int16Array>(); | 1191 cls = Class::New<Int16Array>(); |
1169 object_store->set_int16_array_class(cls); | 1192 object_store->set_int16_array_class(cls); |
1170 | 1193 |
1171 cls = Class::New<Uint16Array>(); | 1194 cls = Class::New<Uint16Array>(); |
1172 object_store->set_uint16_array_class(cls); | 1195 object_store->set_uint16_array_class(cls); |
1173 | 1196 |
1174 cls = Class::New<Int32Array>(); | 1197 cls = Class::New<Int32Array>(); |
1175 object_store->set_int32_array_class(cls); | 1198 object_store->set_int32_array_class(cls); |
1176 | 1199 |
1177 cls = Class::New<Uint32Array>(); | 1200 cls = Class::New<Uint32Array>(); |
1178 object_store->set_uint32_array_class(cls); | 1201 object_store->set_uint32_array_class(cls); |
1179 | 1202 |
1180 cls = Class::New<Int64Array>(); | 1203 cls = Class::New<Int64Array>(); |
1181 object_store->set_int64_array_class(cls); | 1204 object_store->set_int64_array_class(cls); |
1182 | 1205 |
1183 cls = Class::New<Uint64Array>(); | 1206 cls = Class::New<Uint64Array>(); |
1184 object_store->set_uint64_array_class(cls); | 1207 object_store->set_uint64_array_class(cls); |
1185 | 1208 |
| 1209 cls = Class::New<Float32x4Array>(); |
| 1210 object_store->set_float32x4_array_class(cls); |
| 1211 |
1186 cls = Class::New<Float32Array>(); | 1212 cls = Class::New<Float32Array>(); |
1187 object_store->set_float32_array_class(cls); | 1213 object_store->set_float32_array_class(cls); |
1188 | 1214 |
1189 cls = Class::New<Float64Array>(); | 1215 cls = Class::New<Float64Array>(); |
1190 object_store->set_float64_array_class(cls); | 1216 object_store->set_float64_array_class(cls); |
1191 | 1217 |
1192 cls = Class::New<ExternalInt8Array>(); | 1218 cls = Class::New<ExternalInt8Array>(); |
1193 object_store->set_external_int8_array_class(cls); | 1219 object_store->set_external_int8_array_class(cls); |
1194 | 1220 |
1195 cls = Class::New<ExternalUint8Array>(); | 1221 cls = Class::New<ExternalUint8Array>(); |
(...skipping 13 matching lines...) Expand all Loading... |
1209 | 1235 |
1210 cls = Class::New<ExternalUint32Array>(); | 1236 cls = Class::New<ExternalUint32Array>(); |
1211 object_store->set_external_uint32_array_class(cls); | 1237 object_store->set_external_uint32_array_class(cls); |
1212 | 1238 |
1213 cls = Class::New<ExternalInt64Array>(); | 1239 cls = Class::New<ExternalInt64Array>(); |
1214 object_store->set_external_int64_array_class(cls); | 1240 object_store->set_external_int64_array_class(cls); |
1215 | 1241 |
1216 cls = Class::New<ExternalUint64Array>(); | 1242 cls = Class::New<ExternalUint64Array>(); |
1217 object_store->set_external_uint64_array_class(cls); | 1243 object_store->set_external_uint64_array_class(cls); |
1218 | 1244 |
| 1245 cls = Class::New<ExternalFloat32x4Array>(); |
| 1246 object_store->set_external_float32x4_array_class(cls); |
| 1247 |
1219 cls = Class::New<ExternalFloat32Array>(); | 1248 cls = Class::New<ExternalFloat32Array>(); |
1220 object_store->set_external_float32_array_class(cls); | 1249 object_store->set_external_float32_array_class(cls); |
1221 | 1250 |
1222 cls = Class::New<ExternalFloat64Array>(); | 1251 cls = Class::New<ExternalFloat64Array>(); |
1223 object_store->set_external_float64_array_class(cls); | 1252 object_store->set_external_float64_array_class(cls); |
1224 | 1253 |
1225 cls = Class::New<Integer>(); | 1254 cls = Class::New<Integer>(); |
1226 object_store->set_integer_implementation_class(cls); | 1255 object_store->set_integer_implementation_class(cls); |
1227 | 1256 |
1228 cls = Class::New<Smi>(); | 1257 cls = Class::New<Smi>(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 return Symbols::Double().raw(); | 1440 return Symbols::Double().raw(); |
1412 case kOneByteStringCid: | 1441 case kOneByteStringCid: |
1413 case kTwoByteStringCid: | 1442 case kTwoByteStringCid: |
1414 case kExternalOneByteStringCid: | 1443 case kExternalOneByteStringCid: |
1415 case kExternalTwoByteStringCid: | 1444 case kExternalTwoByteStringCid: |
1416 return Symbols::New("String"); | 1445 return Symbols::New("String"); |
1417 case kArrayCid: | 1446 case kArrayCid: |
1418 case kImmutableArrayCid: | 1447 case kImmutableArrayCid: |
1419 case kGrowableObjectArrayCid: | 1448 case kGrowableObjectArrayCid: |
1420 return Symbols::List().raw(); | 1449 return Symbols::List().raw(); |
| 1450 case kFloat32x4Cid: |
| 1451 return Symbols::Float32x4().raw(); |
| 1452 case kUint32x4Cid: |
| 1453 return Symbols::Uint32x4().raw(); |
1421 case kInt8ArrayCid: | 1454 case kInt8ArrayCid: |
1422 case kExternalInt8ArrayCid: | 1455 case kExternalInt8ArrayCid: |
1423 return Symbols::Int8List().raw(); | 1456 return Symbols::Int8List().raw(); |
1424 case kUint8ArrayCid: | 1457 case kUint8ArrayCid: |
1425 case kExternalUint8ArrayCid: | 1458 case kExternalUint8ArrayCid: |
1426 return Symbols::Uint8List().raw(); | 1459 return Symbols::Uint8List().raw(); |
1427 case kUint8ClampedArrayCid: | 1460 case kUint8ClampedArrayCid: |
1428 case kExternalUint8ClampedArrayCid: | 1461 case kExternalUint8ClampedArrayCid: |
1429 return Symbols::Uint8ClampedList().raw(); | 1462 return Symbols::Uint8ClampedList().raw(); |
1430 case kInt16ArrayCid: | 1463 case kInt16ArrayCid: |
1431 case kExternalInt16ArrayCid: | 1464 case kExternalInt16ArrayCid: |
1432 return Symbols::Int16List().raw(); | 1465 return Symbols::Int16List().raw(); |
1433 case kUint16ArrayCid: | 1466 case kUint16ArrayCid: |
1434 case kExternalUint16ArrayCid: | 1467 case kExternalUint16ArrayCid: |
1435 return Symbols::Uint16List().raw(); | 1468 return Symbols::Uint16List().raw(); |
1436 case kInt32ArrayCid: | 1469 case kInt32ArrayCid: |
1437 case kExternalInt32ArrayCid: | 1470 case kExternalInt32ArrayCid: |
1438 return Symbols::Int32List().raw(); | 1471 return Symbols::Int32List().raw(); |
1439 case kUint32ArrayCid: | 1472 case kUint32ArrayCid: |
1440 case kExternalUint32ArrayCid: | 1473 case kExternalUint32ArrayCid: |
1441 return Symbols::Uint32List().raw(); | 1474 return Symbols::Uint32List().raw(); |
1442 case kInt64ArrayCid: | 1475 case kInt64ArrayCid: |
1443 case kExternalInt64ArrayCid: | 1476 case kExternalInt64ArrayCid: |
1444 return Symbols::Int64List().raw(); | 1477 return Symbols::Int64List().raw(); |
1445 case kUint64ArrayCid: | 1478 case kUint64ArrayCid: |
1446 case kExternalUint64ArrayCid: | 1479 case kExternalUint64ArrayCid: |
1447 return Symbols::Uint64List().raw(); | 1480 return Symbols::Uint64List().raw(); |
| 1481 case kFloat32x4ArrayCid: |
| 1482 case kExternalFloat32x4ArrayCid: |
| 1483 return Symbols::Float32x4List().raw(); |
1448 case kFloat32ArrayCid: | 1484 case kFloat32ArrayCid: |
1449 case kExternalFloat32ArrayCid: | 1485 case kExternalFloat32ArrayCid: |
1450 return Symbols::Float32List().raw(); | 1486 return Symbols::Float32List().raw(); |
1451 case kFloat64ArrayCid: | 1487 case kFloat64ArrayCid: |
1452 case kExternalFloat64ArrayCid: | 1488 case kExternalFloat64ArrayCid: |
1453 return Symbols::Float64List().raw(); | 1489 return Symbols::Float64List().raw(); |
1454 default: | 1490 default: |
1455 if (!IsSignatureClass()) { | 1491 if (!IsSignatureClass()) { |
1456 const String& name = String::Handle(Name()); | 1492 const String& name = String::Handle(Name()); |
1457 return IdentifierPrettyName(name); | 1493 return IdentifierPrettyName(name); |
(...skipping 10712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12170 } | 12206 } |
12171 return result.raw(); | 12207 return result.raw(); |
12172 } | 12208 } |
12173 | 12209 |
12174 | 12210 |
12175 const char* GrowableObjectArray::ToCString() const { | 12211 const char* GrowableObjectArray::ToCString() const { |
12176 return "GrowableObjectArray"; | 12212 return "GrowableObjectArray"; |
12177 } | 12213 } |
12178 | 12214 |
12179 | 12215 |
| 12216 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
| 12217 Heap::Space space) { |
| 12218 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
| 12219 Class::null()); |
| 12220 Float32x4& result = Float32x4::Handle(); |
| 12221 { |
| 12222 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
| 12223 Float32x4::InstanceSize(), |
| 12224 space); |
| 12225 NoGCScope no_gc; |
| 12226 result ^= raw; |
| 12227 } |
| 12228 result.set_x(v0); |
| 12229 result.set_y(v1); |
| 12230 result.set_z(v2); |
| 12231 result.set_w(v3); |
| 12232 return result.raw(); |
| 12233 } |
| 12234 |
| 12235 |
| 12236 RawFloat32x4* Float32x4::New(simd_value_t value, Heap::Space space) { |
| 12237 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
| 12238 Class::null()); |
| 12239 Float32x4& result = Float32x4::Handle(); |
| 12240 { |
| 12241 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
| 12242 Float32x4::InstanceSize(), |
| 12243 space); |
| 12244 NoGCScope no_gc; |
| 12245 result ^= raw; |
| 12246 } |
| 12247 result.set_value(value); |
| 12248 return result.raw(); |
| 12249 } |
| 12250 |
| 12251 |
| 12252 simd_value_t Float32x4::value() const { |
| 12253 return simd_value_safe_load(&raw_ptr()->value_[0]); |
| 12254 } |
| 12255 |
| 12256 |
| 12257 void Float32x4::set_value(simd_value_t value) const { |
| 12258 simd_value_safe_store(&raw_ptr()->value_[0], value); |
| 12259 } |
| 12260 |
| 12261 |
| 12262 void Float32x4::set_x(float value) const { |
| 12263 raw_ptr()->value_[0] = value; |
| 12264 } |
| 12265 |
| 12266 |
| 12267 void Float32x4::set_y(float value) const { |
| 12268 raw_ptr()->value_[1] = value; |
| 12269 } |
| 12270 |
| 12271 |
| 12272 void Float32x4::set_z(float value) const { |
| 12273 raw_ptr()->value_[2] = value; |
| 12274 } |
| 12275 |
| 12276 |
| 12277 void Float32x4::set_w(float value) const { |
| 12278 raw_ptr()->value_[3] = value; |
| 12279 } |
| 12280 |
| 12281 |
| 12282 float Float32x4::x() const { |
| 12283 return raw_ptr()->value_[0]; |
| 12284 } |
| 12285 |
| 12286 |
| 12287 float Float32x4::y() const { |
| 12288 return raw_ptr()->value_[1]; |
| 12289 } |
| 12290 |
| 12291 |
| 12292 float Float32x4::z() const { |
| 12293 return raw_ptr()->value_[2]; |
| 12294 } |
| 12295 |
| 12296 |
| 12297 float Float32x4::w() const { |
| 12298 return raw_ptr()->value_[3]; |
| 12299 } |
| 12300 |
| 12301 |
| 12302 const char* Float32x4::ToCString() const { |
| 12303 const char* kFormat = "[%f, %f, %f, %f]"; |
| 12304 float _x = x(); |
| 12305 float _y = y(); |
| 12306 float _z = z(); |
| 12307 float _w = w(); |
| 12308 // Calculate the size of the string. |
| 12309 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
| 12310 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12311 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
| 12312 return chars; |
| 12313 } |
| 12314 |
| 12315 |
| 12316 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, |
| 12317 Heap::Space space) { |
| 12318 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != |
| 12319 Class::null()); |
| 12320 Uint32x4& result = Uint32x4::Handle(); |
| 12321 { |
| 12322 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
| 12323 Uint32x4::InstanceSize(), |
| 12324 space); |
| 12325 NoGCScope no_gc; |
| 12326 result ^= raw; |
| 12327 } |
| 12328 result.set_x(v0); |
| 12329 result.set_y(v1); |
| 12330 result.set_z(v2); |
| 12331 result.set_w(v3); |
| 12332 return result.raw(); |
| 12333 } |
| 12334 |
| 12335 |
| 12336 RawUint32x4* Uint32x4::New(simd_value_t value, Heap::Space space) { |
| 12337 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
| 12338 Class::null()); |
| 12339 Uint32x4& result = Uint32x4::Handle(); |
| 12340 { |
| 12341 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
| 12342 Uint32x4::InstanceSize(), |
| 12343 space); |
| 12344 NoGCScope no_gc; |
| 12345 result ^= raw; |
| 12346 } |
| 12347 result.set_value(value); |
| 12348 return result.raw(); |
| 12349 } |
| 12350 |
| 12351 |
| 12352 void Uint32x4::set_x(uint32_t value) const { |
| 12353 raw_ptr()->value_[0] = value; |
| 12354 } |
| 12355 |
| 12356 |
| 12357 void Uint32x4::set_y(uint32_t value) const { |
| 12358 raw_ptr()->value_[1] = value; |
| 12359 } |
| 12360 |
| 12361 |
| 12362 void Uint32x4::set_z(uint32_t value) const { |
| 12363 raw_ptr()->value_[2] = value; |
| 12364 } |
| 12365 |
| 12366 |
| 12367 void Uint32x4::set_w(uint32_t value) const { |
| 12368 raw_ptr()->value_[3] = value; |
| 12369 } |
| 12370 |
| 12371 |
| 12372 uint32_t Uint32x4::x() const { |
| 12373 return raw_ptr()->value_[0]; |
| 12374 } |
| 12375 |
| 12376 |
| 12377 uint32_t Uint32x4::y() const { |
| 12378 return raw_ptr()->value_[1]; |
| 12379 } |
| 12380 |
| 12381 |
| 12382 uint32_t Uint32x4::z() const { |
| 12383 return raw_ptr()->value_[2]; |
| 12384 } |
| 12385 |
| 12386 |
| 12387 uint32_t Uint32x4::w() const { |
| 12388 return raw_ptr()->value_[3]; |
| 12389 } |
| 12390 |
| 12391 |
| 12392 simd_value_t Uint32x4::value() const { |
| 12393 return simd_value_safe_load(&raw_ptr()->value_[0]); |
| 12394 } |
| 12395 |
| 12396 |
| 12397 void Uint32x4::set_value(simd_value_t value) const { |
| 12398 simd_value_safe_store(&raw_ptr()->value_[0], value); |
| 12399 } |
| 12400 |
| 12401 |
| 12402 const char* Uint32x4::ToCString() const { |
| 12403 const char* kFormat = "[%08x, %08x, %08x, %08x]"; |
| 12404 uint32_t _x = x(); |
| 12405 uint32_t _y = y(); |
| 12406 uint32_t _z = z(); |
| 12407 uint32_t _w = w(); |
| 12408 // Calculate the size of the string. |
| 12409 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
| 12410 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12411 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
| 12412 return chars; |
| 12413 } |
| 12414 |
| 12415 |
12180 void ByteArray::Copy(void* dst, | 12416 void ByteArray::Copy(void* dst, |
12181 const ByteArray& src, | 12417 const ByteArray& src, |
12182 intptr_t src_offset, | 12418 intptr_t src_offset, |
12183 intptr_t length) { | 12419 intptr_t length) { |
12184 ASSERT(Utils::RangeCheck(src_offset, length, src.ByteLength())); | 12420 ASSERT(Utils::RangeCheck(src_offset, length, src.ByteLength())); |
12185 { | 12421 { |
12186 NoGCScope no_gc; | 12422 NoGCScope no_gc; |
12187 if (length > 0) { | 12423 if (length > 0) { |
12188 memmove(dst, src.ByteAddr(src_offset), length); | 12424 memmove(dst, src.ByteAddr(src_offset), length); |
12189 } | 12425 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12502 Class::null()); | 12738 Class::null()); |
12503 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); | 12739 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); |
12504 } | 12740 } |
12505 | 12741 |
12506 | 12742 |
12507 const char* Uint64Array::ToCString() const { | 12743 const char* Uint64Array::ToCString() const { |
12508 return "_Uint64Array"; | 12744 return "_Uint64Array"; |
12509 } | 12745 } |
12510 | 12746 |
12511 | 12747 |
| 12748 RawFloat32x4Array* Float32x4Array::New(intptr_t len, |
| 12749 Heap::Space space) { |
| 12750 ASSERT(Isolate::Current()->object_store()->float32x4_array_class() != |
| 12751 Class::null()); |
| 12752 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, len, |
| 12753 space); |
| 12754 } |
| 12755 |
| 12756 |
| 12757 RawFloat32x4Array* Float32x4Array::New(const simd_value_t* data, |
| 12758 intptr_t len, |
| 12759 Heap::Space space) { |
| 12760 ASSERT(Isolate::Current()->object_store()->float32_array_class() != |
| 12761 Class::null()); |
| 12762 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, data, |
| 12763 len, space); |
| 12764 } |
| 12765 |
| 12766 |
| 12767 const char* Float32x4Array::ToCString() const { |
| 12768 return "_Float32x4Array"; |
| 12769 } |
| 12770 |
| 12771 |
12512 RawFloat32Array* Float32Array::New(intptr_t len, Heap::Space space) { | 12772 RawFloat32Array* Float32Array::New(intptr_t len, Heap::Space space) { |
12513 ASSERT(Isolate::Current()->object_store()->float32_array_class() != | 12773 ASSERT(Isolate::Current()->object_store()->float32_array_class() != |
12514 Class::null()); | 12774 Class::null()); |
12515 return NewImpl<Float32Array, RawFloat32Array>(kClassId, len, space); | 12775 return NewImpl<Float32Array, RawFloat32Array>(kClassId, len, space); |
12516 } | 12776 } |
12517 | 12777 |
12518 | 12778 |
12519 RawFloat32Array* Float32Array::New(const float* data, | 12779 RawFloat32Array* Float32Array::New(const float* data, |
12520 intptr_t len, | 12780 intptr_t len, |
12521 Heap::Space space) { | 12781 Heap::Space space) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12682 return NewExternalImpl<ExternalUint64Array, | 12942 return NewExternalImpl<ExternalUint64Array, |
12683 RawExternalUint64Array>(kClassId, data, len, space); | 12943 RawExternalUint64Array>(kClassId, data, len, space); |
12684 } | 12944 } |
12685 | 12945 |
12686 | 12946 |
12687 const char* ExternalUint64Array::ToCString() const { | 12947 const char* ExternalUint64Array::ToCString() const { |
12688 return "_ExternalUint64Array"; | 12948 return "_ExternalUint64Array"; |
12689 } | 12949 } |
12690 | 12950 |
12691 | 12951 |
| 12952 RawExternalFloat32x4Array* ExternalFloat32x4Array::New( |
| 12953 simd_value_t* data, |
| 12954 intptr_t len, |
| 12955 Heap::Space space) { |
| 12956 RawClass* cls = |
| 12957 Isolate::Current()->object_store()->external_float32x4_array_class(); |
| 12958 ASSERT(cls != Class::null()); |
| 12959 return NewExternalImpl<ExternalFloat32x4Array, |
| 12960 RawExternalFloat32x4Array>(kClassId, data, len, |
| 12961 space); |
| 12962 } |
| 12963 |
| 12964 |
| 12965 const char* ExternalFloat32x4Array::ToCString() const { |
| 12966 return "_ExternalFloat32x4Array"; |
| 12967 } |
| 12968 |
| 12969 |
12692 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, | 12970 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, |
12693 intptr_t len, | 12971 intptr_t len, |
12694 Heap::Space space) { | 12972 Heap::Space space) { |
12695 ASSERT(Isolate::Current()->object_store()->external_float32_array_class() != | 12973 ASSERT(Isolate::Current()->object_store()->external_float32_array_class() != |
12696 Class::null()); | 12974 Class::null()); |
12697 return NewExternalImpl<ExternalFloat32Array, | 12975 return NewExternalImpl<ExternalFloat32Array, |
12698 RawExternalFloat32Array>(kClassId, data, len, space); | 12976 RawExternalFloat32Array>(kClassId, data, len, space); |
12699 } | 12977 } |
12700 | 12978 |
12701 | 12979 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13020 } | 13298 } |
13021 return result.raw(); | 13299 return result.raw(); |
13022 } | 13300 } |
13023 | 13301 |
13024 | 13302 |
13025 const char* WeakProperty::ToCString() const { | 13303 const char* WeakProperty::ToCString() const { |
13026 return "_WeakProperty"; | 13304 return "_WeakProperty"; |
13027 } | 13305 } |
13028 | 13306 |
13029 } // namespace dart | 13307 } // namespace dart |
OLD | NEW |