Fix crash in partial snapshot test when running with no boot snapshot.
authorerik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 24 Oct 2011 12:39:29 +0000 (12:39 +0000)
committererik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 24 Oct 2011 12:39:29 +0000 (12:39 +0000)
Review URL: http://codereview.chromium.org/8381003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9755 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/serialize.cc

index a48e119..dad2c2b 100644 (file)
@@ -757,7 +757,7 @@ static const int kUnknownOffsetFromStart = -1;
 void Deserializer::ReadChunk(Object** current,
                              Object** limit,
                              int source_space,
-                             Address address) {
+                             Address current_object_address) {
   Isolate* const isolate = isolate_;
   while (current < limit) {
     int data = source_->Get();
@@ -845,9 +845,11 @@ void Deserializer::ReadChunk(Object** current,
             *current = new_object;                                             \
           }                                                                    \
         }                                                                      \
-        if (emit_write_barrier) {                                              \
-          isolate->heap()->RecordWrite(address, static_cast<int>(              \
-              reinterpret_cast<Address>(current) - address));                  \
+        if (emit_write_barrier && current_object_address != NULL) {            \
+          Address current_address = reinterpret_cast<Address>(current);        \
+          isolate->heap()->RecordWrite(                                        \
+              current_object_address,                                          \
+              static_cast<int>(current_address - current_object_address));     \
         }                                                                      \
         if (!current_was_incremented) {                                        \
           current++;   /* Increment current if it wasn't done above. */        \