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

Unified Diff: src/snapshot/partial-serializer.h

Issue 1751863002: [serializer] split up src/snapshot/serialize.* (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 10 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
Index: src/snapshot/partial-serializer.h
diff --git a/src/snapshot/partial-serializer.h b/src/snapshot/partial-serializer.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ce5cb31658d2a3acea683cc41a9cb076b689e63
--- /dev/null
+++ b/src/snapshot/partial-serializer.h
@@ -0,0 +1,61 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
+#define V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
+
+#include "src/address-map.h"
+#include "src/snapshot/serializer.h"
+
+namespace v8 {
+namespace internal {
+
+class PartialSerializer : public Serializer {
+ public:
+ PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer,
+ SnapshotByteSink* sink);
+
+ ~PartialSerializer() override;
+
+ // Serialize the objects reachable from a single object pointer.
+ void Serialize(Object** o);
+
+ private:
+ class PartialCacheIndexMap : public AddressMapBase {
+ public:
+ PartialCacheIndexMap() : map_(HashMap::PointersMatch) {}
+
+ static const int kInvalidIndex = -1;
+
+ // Lookup object in the map. Return its index if found, or create
+ // a new entry with new_index as value, and return kInvalidIndex.
+ int LookupOrInsert(HeapObject* obj, int new_index) {
+ HashMap::Entry* entry = LookupEntry(&map_, obj, false);
+ if (entry != NULL) return GetValue(entry);
+ SetValue(LookupEntry(&map_, obj, true), static_cast<uint32_t>(new_index));
+ return kInvalidIndex;
+ }
+
+ private:
+ HashMap map_;
+
+ DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap);
+ };
+
+ void SerializeObject(HeapObject* o, HowToCode how_to_code,
+ WhereToPoint where_to_point, int skip) override;
+
+ int PartialSnapshotCacheIndex(HeapObject* o);
+ bool ShouldBeInThePartialSnapshotCache(HeapObject* o);
+
+ Serializer* startup_serializer_;
+ Object* global_object_;
+ PartialCacheIndexMap partial_cache_index_map_;
+ DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_SNAPSHOT_PARTIAL_SERIALIZER_H_

Powered by Google App Engine
This is Rietveld 408576698