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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1694 | 1694 |
1695 int root_index = root_index_map_.Lookup(obj); | 1695 int root_index = root_index_map_.Lookup(obj); |
1696 // We can only encode roots as such if it has already been serialized. | 1696 // We can only encode roots as such if it has already been serialized. |
1697 // That applies to root indices below the wave front. | 1697 // That applies to root indices below the wave front. |
1698 if (root_index != RootIndexMap::kInvalidRootIndex && | 1698 if (root_index != RootIndexMap::kInvalidRootIndex && |
1699 root_index < root_index_wave_front_) { | 1699 root_index < root_index_wave_front_) { |
1700 PutRoot(root_index, obj, how_to_code, where_to_point, skip); | 1700 PutRoot(root_index, obj, how_to_code, where_to_point, skip); |
1701 return; | 1701 return; |
1702 } | 1702 } |
1703 | 1703 |
1704 if (obj->IsCode() && Code::cast(obj)->kind() == Code::FUNCTION) { | 1704 if (obj->IsCode()) { |
1705 obj = isolate()->builtins()->builtin(Builtins::kCompileLazy); | 1705 Builtins* builtins = isolate()->builtins(); |
1706 if (Code::cast(obj)->kind() == Code::FUNCTION || | |
1707 obj == builtins->builtin(Builtins::kInterpreterEntryTrampoline)) { | |
Michael Starzinger
2016/02/03 12:39:26
nit: Can we use the Code::is_interpreter_entry_tra
| |
1708 obj = builtins->builtin(Builtins::kCompileLazy); | |
1709 } | |
1710 } else if (obj->IsBytecodeArray()) { | |
1711 obj = isolate()->heap()->undefined_value(); | |
1706 } | 1712 } |
1707 | 1713 |
1708 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 1714 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; |
1709 | 1715 |
1710 FlushSkip(skip); | 1716 FlushSkip(skip); |
1711 | 1717 |
1712 // Object has not yet been serialized. Serialize it here. | 1718 // Object has not yet been serialized. Serialize it here. |
1713 ObjectSerializer object_serializer(this, obj, sink_, how_to_code, | 1719 ObjectSerializer object_serializer(this, obj, sink_, how_to_code, |
1714 where_to_point); | 1720 where_to_point); |
1715 object_serializer.Serialize(); | 1721 object_serializer.Serialize(); |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2816 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2822 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2817 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2823 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2818 if (r == CHECK_SUCCESS) return scd; | 2824 if (r == CHECK_SUCCESS) return scd; |
2819 cached_data->Reject(); | 2825 cached_data->Reject(); |
2820 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2826 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2821 delete scd; | 2827 delete scd; |
2822 return NULL; | 2828 return NULL; |
2823 } | 2829 } |
2824 } // namespace internal | 2830 } // namespace internal |
2825 } // namespace v8 | 2831 } // namespace v8 |
OLD | NEW |