| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 RAW_DATA_SERIALIZATION = 0, | 434 RAW_DATA_SERIALIZATION = 0, |
| 435 // And 15 common raw lengths. | 435 // And 15 common raw lengths. |
| 436 OBJECT_SERIALIZATION = 16, | 436 OBJECT_SERIALIZATION = 16, |
| 437 // One variant per space. | 437 // One variant per space. |
| 438 CODE_OBJECT_SERIALIZATION = 25, | 438 CODE_OBJECT_SERIALIZATION = 25, |
| 439 // One per space (only code spaces in use). | 439 // One per space (only code spaces in use). |
| 440 EXTERNAL_REFERENCE_SERIALIZATION = 34, | 440 EXTERNAL_REFERENCE_SERIALIZATION = 34, |
| 441 EXTERNAL_BRANCH_TARGET_SERIALIZATION = 35, | 441 EXTERNAL_BRANCH_TARGET_SERIALIZATION = 35, |
| 442 SYNCHRONIZE = 36, | 442 SYNCHRONIZE = 36, |
| 443 START_NEW_PAGE_SERIALIZATION = 37, | 443 START_NEW_PAGE_SERIALIZATION = 37, |
| 444 // Free: 38-47. | 444 NATIVES_STRING_RESOURCE = 38, |
| 445 // Free: 39-47. |
| 445 BACKREF_SERIALIZATION = 48, | 446 BACKREF_SERIALIZATION = 48, |
| 446 // One per space, must be kSpaceMask aligned. | 447 // One per space, must be kSpaceMask aligned. |
| 447 // Free: 57-63. | 448 // Free: 57-63. |
| 448 REFERENCE_SERIALIZATION = 64, | 449 REFERENCE_SERIALIZATION = 64, |
| 449 // One per space and common references. Must be kSpaceMask aligned. | 450 // One per space and common references. Must be kSpaceMask aligned. |
| 450 CODE_BACKREF_SERIALIZATION = 80, | 451 CODE_BACKREF_SERIALIZATION = 80, |
| 451 // One per space, must be kSpaceMask aligned. | 452 // One per space, must be kSpaceMask aligned. |
| 452 // Free: 89-95. | 453 // Free: 89-95. |
| 453 CODE_REFERENCE_SERIALIZATION = 96 | 454 CODE_REFERENCE_SERIALIZATION = 96 |
| 454 // One per space, must be kSpaceMask aligned. | 455 // One per space, must be kSpaceMask aligned. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 : serializer_(serializer), | 561 : serializer_(serializer), |
| 561 object_(HeapObject::cast(o)), | 562 object_(HeapObject::cast(o)), |
| 562 sink_(sink), | 563 sink_(sink), |
| 563 reference_representation_(representation), | 564 reference_representation_(representation), |
| 564 bytes_processed_so_far_(0) { } | 565 bytes_processed_so_far_(0) { } |
| 565 void Serialize(); | 566 void Serialize(); |
| 566 void VisitPointers(Object** start, Object** end); | 567 void VisitPointers(Object** start, Object** end); |
| 567 void VisitExternalReferences(Address* start, Address* end); | 568 void VisitExternalReferences(Address* start, Address* end); |
| 568 void VisitCodeTarget(RelocInfo* target); | 569 void VisitCodeTarget(RelocInfo* target); |
| 569 void VisitRuntimeEntry(RelocInfo* reloc); | 570 void VisitRuntimeEntry(RelocInfo* reloc); |
| 571 // Used for seralizing the external strings that hold the natives source. |
| 572 void VisitExternalAsciiString( |
| 573 v8::String::ExternalAsciiStringResource** resource); |
| 574 // We can't serialize a heap with external two byte strings. |
| 575 void VisitExternalTwoByteString( |
| 576 v8::String::ExternalStringResource** resource) { |
| 577 UNREACHABLE(); |
| 578 } |
| 570 | 579 |
| 571 private: | 580 private: |
| 572 void OutputRawData(Address up_to); | 581 void OutputRawData(Address up_to); |
| 573 | 582 |
| 574 Serializer2* serializer_; | 583 Serializer2* serializer_; |
| 575 HeapObject* object_; | 584 HeapObject* object_; |
| 576 SnapshotByteSink* sink_; | 585 SnapshotByteSink* sink_; |
| 577 ReferenceRepresentation reference_representation_; | 586 ReferenceRepresentation reference_representation_; |
| 578 int bytes_processed_so_far_; | 587 int bytes_processed_so_far_; |
| 579 }; | 588 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 609 | 618 |
| 610 friend class ObjectSerializer; | 619 friend class ObjectSerializer; |
| 611 friend class Deserializer2; | 620 friend class Deserializer2; |
| 612 | 621 |
| 613 DISALLOW_COPY_AND_ASSIGN(Serializer2); | 622 DISALLOW_COPY_AND_ASSIGN(Serializer2); |
| 614 }; | 623 }; |
| 615 | 624 |
| 616 } } // namespace v8::internal | 625 } } // namespace v8::internal |
| 617 | 626 |
| 618 #endif // V8_SERIALIZE_H_ | 627 #endif // V8_SERIALIZE_H_ |
| OLD | NEW |