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/bigint_operations.h" | 5 #include "vm/bigint_operations.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 | 2254 |
2255 intptr_t len = reader->ReadSmiValue(); | 2255 intptr_t len = reader->ReadSmiValue(); |
2256 Float32x4Array& result = Float32x4Array::ZoneHandle( | 2256 Float32x4Array& result = Float32x4Array::ZoneHandle( |
2257 reader->isolate(), Float32x4Array::New(len, HEAP_SPACE(kind))); | 2257 reader->isolate(), Float32x4Array::New(len, HEAP_SPACE(kind))); |
2258 reader->AddBackRef(object_id, &result, kIsDeserialized); | 2258 reader->AddBackRef(object_id, &result, kIsDeserialized); |
2259 | 2259 |
2260 // Set the object tags. | 2260 // Set the object tags. |
2261 result.set_tags(tags); | 2261 result.set_tags(tags); |
2262 | 2262 |
2263 // Setup the array elements. | 2263 // Setup the array elements. |
2264 float v[4]; | 2264 simd128_value_t v; |
2265 for (intptr_t i = 0; i < len; ++i) { | 2265 for (intptr_t i = 0; i < len; ++i) { |
2266 v[0] = reader->Read<float>(); | 2266 v.storage[0] = reader->Read<float>(); |
2267 v[1] = reader->Read<float>(); | 2267 v.storage[1] = reader->Read<float>(); |
2268 v[2] = reader->Read<float>(); | 2268 v.storage[2] = reader->Read<float>(); |
2269 v[3] = reader->Read<float>(); | 2269 v.storage[3] = reader->Read<float>(); |
2270 result.SetAt(i, simd_value_safe_load(&v[0])); | 2270 result.SetAt(i, v); |
2271 } | 2271 } |
2272 return result.raw(); | 2272 return result.raw(); |
2273 } | 2273 } |
2274 | 2274 |
2275 | 2275 |
2276 #define EXTERNALARRAY_READ_FROM(name, lname, type) \ | 2276 #define EXTERNALARRAY_READ_FROM(name, lname, type) \ |
2277 RawExternal##name##Array* External##name##Array::ReadFrom( \ | 2277 RawExternal##name##Array* External##name##Array::ReadFrom( \ |
2278 SnapshotReader* reader, \ | 2278 SnapshotReader* reader, \ |
2279 intptr_t object_id, \ | 2279 intptr_t object_id, \ |
2280 intptr_t tags, \ | 2280 intptr_t tags, \ |
2281 Snapshot::Kind kind) { \ | 2281 Snapshot::Kind kind) { \ |
2282 ASSERT(kind != Snapshot::kFull); \ | 2282 ASSERT(kind != Snapshot::kFull); \ |
2283 intptr_t length = reader->ReadSmiValue(); \ | 2283 intptr_t length = reader->ReadSmiValue(); \ |
2284 type* data = reinterpret_cast<type*>(reader->ReadIntptrValue()); \ | 2284 type* data = reinterpret_cast<type*>(reader->ReadIntptrValue()); \ |
2285 const External##name##Array& obj = External##name##Array::Handle( \ | 2285 const External##name##Array& obj = External##name##Array::Handle( \ |
2286 External##name##Array::New(data, length)); \ | 2286 External##name##Array::New(data, length)); \ |
2287 void* peer = reinterpret_cast<void*>(reader->ReadIntptrValue()); \ | 2287 void* peer = reinterpret_cast<void*>(reader->ReadIntptrValue()); \ |
2288 Dart_WeakPersistentHandleFinalizer callback = \ | 2288 Dart_WeakPersistentHandleFinalizer callback = \ |
2289 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( \ | 2289 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( \ |
2290 reader->ReadIntptrValue()); \ | 2290 reader->ReadIntptrValue()); \ |
2291 obj.AddFinalizer(peer, callback); \ | 2291 obj.AddFinalizer(peer, callback); \ |
2292 return obj.raw(); \ | 2292 return obj.raw(); \ |
2293 } \ | 2293 } \ |
2294 | 2294 |
2295 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_READ_FROM) | 2295 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_READ_FROM) |
2296 EXTERNALARRAY_READ_FROM(Float32x4, Float32x4, simd_value_t) | 2296 EXTERNALARRAY_READ_FROM(Float32x4, Float32x4, simd128_value_t) |
2297 #undef EXTERNALARRAY_READ_FROM | 2297 #undef EXTERNALARRAY_READ_FROM |
2298 | 2298 |
2299 | 2299 |
2300 template<typename ElementT> | 2300 template<typename ElementT> |
2301 static void ByteArrayWriteTo(SnapshotWriter* writer, | 2301 static void ByteArrayWriteTo(SnapshotWriter* writer, |
2302 intptr_t object_id, | 2302 intptr_t object_id, |
2303 Snapshot::Kind kind, | 2303 Snapshot::Kind kind, |
2304 intptr_t byte_array_kind, | 2304 intptr_t byte_array_kind, |
2305 intptr_t tags, | 2305 intptr_t tags, |
2306 RawSmi* length, | 2306 RawSmi* length, |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 // Write out the class and tags information. | 2792 // Write out the class and tags information. |
2793 writer->WriteIndexedObject(kWeakPropertyCid); | 2793 writer->WriteIndexedObject(kWeakPropertyCid); |
2794 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2794 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2795 | 2795 |
2796 // Write out all the other fields. | 2796 // Write out all the other fields. |
2797 writer->Write<RawObject*>(ptr()->key_); | 2797 writer->Write<RawObject*>(ptr()->key_); |
2798 writer->Write<RawObject*>(ptr()->value_); | 2798 writer->Write<RawObject*>(ptr()->value_); |
2799 } | 2799 } |
2800 | 2800 |
2801 } // namespace dart | 2801 } // namespace dart |
OLD | NEW |