Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: src/snapshot/serialize.cc

Issue 1207583002: Revert "Keep a canonical list of shared function infos." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | src/typing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
1882 } 1878 }
1883 1879
1884 if (object_->IsExternalString()) { 1880 if (object_->IsExternalString()) {
1885 Heap* heap = serializer_->isolate()->heap(); 1881 Heap* heap = serializer_->isolate()->heap();
1886 if (object_->map() != heap->native_source_string_map()) { 1882 if (object_->map() != heap->native_source_string_map()) {
1887 // Usually we cannot recreate resources for external strings. To work 1883 // Usually we cannot recreate resources for external strings. To work
1888 // around this, external strings are serialized to look like ordinary 1884 // around this, external strings are serialized to look like ordinary
1889 // sequential strings. 1885 // sequential strings.
1890 // The exception are native source code strings, since we can recreate 1886 // The exception are native source code strings, since we can recreate
1891 // 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
2292 return; 2288 return;
2293 #define IC_KIND_CASE(KIND) case Code::KIND: 2289 #define IC_KIND_CASE(KIND) case Code::KIND:
2294 IC_KIND_LIST(IC_KIND_CASE) 2290 IC_KIND_LIST(IC_KIND_CASE)
2295 #undef IC_KIND_CASE 2291 #undef IC_KIND_CASE
2296 SerializeIC(code_object, how_to_code, where_to_point); 2292 SerializeIC(code_object, how_to_code, where_to_point);
2297 return; 2293 return;
2298 case Code::FUNCTION: 2294 case Code::FUNCTION:
2299 DCHECK(code_object->has_reloc_info_for_serialization()); 2295 DCHECK(code_object->has_reloc_info_for_serialization());
2300 // Only serialize the code for the toplevel function unless specified 2296 // Only serialize the code for the toplevel function unless specified
2301 // 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.
2302 // This is safe, as checked in Compiler::GetSharedFunctionInfo. 2298 // This is safe, as checked in Compiler::BuildFunctionInfo.
2303 if (code_object != main_code_ && !FLAG_serialize_inner) { 2299 if (code_object != main_code_ && !FLAG_serialize_inner) {
2304 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point); 2300 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point);
2305 } else { 2301 } else {
2306 SerializeGeneric(code_object, how_to_code, where_to_point); 2302 SerializeGeneric(code_object, how_to_code, where_to_point);
2307 } 2303 }
2308 return; 2304 return;
2309 } 2305 }
2310 UNREACHABLE(); 2306 UNREACHABLE();
2311 } 2307 }
2312 2308
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2708 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2713 SanityCheckResult r = scd->SanityCheck(isolate, source); 2709 SanityCheckResult r = scd->SanityCheck(isolate, source);
2714 if (r == CHECK_SUCCESS) return scd; 2710 if (r == CHECK_SUCCESS) return scd;
2715 cached_data->Reject(); 2711 cached_data->Reject();
2716 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2712 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2717 delete scd; 2713 delete scd;
2718 return NULL; 2714 return NULL;
2719 } 2715 }
2720 } // namespace internal 2716 } // namespace internal
2721 } // namespace v8 2717 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698