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

Side by Side Diff: src/address-map.h

Issue 2229583003: [serializer] reserve maps one by one to avoid fragmentation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix build Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_ADDRESS_MAP_H_ 5 #ifndef V8_ADDRESS_MAP_H_
6 #define V8_ADDRESS_MAP_H_ 6 #define V8_ADDRESS_MAP_H_
7 7
8 #include "src/assert-scope.h" 8 #include "src/assert-scope.h"
9 #include "src/base/hashmap.h" 9 #include "src/base/hashmap.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 static SerializerReference BackReference(AllocationSpace space, 70 static SerializerReference BackReference(AllocationSpace space,
71 uint32_t chunk_index, 71 uint32_t chunk_index,
72 uint32_t chunk_offset) { 72 uint32_t chunk_offset) {
73 DCHECK(IsAligned(chunk_offset, kObjectAlignment)); 73 DCHECK(IsAligned(chunk_offset, kObjectAlignment));
74 DCHECK_NE(LO_SPACE, space); 74 DCHECK_NE(LO_SPACE, space);
75 return SerializerReference( 75 return SerializerReference(
76 SpaceBits::encode(space) | ChunkIndexBits::encode(chunk_index) | 76 SpaceBits::encode(space) | ChunkIndexBits::encode(chunk_index) |
77 ChunkOffsetBits::encode(chunk_offset >> kObjectAlignmentBits)); 77 ChunkOffsetBits::encode(chunk_offset >> kObjectAlignmentBits));
78 } 78 }
79 79
80 static SerializerReference MapReference(uint32_t index) {
81 return SerializerReference(SpaceBits::encode(MAP_SPACE) |
82 ValueIndexBits::encode(index));
83 }
84
80 static SerializerReference LargeObjectReference(uint32_t index) { 85 static SerializerReference LargeObjectReference(uint32_t index) {
81 return SerializerReference(SpaceBits::encode(LO_SPACE) | 86 return SerializerReference(SpaceBits::encode(LO_SPACE) |
82 ValueIndexBits::encode(index)); 87 ValueIndexBits::encode(index));
83 } 88 }
84 89
85 static SerializerReference AttachedReference(uint32_t index) { 90 static SerializerReference AttachedReference(uint32_t index) {
86 return SerializerReference(SpaceBits::encode(kAttachedReferenceSpace) | 91 return SerializerReference(SpaceBits::encode(kAttachedReferenceSpace) |
87 ValueIndexBits::encode(index)); 92 ValueIndexBits::encode(index));
88 } 93 }
89 94
(...skipping 10 matching lines...) Expand all
100 AllocationSpace space() const { 105 AllocationSpace space() const {
101 DCHECK(is_back_reference()); 106 DCHECK(is_back_reference());
102 return static_cast<AllocationSpace>(SpaceBits::decode(bitfield_)); 107 return static_cast<AllocationSpace>(SpaceBits::decode(bitfield_));
103 } 108 }
104 109
105 uint32_t chunk_offset() const { 110 uint32_t chunk_offset() const {
106 DCHECK(is_back_reference()); 111 DCHECK(is_back_reference());
107 return ChunkOffsetBits::decode(bitfield_) << kObjectAlignmentBits; 112 return ChunkOffsetBits::decode(bitfield_) << kObjectAlignmentBits;
108 } 113 }
109 114
115 uint32_t map_index() const {
116 DCHECK(is_back_reference());
117 return ValueIndexBits::decode(bitfield_);
118 }
119
110 uint32_t large_object_index() const { 120 uint32_t large_object_index() const {
111 DCHECK(is_back_reference()); 121 DCHECK(is_back_reference());
112 DCHECK(chunk_index() == 0); 122 return ValueIndexBits::decode(bitfield_);
113 return ChunkOffsetBits::decode(bitfield_);
114 } 123 }
115 124
116 uint32_t chunk_index() const { 125 uint32_t chunk_index() const {
117 DCHECK(is_back_reference()); 126 DCHECK(is_back_reference());
118 return ChunkIndexBits::decode(bitfield_); 127 return ChunkIndexBits::decode(bitfield_);
119 } 128 }
120 129
121 uint32_t back_reference() const { 130 uint32_t back_reference() const {
122 DCHECK(is_back_reference()); 131 DCHECK(is_back_reference());
123 return bitfield_ & (ChunkOffsetBits::kMask | ChunkIndexBits::kMask); 132 return bitfield_ & (ChunkOffsetBits::kMask | ChunkIndexBits::kMask);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 DisallowHeapAllocation no_allocation_; 216 DisallowHeapAllocation no_allocation_;
208 base::HashMap map_; 217 base::HashMap map_;
209 int attached_reference_index_; 218 int attached_reference_index_;
210 DISALLOW_COPY_AND_ASSIGN(SerializerReferenceMap); 219 DISALLOW_COPY_AND_ASSIGN(SerializerReferenceMap);
211 }; 220 };
212 221
213 } // namespace internal 222 } // namespace internal
214 } // namespace v8 223 } // namespace v8
215 224
216 #endif // V8_ADDRESS_MAP_H_ 225 #endif // V8_ADDRESS_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698