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

Side by Side Diff: src/snapshot/serialize.h

Issue 1268333004: Introduce object visitor to estimate the size of a native context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compare Created 5 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 | « src/context-measure.cc ('k') | test/cctest/test-api.cc » ('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 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_SNAPSHOT_SERIALIZE_H_ 5 #ifndef V8_SNAPSHOT_SERIALIZE_H_
6 #define V8_SNAPSHOT_SERIALIZE_H_ 6 #define V8_SNAPSHOT_SERIALIZE_H_
7 7
8 #include "src/hashmap.h" 8 #include "src/hashmap.h"
9 #include "src/heap-profiler.h"
10 #include "src/isolate.h" 9 #include "src/isolate.h"
11 #include "src/snapshot/snapshot-source-sink.h" 10 #include "src/snapshot/snapshot-source-sink.h"
12 11
13 namespace v8 { 12 namespace v8 {
14 namespace internal { 13 namespace internal {
15 14
16 class ScriptData; 15 class ScriptData;
17 16
18 static const int kDeoptTableSerializeEntryCount = 64; 17 static const int kDeoptTableSerializeEntryCount = 64;
19 18
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 148
150 static BackReference GlobalProxyReference() { 149 static BackReference GlobalProxyReference() {
151 return BackReference(kGlobalProxyValue); 150 return BackReference(kGlobalProxyValue);
152 } 151 }
153 152
154 static BackReference LargeObjectReference(uint32_t index) { 153 static BackReference LargeObjectReference(uint32_t index) {
155 return BackReference(SpaceBits::encode(LO_SPACE) | 154 return BackReference(SpaceBits::encode(LO_SPACE) |
156 ChunkOffsetBits::encode(index)); 155 ChunkOffsetBits::encode(index));
157 } 156 }
158 157
158 static BackReference DummyReference() { return BackReference(kDummyValue); }
159
159 static BackReference Reference(AllocationSpace space, uint32_t chunk_index, 160 static BackReference Reference(AllocationSpace space, uint32_t chunk_index,
160 uint32_t chunk_offset) { 161 uint32_t chunk_offset) {
161 DCHECK(IsAligned(chunk_offset, kObjectAlignment)); 162 DCHECK(IsAligned(chunk_offset, kObjectAlignment));
162 DCHECK_NE(LO_SPACE, space); 163 DCHECK_NE(LO_SPACE, space);
163 return BackReference( 164 return BackReference(
164 SpaceBits::encode(space) | ChunkIndexBits::encode(chunk_index) | 165 SpaceBits::encode(space) | ChunkIndexBits::encode(chunk_index) |
165 ChunkOffsetBits::encode(chunk_offset >> kObjectAlignmentBits)); 166 ChunkOffsetBits::encode(chunk_offset >> kObjectAlignmentBits));
166 } 167 }
167 168
168 bool is_valid() const { return bitfield_ != kInvalidValue; } 169 bool is_valid() const { return bitfield_ != kInvalidValue; }
(...skipping 25 matching lines...) Expand all
194 DCHECK(is_valid()); 195 DCHECK(is_valid());
195 return bitfield_ & (ChunkOffsetBits::kMask | ChunkIndexBits::kMask); 196 return bitfield_ & (ChunkOffsetBits::kMask | ChunkIndexBits::kMask);
196 } 197 }
197 198
198 uint32_t bitfield() const { return bitfield_; } 199 uint32_t bitfield() const { return bitfield_; }
199 200
200 private: 201 private:
201 static const uint32_t kInvalidValue = 0xFFFFFFFF; 202 static const uint32_t kInvalidValue = 0xFFFFFFFF;
202 static const uint32_t kSourceValue = 0xFFFFFFFE; 203 static const uint32_t kSourceValue = 0xFFFFFFFE;
203 static const uint32_t kGlobalProxyValue = 0xFFFFFFFD; 204 static const uint32_t kGlobalProxyValue = 0xFFFFFFFD;
205 static const uint32_t kDummyValue = 0xFFFFFFFC;
204 static const int kChunkOffsetSize = kPageSizeBits - kObjectAlignmentBits; 206 static const int kChunkOffsetSize = kPageSizeBits - kObjectAlignmentBits;
205 static const int kChunkIndexSize = 32 - kChunkOffsetSize - kSpaceTagSize; 207 static const int kChunkIndexSize = 32 - kChunkOffsetSize - kSpaceTagSize;
206 208
207 public: 209 public:
208 static const int kMaxChunkIndex = (1 << kChunkIndexSize) - 1; 210 static const int kMaxChunkIndex = (1 << kChunkIndexSize) - 1;
209 211
210 private: 212 private:
211 class ChunkOffsetBits : public BitField<uint32_t, 0, kChunkOffsetSize> {}; 213 class ChunkOffsetBits : public BitField<uint32_t, 0, kChunkOffsetSize> {};
212 class ChunkIndexBits 214 class ChunkIndexBits
213 : public BitField<uint32_t, ChunkOffsetBits::kNext, kChunkIndexSize> {}; 215 : public BitField<uint32_t, ChunkOffsetBits::kNext, kChunkIndexSize> {};
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 static const int kNumReservationsOffset = kFlagHashOffset + kInt32Size; 1049 static const int kNumReservationsOffset = kFlagHashOffset + kInt32Size;
1048 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; 1050 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size;
1049 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; 1051 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size;
1050 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; 1052 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size;
1051 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; 1053 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size;
1052 static const int kHeaderSize = kChecksum2Offset + kInt32Size; 1054 static const int kHeaderSize = kChecksum2Offset + kInt32Size;
1053 }; 1055 };
1054 } } // namespace v8::internal 1056 } } // namespace v8::internal
1055 1057
1056 #endif // V8_SNAPSHOT_SERIALIZE_H_ 1058 #endif // V8_SNAPSHOT_SERIALIZE_H_
OLDNEW
« no previous file with comments | « src/context-measure.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698