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 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 // Clear literal boilerplates. | 1846 // Clear literal boilerplates. |
1847 if (obj->IsJSFunction() && !JSFunction::cast(obj)->shared()->bound()) { | 1847 if (obj->IsJSFunction() && !JSFunction::cast(obj)->shared()->bound()) { |
1848 FixedArray* literals = JSFunction::cast(obj)->literals(); | 1848 FixedArray* literals = JSFunction::cast(obj)->literals(); |
1849 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); | 1849 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); |
1850 } | 1850 } |
1851 | 1851 |
1852 // Object has not yet been serialized. Serialize it here. | 1852 // Object has not yet been serialized. Serialize it here. |
1853 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); | 1853 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); |
1854 serializer.Serialize(); | 1854 serializer.Serialize(); |
1855 | 1855 |
| 1856 // TODO(yangguo): We probably only need ScriptContext here for post- |
| 1857 // processing in Genesis::HookUpGlobalThisBinding. |
1856 if (obj->IsContext() && | 1858 if (obj->IsContext() && |
1857 Context::cast(obj)->global_object() == global_object_) { | 1859 Context::cast(obj)->global_object() == global_object_) { |
1858 // Context refers to the current global object. This reference will | 1860 // Context refers to the current global object. This reference will |
1859 // become outdated after deserialization. | 1861 // become outdated after deserialization. |
1860 outdated_contexts_.Add(Context::cast(obj)); | 1862 outdated_contexts_.Add(Context::cast(obj)); |
1861 } | 1863 } |
1862 } | 1864 } |
1863 | 1865 |
1864 | 1866 |
1865 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, | 1867 void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2858 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2857 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2859 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2858 if (r == CHECK_SUCCESS) return scd; | 2860 if (r == CHECK_SUCCESS) return scd; |
2859 cached_data->Reject(); | 2861 cached_data->Reject(); |
2860 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2862 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2861 delete scd; | 2863 delete scd; |
2862 return NULL; | 2864 return NULL; |
2863 } | 2865 } |
2864 } // namespace internal | 2866 } // namespace internal |
2865 } // namespace v8 | 2867 } // namespace v8 |
OLD | NEW |