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

Unified Diff: src/serialize.h

Issue 341079: * Do a GC in mksnapshot to get rid of some extraneous junk.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « src/objects.h ('k') | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.h
===================================================================
--- src/serialize.h (revision 3184)
+++ src/serialize.h (working copy)
@@ -396,27 +396,57 @@
int position_;
};
+// It is very common to have a reference to the object at word 10 in space 2,
+// the object at word 5 in space 2 and the object at word 28 in space 4. This
+// only works for objects in the first page of a space
+#define COMMON_REFERENCE_PATTERNS(f) \
+ f(kNumberOfSpaces, 2, 10) \
+ f(kNumberOfSpaces + 1, 2, 5) \
+ f(kNumberOfSpaces + 2, 4, 28) \
+ f(kNumberOfSpaces + 3, 2, 21) \
+ f(kNumberOfSpaces + 4, 2, 98) \
+ f(kNumberOfSpaces + 5, 2, 67) \
+ f(kNumberOfSpaces + 6, 4, 132)
+#define COMMON_RAW_LENGTHS(f) \
+ f(1, 1) \
+ f(2, 2) \
+ f(3, 3) \
+ f(4, 4) \
+ f(5, 5) \
+ f(6, 6) \
+ f(7, 7) \
+ f(8, 8) \
+ f(9, 12) \
+ f(10, 16) \
+ f(11, 20) \
+ f(12, 24) \
+ f(13, 28) \
+ f(14, 32) \
+ f(15, 36)
+
// The SerDes class is a common superclass for Serializer2 and Deserializer2
// which is used to store common constants and methods used by both.
// TODO(erikcorry): This should inherit from ObjectVisitor.
class SerDes: public GenericDeserializer {
protected:
enum DataType {
- SMI_SERIALIZATION,
- RAW_DATA_SERIALIZATION,
- OBJECT_SERIALIZATION,
- CODE_OBJECT_SERIALIZATION,
- BACKREF_SERIALIZATION,
- CODE_BACKREF_SERIALIZATION,
- EXTERNAL_REFERENCE_SERIALIZATION,
- EXTERNAL_BRANCH_TARGET_SERIALIZATION,
- SYNCHRONIZE
+ RAW_DATA_SERIALIZATION = 0, // And 15 common raw lengths.
+ OBJECT_SERIALIZATION = 16, // One variant per space.
+ CODE_OBJECT_SERIALIZATION = 25, // One per space (only code spaces in use).
+ EXTERNAL_REFERENCE_SERIALIZATION = 34,
+ EXTERNAL_BRANCH_TARGET_SERIALIZATION = 35,
+ SYNCHRONIZE = 36,
+ START_NEW_PAGE_SERIALIZATION = 37,
+ // Free: 38-47.
+ BACKREF_SERIALIZATION = 48, // One per space, must be 16 aligned.
+ // Free: 57-63.
+ REFERENCE_SERIALIZATION = 64, // One per space and common references.
+ CODE_BACKREF_SERIALIZATION = 80, // One per space, must be 16 aligned.
+ // Free: 89-95.
+ CODE_REFERENCE_SERIALIZATION = 96 // One per space, must be 16 aligned.
+ // Free: 105-255.
};
- // Our Smi encoding is much more efficient for small positive integers than it
- // is for negative numbers so we add a bias before encoding and subtract it
- // after encoding so that popular small negative Smis are efficiently encoded.
- static const int kSmiBias = 16;
static const int kLargeData = LAST_SPACE;
static const int kLargeCode = kLargeData + 1;
static const int kLargeFixedArray = kLargeCode + 1;
@@ -456,18 +486,12 @@
UNREACHABLE();
}
- int CurrentAllocationAddress(int space) {
- // The three different kinds of large objects have different tags in the
- // snapshot so the deserializer knows which kind of object to allocate,
- // but they share a fullness_ entry.
- if (SpaceIsLarge(space)) space = LO_SPACE;
- return fullness_[space];
- }
+ void ReadChunk(Object** start, Object** end, int space, Address address);
+ HeapObject* GetAddressFromStart(int space);
+ inline HeapObject* GetAddressFromEnd(int space);
+ Address Allocate(int space_number, Space* space, int size);
+ void ReadObject(int space_number, Space* space, Object** write_back);
- HeapObject* GetAddress(int space);
- Address Allocate(int space, int size);
- bool ReadObject(Object** write_back);
-
// Keep track of the pages in the paged spaces.
// (In large object space we are keeping track of individual objects
// rather than pages.) In new space we just need the address of the
@@ -481,6 +505,8 @@
// just numbered sequentially since relative addresses make no
// sense in large object space.
int fullness_[LAST_SPACE + 1];
+ Address high_water_[LAST_SPACE + 1];
+ Address last_object_address_;
DISALLOW_COPY_AND_ASSIGN(Deserializer2);
};
@@ -550,7 +576,7 @@
// for all large objects since you can't check the type of the object
// once the map has been used for the serialization address.
static int SpaceOfAlreadySerializedObject(HeapObject* object);
- int Allocate(int space, int size);
+ int Allocate(int space, int size, bool* new_page_started);
int CurrentAllocationAddress(int space) {
if (SpaceIsLarge(space)) space = LO_SPACE;
return fullness_[space];
« no previous file with comments | « src/objects.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698