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 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 // All the internalized strings that the partial snapshot needs should be | 1790 // All the internalized strings that the partial snapshot needs should be |
1791 // either in the root table or in the partial snapshot cache. | 1791 // either in the root table or in the partial snapshot cache. |
1792 DCHECK(!obj->IsInternalizedString()); | 1792 DCHECK(!obj->IsInternalizedString()); |
1793 | 1793 |
1794 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 1794 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; |
1795 | 1795 |
1796 FlushSkip(skip); | 1796 FlushSkip(skip); |
1797 | 1797 |
1798 // Clear literal boilerplates. | 1798 // Clear literal boilerplates. |
1799 if (obj->IsJSFunction()) { | 1799 if (obj->IsJSFunction()) { |
1800 LiteralsArray* literals = JSFunction::cast(obj)->literals(); | 1800 FixedArray* literals = JSFunction::cast(obj)->literals(); |
1801 for (int i = 0; i < literals->literals_count(); i++) { | 1801 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); |
1802 literals->set_undefined(i); | |
1803 } | |
1804 // TODO(mvstanton): remove this line when the vector moves to the closure. | |
1805 // We need to clear the vector so the serializer doesn't try to serialize | |
1806 // the vector in the startup snapshot and the partial snapshot(s). | |
1807 literals->set_feedback_vector( | |
1808 TypeFeedbackVector::cast(isolate_->heap()->empty_fixed_array())); | |
1809 } | 1802 } |
1810 | 1803 |
1811 // Object has not yet been serialized. Serialize it here. | 1804 // Object has not yet been serialized. Serialize it here. |
1812 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); | 1805 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); |
1813 serializer.Serialize(); | 1806 serializer.Serialize(); |
1814 } | 1807 } |
1815 | 1808 |
1816 | 1809 |
1817 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, | 1810 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, |
1818 int size, Map* map) { | 1811 int size, Map* map) { |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2795 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2803 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2796 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2804 if (r == CHECK_SUCCESS) return scd; | 2797 if (r == CHECK_SUCCESS) return scd; |
2805 cached_data->Reject(); | 2798 cached_data->Reject(); |
2806 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2799 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2807 delete scd; | 2800 delete scd; |
2808 return NULL; | 2801 return NULL; |
2809 } | 2802 } |
2810 } // namespace internal | 2803 } // namespace internal |
2811 } // namespace v8 | 2804 } // namespace v8 |
OLD | NEW |