| Index: src/serialize.h
|
| diff --git a/src/serialize.h b/src/serialize.h
|
| index 3766801f0bb53676dd30bee135b79be99c50cae2..ae6446270b0870aeb3ce062fb8db9bb354f07dbc 100644
|
| --- a/src/serialize.h
|
| +++ b/src/serialize.h
|
| @@ -189,16 +189,26 @@ class BackReference {
|
| public:
|
| explicit BackReference(uint32_t bitfield) : bitfield_(bitfield) {}
|
|
|
| - BackReference(AllocationSpace space, uint32_t chunk_index,
|
| - uint32_t chunk_offset) {
|
| - DCHECK(IsAligned(chunk_offset, kObjectAlignment));
|
| - bitfield_ = SpaceBits::encode(space) | ChunkIndexBits::encode(chunk_index) |
|
| - ChunkOffsetBits::encode(chunk_offset >> kObjectAlignmentBits);
|
| + BackReference() : bitfield_(kInvalidValue) {}
|
| +
|
| + static BackReference SourceReference() { return BackReference(kSourceValue); }
|
| +
|
| + static BackReference LargeObjectReference(uint32_t index) {
|
| + return BackReference(SpaceBits::encode(LO_SPACE) |
|
| + ChunkOffsetBits::encode(index));
|
| }
|
|
|
| - BackReference() : bitfield_(kInvalidValue) {}
|
| + static BackReference Reference(AllocationSpace space, uint32_t chunk_index,
|
| + uint32_t chunk_offset) {
|
| + DCHECK(IsAligned(chunk_offset, kObjectAlignment));
|
| + DCHECK_NE(LO_SPACE, space);
|
| + return BackReference(
|
| + SpaceBits::encode(space) | ChunkIndexBits::encode(chunk_index) |
|
| + ChunkOffsetBits::encode(chunk_offset >> kObjectAlignmentBits));
|
| + }
|
|
|
| bool is_valid() const { return bitfield_ != kInvalidValue; }
|
| + bool is_source() const { return bitfield_ == kSourceValue; }
|
|
|
| AllocationSpace space() const {
|
| DCHECK(is_valid());
|
| @@ -224,6 +234,7 @@ class BackReference {
|
|
|
| private:
|
| static const uint32_t kInvalidValue = 0xFFFFFFFF;
|
| + static const uint32_t kSourceValue = 0xFFFFFFFE;
|
| static const int kChunkOffsetSize = kPageSizeBits - kObjectAlignmentBits;
|
| static const int kChunkIndexSize = 32 - kChunkOffsetSize - kSpaceTagSize;
|
|
|
| @@ -263,6 +274,10 @@ class BackReferenceMap : public AddressMapBase {
|
| SetValue(entry, b.bitfield());
|
| }
|
|
|
| + void AddSourceString(String* string) {
|
| + Add(string, BackReference::SourceReference());
|
| + }
|
| +
|
| private:
|
| DisallowHeapAllocation no_allocation_;
|
| HashMap* map_;
|
| @@ -700,7 +715,9 @@ class CodeSerializer : public Serializer {
|
| : Serializer(isolate, sink),
|
| source_(source),
|
| main_code_(main_code),
|
| - num_internalized_strings_(0) {}
|
| + num_internalized_strings_(0) {
|
| + back_reference_map_.AddSourceString(source);
|
| + }
|
|
|
| virtual void SerializeObject(HeapObject* o, HowToCode how_to_code,
|
| WhereToPoint where_to_point, int skip);
|
|
|