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

Side by Side Diff: src/serialize.h

Issue 1005183006: Serializer: serialize internal references via object visitor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/objects.h ('k') | src/serialize.cc » ('j') | src/serialize.cc » ('J')
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_SERIALIZE_H_ 5 #ifndef V8_SERIALIZE_H_
6 #define V8_SERIALIZE_H_ 6 #define V8_SERIALIZE_H_
7 7
8 #include "src/hashmap.h" 8 #include "src/hashmap.h"
9 #include "src/heap-profiler.h" 9 #include "src/heap-profiler.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 // No reservation for large object space necessary. 301 // No reservation for large object space necessary.
302 static const int kNumberOfPreallocatedSpaces = LO_SPACE; 302 static const int kNumberOfPreallocatedSpaces = LO_SPACE;
303 static const int kNumberOfSpaces = LAST_SPACE + 1; 303 static const int kNumberOfSpaces = LAST_SPACE + 1;
304 304
305 protected: 305 protected:
306 // Where the pointed-to object can be found: 306 // Where the pointed-to object can be found:
307 enum Where { 307 enum Where {
308 kNewObject = 0, // Object is next in snapshot. 308 kNewObject = 0, // Object is next in snapshot.
309 // 1-7 One per space. 309 // 1-7 One per space.
310 // 0x8 Unused. 310 // 0x8 Used by misc. See below.
311 kRootArray = 0x9, // Object is found in root array. 311 kRootArray = 0x9, // Object is found in root array.
312 kPartialSnapshotCache = 0xa, // Object is in the cache. 312 kPartialSnapshotCache = 0xa, // Object is in the cache.
313 kExternalReference = 0xb, // Pointer to an external reference. 313 kExternalReference = 0xb, // Pointer to an external reference.
314 kSkip = 0xc, // Skip n bytes. 314 kSkip = 0xc, // Skip n bytes.
315 kBuiltin = 0xd, // Builtin code object. 315 kBuiltin = 0xd, // Builtin code object.
316 kAttachedReference = 0xe, // Object is described in an attached list. 316 kAttachedReference = 0xe, // Object is described in an attached list.
317 // 0xf Used by misc. See below. 317 // 0xf Used by misc. See below.
318 kBackref = 0x10, // Object is described relative to end. 318 kBackref = 0x10, // Object is described relative to end.
319 // 0x11-0x17 One per space. 319 // 0x11-0x17 One per space.
320 kBackrefWithSkip = 0x18, // Object is described relative to end. 320 kBackrefWithSkip = 0x18, // Object is described relative to end.
(...skipping 27 matching lines...) Expand all
348 // Misc. 348 // Misc.
349 // Raw data to be copied from the snapshot. This byte code does not advance 349 // Raw data to be copied from the snapshot. This byte code does not advance
350 // the current pointer, which is used for code objects, where we write the 350 // the current pointer, which is used for code objects, where we write the
351 // entire code in one memcpy, then fix up stuff with kSkip and other byte 351 // entire code in one memcpy, then fix up stuff with kSkip and other byte
352 // codes that overwrite data. 352 // codes that overwrite data.
353 static const int kRawData = 0x20; 353 static const int kRawData = 0x20;
354 // Some common raw lengths: 0x21-0x3f. 354 // Some common raw lengths: 0x21-0x3f.
355 // These autoadvance the current pointer. 355 // These autoadvance the current pointer.
356 static const int kOnePointerRawData = 0x21; 356 static const int kOnePointerRawData = 0x21;
357 357
358 // Internal reference encoded as relative offset.
359 static const int kInternalReference = 0x08;
360
361 // 0x48, 0x88 and 0xc8 are unused.
362
358 static const int kVariableRepeat = 0x60; 363 static const int kVariableRepeat = 0x60;
359 // 0x61-0x6f Repeat last word 364 // 0x61-0x6f Repeat last word
360 static const int kFixedRepeat = 0x61; 365 static const int kFixedRepeat = 0x61;
361 static const int kFixedRepeatBase = kFixedRepeat - 1; 366 static const int kFixedRepeatBase = kFixedRepeat - 1;
362 static const int kLastFixedRepeat = 0x6f; 367 static const int kLastFixedRepeat = 0x6f;
363 static const int kMaxFixedRepeats = kLastFixedRepeat - kFixedRepeatBase; 368 static const int kMaxFixedRepeats = kLastFixedRepeat - kFixedRepeatBase;
364 static int CodeForRepeats(int repeats) { 369 static int CodeForRepeats(int repeats) {
365 DCHECK(repeats >= 1 && repeats <= kMaxFixedRepeats); 370 DCHECK(repeats >= 1 && repeats <= kMaxFixedRepeats);
366 return kFixedRepeatBase + repeats; 371 return kFixedRepeatBase + repeats;
367 } 372 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 sink_(sink), 624 sink_(sink),
620 reference_representation_(how_to_code + where_to_point), 625 reference_representation_(how_to_code + where_to_point),
621 bytes_processed_so_far_(0), 626 bytes_processed_so_far_(0),
622 code_object_(o->IsCode()), 627 code_object_(o->IsCode()),
623 code_has_been_output_(false) { } 628 code_has_been_output_(false) { }
624 void Serialize(); 629 void Serialize();
625 void VisitPointers(Object** start, Object** end); 630 void VisitPointers(Object** start, Object** end);
626 void VisitEmbeddedPointer(RelocInfo* target); 631 void VisitEmbeddedPointer(RelocInfo* target);
627 void VisitExternalReference(Address* p); 632 void VisitExternalReference(Address* p);
628 void VisitExternalReference(RelocInfo* rinfo); 633 void VisitExternalReference(RelocInfo* rinfo);
634 void VisitInternalReference(RelocInfo* rinfo);
629 void VisitCodeTarget(RelocInfo* target); 635 void VisitCodeTarget(RelocInfo* target);
630 void VisitCodeEntry(Address entry_address); 636 void VisitCodeEntry(Address entry_address);
631 void VisitCell(RelocInfo* rinfo); 637 void VisitCell(RelocInfo* rinfo);
632 void VisitRuntimeEntry(RelocInfo* reloc); 638 void VisitRuntimeEntry(RelocInfo* reloc);
633 // Used for seralizing the external strings that hold the natives source. 639 // Used for seralizing the external strings that hold the natives source.
634 void VisitExternalOneByteString( 640 void VisitExternalOneByteString(
635 v8::String::ExternalOneByteStringResource** resource); 641 v8::String::ExternalOneByteStringResource** resource);
636 // We can't serialize a heap with external two byte strings. 642 // We can't serialize a heap with external two byte strings.
637 void VisitExternalTwoByteString( 643 void VisitExternalTwoByteString(
638 v8::String::ExternalStringResource** resource) { 644 v8::String::ExternalStringResource** resource) {
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 kNumInternalizedStringsOffset + kInt32Size; 975 kNumInternalizedStringsOffset + kInt32Size;
970 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; 976 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size;
971 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; 977 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size;
972 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; 978 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size;
973 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; 979 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size;
974 static const int kHeaderSize = kChecksum2Offset + kInt32Size; 980 static const int kHeaderSize = kChecksum2Offset + kInt32Size;
975 }; 981 };
976 } } // namespace v8::internal 982 } } // namespace v8::internal
977 983
978 #endif // V8_SERIALIZE_H_ 984 #endif // V8_SERIALIZE_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/serialize.cc » ('j') | src/serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698