Index: src/snapshot/serializer-common.h |
diff --git a/src/snapshot/serializer-common.h b/src/snapshot/serializer-common.h |
index b426efd538e99384dea8f8088ee61094b154752e..b4bcf7ff73471de20bf4af61bdb0744847e62420 100644 |
--- a/src/snapshot/serializer-common.h |
+++ b/src/snapshot/serializer-common.h |
@@ -245,14 +245,26 @@ class SerializedData { |
} |
uint32_t GetMagicNumber() const { return GetHeaderValue(kMagicNumberOffset); } |
+ uint32_t GetExtraReferences() const { |
+ return GetHeaderValue(kExtraExternalReferencesOffset); |
+ } |
class ChunkSizeBits : public BitField<uint32_t, 0, 31> {}; |
class IsLastChunkBits : public BitField<bool, 31, 1> {}; |
static uint32_t ComputeMagicNumber(ExternalReferenceTable* table) { |
- uint32_t external_refs = table->size(); |
+ uint32_t external_refs = table->size() - table->num_api_references(); |
return 0xC0DE0000 ^ external_refs; |
} |
+ static uint32_t GetExtraReferences(ExternalReferenceTable* table) { |
+ return table->num_api_references(); |
+ } |
+ |
+ static const int kMagicNumberOffset = 0; |
+ static const int kExtraExternalReferencesOffset = |
+ kMagicNumberOffset + kInt32Size; |
+ static const int kVersionHashOffset = |
+ kExtraExternalReferencesOffset + kInt32Size; |
protected: |
void SetHeaderValue(int offset, uint32_t value) { |
@@ -271,13 +283,15 @@ class SerializedData { |
static uint32_t ComputeMagicNumber(Isolate* isolate) { |
return ComputeMagicNumber(ExternalReferenceTable::instance(isolate)); |
} |
+ static uint32_t GetExtraReferences(Isolate* isolate) { |
+ return GetExtraReferences(ExternalReferenceTable::instance(isolate)); |
+ } |
void SetMagicNumber(Isolate* isolate) { |
SetHeaderValue(kMagicNumberOffset, ComputeMagicNumber(isolate)); |
+ SetHeaderValue(kExtraExternalReferencesOffset, GetExtraReferences(isolate)); |
} |
- static const int kMagicNumberOffset = 0; |
- |
byte* data_; |
int size_; |
bool owns_data_; |