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