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

Unified Diff: runtime/vm/snapshot.cc

Issue 10230001: Explicitly initialize Bigint members after uninitialized allocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: finish a rename Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index f4e69460b8f55acdf07f10c463f9d6a803823309..316df393de91ab0a4709c17cf9a2eaddeb2aa921 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -249,10 +249,12 @@ RawBigint* SnapshotReader::NewBigint(const char* hex_string) {
ASSERT(isolate()->no_gc_scope_depth() != 0);
cls_ = object_store()->bigint_class();
intptr_t bigint_length = BigintOperations::ComputeChunkLength(hex_string);
- const Bigint& result = Bigint::Handle(reinterpret_cast<RawBigint*>(
- AllocateUninitialized(cls_, Bigint::InstanceSize(bigint_length))));
- BigintOperations::FromHexCString(hex_string, result);
- return result.raw();
+ RawBigint* obj = reinterpret_cast<RawBigint*>(
+ AllocateUninitialized(cls_, Bigint::InstanceSize(bigint_length)));
+ obj->ptr()->allocated_length_ = bigint_length;
+ obj->ptr()->signed_length_ = bigint_length;
siva 2012/04/26 04:45:04 why not add a set_allocated_length() and set_signe
cshapiro 2012/04/26 06:34:53 Hmm... I tried to make the code look like the rest
siva 2012/04/26 17:17:44 Agree, I didn't realize we already had a NoGCScope
+ BigintOperations::FromHexCString(hex_string, Bigint::Handle(obj));
+ return obj;
}
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698