Index: src/snapshot/serialize.h |
diff --git a/src/snapshot/serialize.h b/src/snapshot/serialize.h |
index 341338515672e98515aa315c9e2c5aa620db4b75..156aaf726a3b13449b8ef2b8569ea0f364b7ac8b 100644 |
--- a/src/snapshot/serialize.h |
+++ b/src/snapshot/serialize.h |
@@ -548,6 +548,23 @@ class Deserializer: public SerializerDeserializer { |
} |
private: |
+ class NewInternalizedStrings : public Relocatable { |
+ public: |
+ explicit NewInternalizedStrings(Isolate* isolate) : Relocatable(isolate) {} |
+ |
+ virtual void IterateInstance(ObjectVisitor* v) { |
+ Object** start = reinterpret_cast<Object**>(&strings_[0]); |
+ v->VisitPointers(start, start + strings_.length()); |
+ } |
+ |
+ void Add(String* string) { strings_.Add(string); } |
+ |
+ void Commit(Isolate* isolate); |
+ |
+ private: |
+ List<String*> strings_; |
+ }; |
+ |
virtual void VisitPointers(Object** start, Object** end); |
virtual void VisitRuntimeEntry(RelocInfo* rinfo) { |
@@ -606,6 +623,7 @@ class Deserializer: public SerializerDeserializer { |
List<HeapObject*> deserialized_large_objects_; |
List<Code*> new_code_objects_; |
+ NewInternalizedStrings* new_internalized_strings_; |
bool deserializing_user_code_; |
@@ -909,15 +927,11 @@ class CodeSerializer : public Serializer { |
} |
const List<uint32_t>* stub_keys() const { return &stub_keys_; } |
- int num_internalized_strings() const { return num_internalized_strings_; } |
private: |
CodeSerializer(Isolate* isolate, SnapshotByteSink* sink, String* source, |
Code* main_code) |
- : Serializer(isolate, sink), |
- source_(source), |
- main_code_(main_code), |
- num_internalized_strings_(0) { |
+ : Serializer(isolate, sink), source_(source), main_code_(main_code) { |
back_reference_map_.AddSourceString(source); |
} |
@@ -939,7 +953,6 @@ class CodeSerializer : public Serializer { |
DisallowHeapAllocation no_gc_; |
String* source_; |
Code* main_code_; |
- int num_internalized_strings_; |
List<uint32_t> stub_keys_; |
DISALLOW_COPY_AND_ASSIGN(CodeSerializer); |
}; |
@@ -998,7 +1011,6 @@ class SerializedCodeData : public SerializedData { |
Vector<const Reservation> Reservations() const; |
Vector<const byte> Payload() const; |
- int NumInternalizedStrings() const; |
Vector<const uint32_t> CodeStubKeys() const; |
private: |
@@ -1019,17 +1031,16 @@ class SerializedCodeData : public SerializedData { |
uint32_t SourceHash(String* source) const { return source->length(); } |
// The data header consists of uint32_t-sized entries: |
- // [ 0] magic number and external reference count |
- // [ 1] version hash |
- // [ 2] source hash |
- // [ 3] cpu features |
- // [ 4] flag hash |
- // [ 5] number of internalized strings |
- // [ 6] number of code stub keys |
- // [ 7] number of reservation size entries |
- // [ 8] payload length |
- // [ 9] payload checksum part 1 |
- // [10] payload checksum part 2 |
+ // [0] magic number and external reference count |
+ // [1] version hash |
+ // [2] source hash |
+ // [3] cpu features |
+ // [4] flag hash |
+ // [5] number of code stub keys |
+ // [6] number of reservation size entries |
+ // [7] payload length |
+ // [8] payload checksum part 1 |
+ // [9] payload checksum part 2 |
// ... reservations |
// ... code stub keys |
// ... serialized payload |
@@ -1037,9 +1048,7 @@ class SerializedCodeData : public SerializedData { |
static const int kSourceHashOffset = kVersionHashOffset + kInt32Size; |
static const int kCpuFeaturesOffset = kSourceHashOffset + kInt32Size; |
static const int kFlagHashOffset = kCpuFeaturesOffset + kInt32Size; |
- static const int kNumInternalizedStringsOffset = kFlagHashOffset + kInt32Size; |
- static const int kNumReservationsOffset = |
- kNumInternalizedStringsOffset + kInt32Size; |
+ static const int kNumReservationsOffset = kFlagHashOffset + kInt32Size; |
static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; |
static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |