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

Side by Side Diff: vm/snapshot.cc

Issue 9835074: Fix for issue 2233 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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 | « vm/snapshot.h ('k') | vm/snapshot_test.cc » ('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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h"
8 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
9 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
10 #include "vm/heap.h" 11 #include "vm/heap.h"
11 #include "vm/object.h" 12 #include "vm/object.h"
12 #include "vm/object_store.h" 13 #include "vm/object_store.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 enum { 17 enum {
17 kInstanceId = ObjectStore::kMaxId, 18 kInstanceId = ObjectStore::kMaxId,
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 ASSERT(kind_ == Snapshot::kFull); 237 ASSERT(kind_ == Snapshot::kFull);
237 ASSERT(isolate()->no_gc_scope_depth() != 0); 238 ASSERT(isolate()->no_gc_scope_depth() != 0);
238 cls_ = object_store()->mint_class(); 239 cls_ = object_store()->mint_class();
239 RawMint* obj = reinterpret_cast<RawMint*>( 240 RawMint* obj = reinterpret_cast<RawMint*>(
240 AllocateUninitialized(cls_, Mint::InstanceSize())); 241 AllocateUninitialized(cls_, Mint::InstanceSize()));
241 obj->ptr()->value_ = value; 242 obj->ptr()->value_ = value;
242 return obj; 243 return obj;
243 } 244 }
244 245
245 246
247 RawBigint* SnapshotReader::NewBigint(const char* hex_string) {
248 ASSERT(kind_ == Snapshot::kFull);
249 ASSERT(isolate()->no_gc_scope_depth() != 0);
250 cls_ = object_store()->bigint_class();
251 intptr_t bigint_length = BigintOperations::ComputeChunkLength(hex_string);
252 const Bigint& result = Bigint::Handle(reinterpret_cast<RawBigint*>(
253 AllocateUninitialized(cls_, Bigint::InstanceSize(bigint_length))));
254 BigintOperations::FromHexCString(hex_string, result);
255 return result.raw();
256 }
257
258
246 RawDouble* SnapshotReader::NewDouble(double value) { 259 RawDouble* SnapshotReader::NewDouble(double value) {
247 ASSERT(kind_ == Snapshot::kFull); 260 ASSERT(kind_ == Snapshot::kFull);
248 ASSERT(isolate()->no_gc_scope_depth() != 0); 261 ASSERT(isolate()->no_gc_scope_depth() != 0);
249 cls_ = object_store()->double_class(); 262 cls_ = object_store()->double_class();
250 RawDouble* obj = reinterpret_cast<RawDouble*>( 263 RawDouble* obj = reinterpret_cast<RawDouble*>(
251 AllocateUninitialized(cls_, Double::InstanceSize())); 264 AllocateUninitialized(cls_, Double::InstanceSize()));
252 obj->ptr()->value_ = value; 265 obj->ptr()->value_ = value;
253 return obj; 266 return obj;
254 } 267 }
255 268
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 671
659 672
660 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { 673 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
661 for (RawObject** current = first; current <= last; current++) { 674 for (RawObject** current = first; current <= last; current++) {
662 RawObject* raw_obj = *current; 675 RawObject* raw_obj = *current;
663 writer_->WriteObject(raw_obj); 676 writer_->WriteObject(raw_obj);
664 } 677 }
665 } 678 }
666 679
667 } // namespace dart 680 } // namespace dart
OLDNEW
« no previous file with comments | « vm/snapshot.h ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698