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/native_entry.h" | 5 #include "vm/native_entry.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/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 intptr_t cid = RawObject::ClassIdTag::decode(tags); | 2627 intptr_t cid = RawObject::ClassIdTag::decode(tags); |
2628 intptr_t length = reader->ReadSmiValue(); | 2628 intptr_t length = reader->ReadSmiValue(); |
2629 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue()); | 2629 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue()); |
2630 ExternalTypedData& obj = ExternalTypedData::ZoneHandle( | 2630 ExternalTypedData& obj = ExternalTypedData::ZoneHandle( |
2631 ExternalTypedData::New(cid, data, length)); | 2631 ExternalTypedData::New(cid, data, length)); |
2632 reader->AddBackRef(object_id, &obj, kIsDeserialized); | 2632 reader->AddBackRef(object_id, &obj, kIsDeserialized); |
2633 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue()); | 2633 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue()); |
2634 Dart_WeakPersistentHandleFinalizer callback = | 2634 Dart_WeakPersistentHandleFinalizer callback = |
2635 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( | 2635 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( |
2636 reader->ReadRawPointerValue()); | 2636 reader->ReadRawPointerValue()); |
2637 obj.AddFinalizer(peer, callback); | 2637 intptr_t external_size = obj.LengthInBytes(); |
| 2638 obj.AddFinalizer(peer, callback, external_size); |
2638 return obj.raw(); | 2639 return obj.raw(); |
2639 } | 2640 } |
2640 | 2641 |
2641 | 2642 |
2642 #define TYPED_DATA_WRITE(type) \ | 2643 #define TYPED_DATA_WRITE(type) \ |
2643 { \ | 2644 { \ |
2644 type* data = reinterpret_cast<type*>(ptr()->data()); \ | 2645 type* data = reinterpret_cast<type*>(ptr()->data()); \ |
2645 for (intptr_t i = 0; i < len; i++) { \ | 2646 for (intptr_t i = 0; i < len; i++) { \ |
2646 writer->Write(data[i]); \ | 2647 writer->Write(data[i]); \ |
2647 } \ | 2648 } \ |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3023 // We do not allow objects with native fields in an isolate message. | 3024 // We do not allow objects with native fields in an isolate message. |
3024 writer->SetWriteException(Exceptions::kArgument, | 3025 writer->SetWriteException(Exceptions::kArgument, |
3025 "Illegal argument in isolate message" | 3026 "Illegal argument in isolate message" |
3026 " : (object is a UserTag)"); | 3027 " : (object is a UserTag)"); |
3027 } else { | 3028 } else { |
3028 UNREACHABLE(); | 3029 UNREACHABLE(); |
3029 } | 3030 } |
3030 } | 3031 } |
3031 | 3032 |
3032 } // namespace dart | 3033 } // namespace dart |
OLD | NEW |