Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 2275803002: Assign external sizes to external strings and to external typed data created by the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698