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

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

Issue 323163002: Adds an assertion to limit snapshot intptr_t size. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | 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/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/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 #undef TYPED_DATA_READ 2374 #undef TYPED_DATA_READ
2375 2375
2376 2376
2377 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, 2377 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader,
2378 intptr_t object_id, 2378 intptr_t object_id,
2379 intptr_t tags, 2379 intptr_t tags,
2380 Snapshot::Kind kind) { 2380 Snapshot::Kind kind) {
2381 ASSERT(kind != Snapshot::kFull); 2381 ASSERT(kind != Snapshot::kFull);
2382 intptr_t cid = RawObject::ClassIdTag::decode(tags); 2382 intptr_t cid = RawObject::ClassIdTag::decode(tags);
2383 intptr_t length = reader->ReadSmiValue(); 2383 intptr_t length = reader->ReadSmiValue();
2384 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadIntptrValue()); 2384 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue());
2385 const ExternalTypedData& obj = ExternalTypedData::Handle( 2385 const ExternalTypedData& obj = ExternalTypedData::Handle(
2386 ExternalTypedData::New(cid, data, length)); 2386 ExternalTypedData::New(cid, data, length));
2387 void* peer = reinterpret_cast<void*>(reader->ReadIntptrValue()); 2387 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue());
2388 Dart_WeakPersistentHandleFinalizer callback = 2388 Dart_WeakPersistentHandleFinalizer callback =
2389 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( 2389 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>(
2390 reader->ReadIntptrValue()); 2390 reader->ReadRawPointerValue());
2391 obj.AddFinalizer(peer, callback); 2391 obj.AddFinalizer(peer, callback);
2392 return obj.raw(); 2392 return obj.raw();
2393 } 2393 }
2394 2394
2395 2395
2396 #define TYPED_DATA_WRITE(type) \ 2396 #define TYPED_DATA_WRITE(type) \
2397 { \ 2397 { \
2398 type* data = reinterpret_cast<type*>(ptr()->data_); \ 2398 type* data = reinterpret_cast<type*>(ptr()->data_); \
2399 for (intptr_t i = 0; i < len; i++) { \ 2399 for (intptr_t i = 0; i < len; i++) { \
2400 writer->Write(data[i]); \ 2400 writer->Write(data[i]); \
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 // We do not allow objects with native fields in an isolate message. 2783 // We do not allow objects with native fields in an isolate message.
2784 writer->SetWriteException(Exceptions::kArgument, 2784 writer->SetWriteException(Exceptions::kArgument,
2785 "Illegal argument in isolate message" 2785 "Illegal argument in isolate message"
2786 " : (object is a UserTag)"); 2786 " : (object is a UserTag)");
2787 } else { 2787 } else {
2788 UNREACHABLE(); 2788 UNREACHABLE();
2789 } 2789 }
2790 } 2790 }
2791 2791
2792 } // namespace dart 2792 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698