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 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 DCHECK(!startup_serializer_->back_reference_map()->Lookup(obj).is_valid()); | 1789 DCHECK(!startup_serializer_->back_reference_map()->Lookup(obj).is_valid()); |
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() && !JSFunction::cast(obj)->shared()->bound()) { |
1800 FixedArray* literals = JSFunction::cast(obj)->literals(); | 1800 FixedArray* literals = JSFunction::cast(obj)->literals(); |
1801 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); | 1801 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); |
1802 } | 1802 } |
1803 | 1803 |
1804 // Object has not yet been serialized. Serialize it here. | 1804 // Object has not yet been serialized. Serialize it here. |
1805 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); | 1805 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); |
1806 serializer.Serialize(); | 1806 serializer.Serialize(); |
1807 } | 1807 } |
1808 | 1808 |
1809 | 1809 |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2795 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2796 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2796 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2797 if (r == CHECK_SUCCESS) return scd; | 2797 if (r == CHECK_SUCCESS) return scd; |
2798 cached_data->Reject(); | 2798 cached_data->Reject(); |
2799 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2799 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2800 delete scd; | 2800 delete scd; |
2801 return NULL; | 2801 return NULL; |
2802 } | 2802 } |
2803 } // namespace internal | 2803 } // namespace internal |
2804 } // namespace v8 | 2804 } // namespace v8 |
OLD | NEW |