Index: src/snapshot/code-serializer.cc |
diff --git a/src/snapshot/code-serializer.cc b/src/snapshot/code-serializer.cc |
index 601659a1490aed7c8805c6b3f0a37b8095224559..8d2f5d933994cbab63e6451973137fe11c50496a 100644 |
--- a/src/snapshot/code-serializer.cc |
+++ b/src/snapshot/code-serializer.cc |
@@ -315,10 +315,6 @@ SerializedCodeData::SerializedCodeData(const List<byte>* payload, |
SetHeaderValue(kNumCodeStubKeysOffset, num_stub_keys); |
SetHeaderValue(kPayloadLengthOffset, payload->length()); |
- Checksum checksum(payload->ToConstVector()); |
- SetHeaderValue(kChecksum1Offset, checksum.a()); |
- SetHeaderValue(kChecksum2Offset, checksum.b()); |
- |
// Copy reservation chunk sizes. |
CopyBytes(data_ + kHeaderSize, reinterpret_cast<byte*>(reservations.begin()), |
reservation_size); |
@@ -332,6 +328,10 @@ SerializedCodeData::SerializedCodeData(const List<byte>* payload, |
// Copy serialized data. |
CopyBytes(data_ + padded_payload_offset, payload->begin(), |
static_cast<size_t>(payload->length())); |
+ |
+ Checksum checksum(DataWithoutHeader()); |
+ SetHeaderValue(kChecksum1Offset, checksum.a()); |
+ SetHeaderValue(kChecksum2Offset, checksum.b()); |
} |
SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck( |
@@ -350,7 +350,7 @@ SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck( |
return CPU_FEATURES_MISMATCH; |
} |
if (flags_hash != FlagList::Hash()) return FLAGS_MISMATCH; |
- if (!Checksum(Payload()).Check(c1, c2)) return CHECKSUM_MISMATCH; |
+ if (!Checksum(DataWithoutHeader()).Check(c1, c2)) return CHECKSUM_MISMATCH; |
return CHECK_SUCCESS; |
} |