| 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 LiteralsArray* literals = JSFunction::cast(obj)->literals(); | 1845 FixedArray* literals = JSFunction::cast(obj)->literals(); |
| 1846 for (int i = 0; i < literals->literals_count(); i++) { | 1846 for (int i = 0; i < literals->length(); i++) literals->set_undefined(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())); | |
| 1854 } | 1847 } |
| 1855 | 1848 |
| 1856 // Object has not yet been serialized. Serialize it here. | 1849 // Object has not yet been serialized. Serialize it here. |
| 1857 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); | 1850 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); |
| 1858 serializer.Serialize(); | 1851 serializer.Serialize(); |
| 1859 } | 1852 } |
| 1860 | 1853 |
| 1861 | 1854 |
| 1862 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, | 1855 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, |
| 1863 int size, Map* map) { | 1856 int size, Map* map) { |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2840 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
| 2848 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2841 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 2849 if (r == CHECK_SUCCESS) return scd; | 2842 if (r == CHECK_SUCCESS) return scd; |
| 2850 cached_data->Reject(); | 2843 cached_data->Reject(); |
| 2851 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2844 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 2852 delete scd; | 2845 delete scd; |
| 2853 return NULL; | 2846 return NULL; |
| 2854 } | 2847 } |
| 2855 } // namespace internal | 2848 } // namespace internal |
| 2856 } // namespace v8 | 2849 } // namespace v8 |
| OLD | NEW |