| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
| 6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
| 7 | 7 |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
| 10 #include "src/heap-profiler.h" | 10 #include "src/heap-profiler.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 AllocationSpace space() const { | 218 AllocationSpace space() const { |
| 219 DCHECK(is_valid()); | 219 DCHECK(is_valid()); |
| 220 return SpaceBits::decode(bitfield_); | 220 return SpaceBits::decode(bitfield_); |
| 221 } | 221 } |
| 222 | 222 |
| 223 uint32_t chunk_offset() const { | 223 uint32_t chunk_offset() const { |
| 224 DCHECK(is_valid()); | 224 DCHECK(is_valid()); |
| 225 return ChunkOffsetBits::decode(bitfield_) << kObjectAlignmentBits; | 225 return ChunkOffsetBits::decode(bitfield_) << kObjectAlignmentBits; |
| 226 } | 226 } |
| 227 | 227 |
| 228 uint32_t large_object_index() const { |
| 229 DCHECK(is_valid()); |
| 230 DCHECK(chunk_index() == 0); |
| 231 return ChunkOffsetBits::decode(bitfield_); |
| 232 } |
| 233 |
| 228 uint32_t chunk_index() const { | 234 uint32_t chunk_index() const { |
| 229 DCHECK(is_valid()); | 235 DCHECK(is_valid()); |
| 230 return ChunkIndexBits::decode(bitfield_); | 236 return ChunkIndexBits::decode(bitfield_); |
| 231 } | 237 } |
| 232 | 238 |
| 233 uint32_t reference() const { | 239 uint32_t reference() const { |
| 234 DCHECK(is_valid()); | 240 DCHECK(is_valid()); |
| 235 return bitfield_ & (ChunkOffsetBits::kMask | ChunkIndexBits::kMask); | 241 return bitfield_ & (ChunkOffsetBits::kMask | ChunkIndexBits::kMask); |
| 236 } | 242 } |
| 237 | 243 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 bool SerializeKnownObject(HeapObject* obj, HowToCode how_to_code, | 698 bool SerializeKnownObject(HeapObject* obj, HowToCode how_to_code, |
| 693 WhereToPoint where_to_point, int skip); | 699 WhereToPoint where_to_point, int skip); |
| 694 | 700 |
| 695 inline void FlushSkip(int skip) { | 701 inline void FlushSkip(int skip) { |
| 696 if (skip != 0) { | 702 if (skip != 0) { |
| 697 sink_->Put(kSkip, "SkipFromSerializeObject"); | 703 sink_->Put(kSkip, "SkipFromSerializeObject"); |
| 698 sink_->PutInt(skip, "SkipDistanceFromSerializeObject"); | 704 sink_->PutInt(skip, "SkipDistanceFromSerializeObject"); |
| 699 } | 705 } |
| 700 } | 706 } |
| 701 | 707 |
| 702 void InitializeAllocators(); | 708 bool BackReferenceIsAlreadyAllocated(BackReference back_reference); |
| 709 |
| 703 // This will return the space for an object. | 710 // This will return the space for an object. |
| 704 static AllocationSpace SpaceOfObject(HeapObject* object); | 711 static AllocationSpace SpaceOfObject(HeapObject* object); |
| 705 BackReference AllocateLargeObject(int size); | 712 BackReference AllocateLargeObject(int size); |
| 706 BackReference Allocate(AllocationSpace space, int size); | 713 BackReference Allocate(AllocationSpace space, int size); |
| 707 int EncodeExternalReference(Address addr) { | 714 int EncodeExternalReference(Address addr) { |
| 708 return external_reference_encoder_->Encode(addr); | 715 return external_reference_encoder_->Encode(addr); |
| 709 } | 716 } |
| 710 | 717 |
| 711 // GetInt reads 4 bytes at once, requiring padding at the end. | 718 // GetInt reads 4 bytes at once, requiring padding at the end. |
| 712 void Pad(); | 719 void Pad(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 static const int kFlagHashOffset = 3; | 972 static const int kFlagHashOffset = 3; |
| 966 static const int kNumInternalizedStringsOffset = 4; | 973 static const int kNumInternalizedStringsOffset = 4; |
| 967 static const int kReservationsOffset = 5; | 974 static const int kReservationsOffset = 5; |
| 968 static const int kNumCodeStubKeysOffset = 6; | 975 static const int kNumCodeStubKeysOffset = 6; |
| 969 static const int kPayloadLengthOffset = 7; | 976 static const int kPayloadLengthOffset = 7; |
| 970 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; | 977 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; |
| 971 }; | 978 }; |
| 972 } } // namespace v8::internal | 979 } } // namespace v8::internal |
| 973 | 980 |
| 974 #endif // V8_SERIALIZE_H_ | 981 #endif // V8_SERIALIZE_H_ |
| OLD | NEW |