| 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 #include "src/snapshot/serialize.h" | 5 #include "src/snapshot/serialize.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 636 |
| 637 | 637 |
| 638 // This is called on the roots. It is the driver of the deserialization | 638 // This is called on the roots. It is the driver of the deserialization |
| 639 // process. It is also called on the body of each function. | 639 // process. It is also called on the body of each function. |
| 640 void Deserializer::VisitPointers(Object** start, Object** end) { | 640 void Deserializer::VisitPointers(Object** start, Object** end) { |
| 641 // The space must be new space. Any other space would cause ReadChunk to try | 641 // The space must be new space. Any other space would cause ReadChunk to try |
| 642 // to update the remembered using NULL as the address. | 642 // to update the remembered using NULL as the address. |
| 643 ReadData(start, end, NEW_SPACE, NULL); | 643 ReadData(start, end, NEW_SPACE, NULL); |
| 644 } | 644 } |
| 645 | 645 |
| 646 void Deserializer::Synchronize(VisitorSynchronization::SyncTag tag) { |
| 647 static const byte expected = kSynchronize; |
| 648 CHECK_EQ(expected, source_.Get()); |
| 649 } |
| 646 | 650 |
| 647 void Deserializer::DeserializeDeferredObjects() { | 651 void Deserializer::DeserializeDeferredObjects() { |
| 648 for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) { | 652 for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) { |
| 649 switch (code) { | 653 switch (code) { |
| 650 case kAlignmentPrefix: | 654 case kAlignmentPrefix: |
| 651 case kAlignmentPrefix + 1: | 655 case kAlignmentPrefix + 1: |
| 652 case kAlignmentPrefix + 2: | 656 case kAlignmentPrefix + 2: |
| 653 SetAlignment(code); | 657 SetAlignment(code); |
| 654 break; | 658 break; |
| 655 default: { | 659 default: { |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 VisitPointer(&undefined); | 1740 VisitPointer(&undefined); |
| 1737 isolate()->heap()->IterateWeakRoots(this, VISIT_ALL); | 1741 isolate()->heap()->IterateWeakRoots(this, VISIT_ALL); |
| 1738 SerializeDeferredObjects(); | 1742 SerializeDeferredObjects(); |
| 1739 Pad(); | 1743 Pad(); |
| 1740 } | 1744 } |
| 1741 | 1745 |
| 1742 void StartupSerializer::Synchronize(VisitorSynchronization::SyncTag tag) { | 1746 void StartupSerializer::Synchronize(VisitorSynchronization::SyncTag tag) { |
| 1743 // We expect the builtins tag after builtins have been serialized. | 1747 // We expect the builtins tag after builtins have been serialized. |
| 1744 DCHECK(!serializing_builtins_ || tag == VisitorSynchronization::kBuiltins); | 1748 DCHECK(!serializing_builtins_ || tag == VisitorSynchronization::kBuiltins); |
| 1745 serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope); | 1749 serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope); |
| 1750 sink_->Put(kSynchronize, "Synchronize"); |
| 1746 } | 1751 } |
| 1747 | 1752 |
| 1748 void Serializer::PutRoot(int root_index, | 1753 void Serializer::PutRoot(int root_index, |
| 1749 HeapObject* object, | 1754 HeapObject* object, |
| 1750 SerializerDeserializer::HowToCode how_to_code, | 1755 SerializerDeserializer::HowToCode how_to_code, |
| 1751 SerializerDeserializer::WhereToPoint where_to_point, | 1756 SerializerDeserializer::WhereToPoint where_to_point, |
| 1752 int skip) { | 1757 int skip) { |
| 1753 if (FLAG_trace_serializer) { | 1758 if (FLAG_trace_serializer) { |
| 1754 PrintF(" Encoding root %d:", root_index); | 1759 PrintF(" Encoding root %d:", root_index); |
| 1755 object->ShortPrint(); | 1760 object->ShortPrint(); |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2831 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2836 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
| 2832 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2837 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 2833 if (r == CHECK_SUCCESS) return scd; | 2838 if (r == CHECK_SUCCESS) return scd; |
| 2834 cached_data->Reject(); | 2839 cached_data->Reject(); |
| 2835 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2840 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 2836 delete scd; | 2841 delete scd; |
| 2837 return NULL; | 2842 return NULL; |
| 2838 } | 2843 } |
| 2839 } // namespace internal | 2844 } // namespace internal |
| 2840 } // namespace v8 | 2845 } // namespace v8 |
| OLD | NEW |