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/v8.h" | 5 #include "src/v8.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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); | 1868 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); |
1869 if (prototype_users->IsWeakFixedArray()) { | 1869 if (prototype_users->IsWeakFixedArray()) { |
1870 WeakFixedArray::cast(prototype_users)->Compact(); | 1870 WeakFixedArray::cast(prototype_users)->Compact(); |
1871 } | 1871 } |
1872 } | 1872 } |
1873 | 1873 |
1874 if (object_->IsScript()) { | 1874 if (object_->IsScript()) { |
1875 // Clear cached line ends. | 1875 // Clear cached line ends. |
1876 Object* undefined = serializer_->isolate()->heap()->undefined_value(); | 1876 Object* undefined = serializer_->isolate()->heap()->undefined_value(); |
1877 Script::cast(object_)->set_line_ends(undefined); | 1877 Script::cast(object_)->set_line_ends(undefined); |
| 1878 Object* shared_list = Script::cast(object_)->shared_function_infos(); |
| 1879 if (shared_list->IsWeakFixedArray()) { |
| 1880 WeakFixedArray::cast(shared_list)->Compact(); |
| 1881 } |
1878 } | 1882 } |
1879 | 1883 |
1880 if (object_->IsExternalString()) { | 1884 if (object_->IsExternalString()) { |
1881 Heap* heap = serializer_->isolate()->heap(); | 1885 Heap* heap = serializer_->isolate()->heap(); |
1882 if (object_->map() != heap->native_source_string_map()) { | 1886 if (object_->map() != heap->native_source_string_map()) { |
1883 // Usually we cannot recreate resources for external strings. To work | 1887 // Usually we cannot recreate resources for external strings. To work |
1884 // around this, external strings are serialized to look like ordinary | 1888 // around this, external strings are serialized to look like ordinary |
1885 // sequential strings. | 1889 // sequential strings. |
1886 // The exception are native source code strings, since we can recreate | 1890 // The exception are native source code strings, since we can recreate |
1887 // their resources. In that case we fall through and leave it to | 1891 // their resources. In that case we fall through and leave it to |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 return; | 2292 return; |
2289 #define IC_KIND_CASE(KIND) case Code::KIND: | 2293 #define IC_KIND_CASE(KIND) case Code::KIND: |
2290 IC_KIND_LIST(IC_KIND_CASE) | 2294 IC_KIND_LIST(IC_KIND_CASE) |
2291 #undef IC_KIND_CASE | 2295 #undef IC_KIND_CASE |
2292 SerializeIC(code_object, how_to_code, where_to_point); | 2296 SerializeIC(code_object, how_to_code, where_to_point); |
2293 return; | 2297 return; |
2294 case Code::FUNCTION: | 2298 case Code::FUNCTION: |
2295 DCHECK(code_object->has_reloc_info_for_serialization()); | 2299 DCHECK(code_object->has_reloc_info_for_serialization()); |
2296 // Only serialize the code for the toplevel function unless specified | 2300 // Only serialize the code for the toplevel function unless specified |
2297 // by flag. Replace code of inner functions by the lazy compile builtin. | 2301 // by flag. Replace code of inner functions by the lazy compile builtin. |
2298 // This is safe, as checked in Compiler::BuildFunctionInfo. | 2302 // This is safe, as checked in Compiler::GetSharedFunctionInfo. |
2299 if (code_object != main_code_ && !FLAG_serialize_inner) { | 2303 if (code_object != main_code_ && !FLAG_serialize_inner) { |
2300 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point); | 2304 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point); |
2301 } else { | 2305 } else { |
2302 SerializeGeneric(code_object, how_to_code, where_to_point); | 2306 SerializeGeneric(code_object, how_to_code, where_to_point); |
2303 } | 2307 } |
2304 return; | 2308 return; |
2305 } | 2309 } |
2306 UNREACHABLE(); | 2310 UNREACHABLE(); |
2307 } | 2311 } |
2308 | 2312 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2712 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2709 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2713 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2710 if (r == CHECK_SUCCESS) return scd; | 2714 if (r == CHECK_SUCCESS) return scd; |
2711 cached_data->Reject(); | 2715 cached_data->Reject(); |
2712 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2716 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2713 delete scd; | 2717 delete scd; |
2714 return NULL; | 2718 return NULL; |
2715 } | 2719 } |
2716 } // namespace internal | 2720 } // namespace internal |
2717 } // namespace v8 | 2721 } // namespace v8 |
OLD | NEW |