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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 // All the internalized strings that the partial snapshot needs should be | 1835 // All the internalized strings that the partial snapshot needs should be |
1836 // either in the root table or in the partial snapshot cache. | 1836 // either in the root table or in the partial snapshot cache. |
1837 DCHECK(!obj->IsInternalizedString()); | 1837 DCHECK(!obj->IsInternalizedString()); |
1838 | 1838 |
1839 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 1839 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; |
1840 | 1840 |
1841 FlushSkip(skip); | 1841 FlushSkip(skip); |
1842 | 1842 |
1843 // Clear literal boilerplates. | 1843 // Clear literal boilerplates. |
1844 if (obj->IsJSFunction()) { | 1844 if (obj->IsJSFunction()) { |
1845 FixedArray* literals = JSFunction::cast(obj)->literals(); | 1845 LiteralsArray* literals = JSFunction::cast(obj)->literals(); |
1846 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); | 1846 for (int i = 0; i < literals->literals_count(); i++) { |
| 1847 literals->set_undefined(i); |
| 1848 } |
| 1849 // TODO(mvstanton): remove this line when the vector moves to the closure. |
| 1850 // We need to clear the vector so the serializer doesn't try to serialize |
| 1851 // the vector in the startup snapshot and the partial snapshot(s). |
| 1852 literals->set_feedback_vector( |
| 1853 TypeFeedbackVector::cast(isolate_->heap()->empty_fixed_array())); |
1847 } | 1854 } |
1848 | 1855 |
1849 // Object has not yet been serialized. Serialize it here. | 1856 // Object has not yet been serialized. Serialize it here. |
1850 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); | 1857 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); |
1851 serializer.Serialize(); | 1858 serializer.Serialize(); |
1852 } | 1859 } |
1853 | 1860 |
1854 | 1861 |
1855 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, | 1862 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, |
1856 int size, Map* map) { | 1863 int size, Map* map) { |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2847 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2841 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2848 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2842 if (r == CHECK_SUCCESS) return scd; | 2849 if (r == CHECK_SUCCESS) return scd; |
2843 cached_data->Reject(); | 2850 cached_data->Reject(); |
2844 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2851 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2845 delete scd; | 2852 delete scd; |
2846 return NULL; | 2853 return NULL; |
2847 } | 2854 } |
2848 } // namespace internal | 2855 } // namespace internal |
2849 } // namespace v8 | 2856 } // namespace v8 |
OLD | NEW |