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