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

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

Issue 1211803002: Reland 2 "Keep a canonical list of shared function infos." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add test case 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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); 1890 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users();
1891 if (prototype_users->IsWeakFixedArray()) { 1891 if (prototype_users->IsWeakFixedArray()) {
1892 WeakFixedArray::cast(prototype_users)->Compact(); 1892 WeakFixedArray::cast(prototype_users)->Compact();
1893 } 1893 }
1894 } 1894 }
1895 1895
1896 if (object_->IsScript()) { 1896 if (object_->IsScript()) {
1897 // Clear cached line ends. 1897 // Clear cached line ends.
1898 Object* undefined = serializer_->isolate()->heap()->undefined_value(); 1898 Object* undefined = serializer_->isolate()->heap()->undefined_value();
1899 Script::cast(object_)->set_line_ends(undefined); 1899 Script::cast(object_)->set_line_ends(undefined);
1900 Object* shared_list = Script::cast(object_)->shared_function_infos();
1901 if (shared_list->IsWeakFixedArray()) {
1902 WeakFixedArray::cast(shared_list)->Compact();
1903 }
1900 } 1904 }
1901 1905
1902 if (object_->IsExternalString()) { 1906 if (object_->IsExternalString()) {
1903 Heap* heap = serializer_->isolate()->heap(); 1907 Heap* heap = serializer_->isolate()->heap();
1904 if (object_->map() != heap->native_source_string_map()) { 1908 if (object_->map() != heap->native_source_string_map()) {
1905 // Usually we cannot recreate resources for external strings. To work 1909 // Usually we cannot recreate resources for external strings. To work
1906 // around this, external strings are serialized to look like ordinary 1910 // around this, external strings are serialized to look like ordinary
1907 // sequential strings. 1911 // sequential strings.
1908 // The exception are native source code strings, since we can recreate 1912 // The exception are native source code strings, since we can recreate
1909 // their resources. In that case we fall through and leave it to 1913 // their resources. In that case we fall through and leave it to
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 return; 2318 return;
2315 #define IC_KIND_CASE(KIND) case Code::KIND: 2319 #define IC_KIND_CASE(KIND) case Code::KIND:
2316 IC_KIND_LIST(IC_KIND_CASE) 2320 IC_KIND_LIST(IC_KIND_CASE)
2317 #undef IC_KIND_CASE 2321 #undef IC_KIND_CASE
2318 SerializeIC(code_object, how_to_code, where_to_point); 2322 SerializeIC(code_object, how_to_code, where_to_point);
2319 return; 2323 return;
2320 case Code::FUNCTION: 2324 case Code::FUNCTION:
2321 DCHECK(code_object->has_reloc_info_for_serialization()); 2325 DCHECK(code_object->has_reloc_info_for_serialization());
2322 // Only serialize the code for the toplevel function unless specified 2326 // Only serialize the code for the toplevel function unless specified
2323 // by flag. Replace code of inner functions by the lazy compile builtin. 2327 // by flag. Replace code of inner functions by the lazy compile builtin.
2324 // This is safe, as checked in Compiler::BuildFunctionInfo. 2328 // This is safe, as checked in Compiler::GetSharedFunctionInfo.
2325 if (code_object != main_code_ && !FLAG_serialize_inner) { 2329 if (code_object != main_code_ && !FLAG_serialize_inner) {
2326 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point); 2330 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point);
2327 } else { 2331 } else {
2328 SerializeGeneric(code_object, how_to_code, where_to_point); 2332 SerializeGeneric(code_object, how_to_code, where_to_point);
2329 } 2333 }
2330 return; 2334 return;
2331 } 2335 }
2332 UNREACHABLE(); 2336 UNREACHABLE();
2333 } 2337 }
2334 2338
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2738 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2735 SanityCheckResult r = scd->SanityCheck(isolate, source); 2739 SanityCheckResult r = scd->SanityCheck(isolate, source);
2736 if (r == CHECK_SUCCESS) return scd; 2740 if (r == CHECK_SUCCESS) return scd;
2737 cached_data->Reject(); 2741 cached_data->Reject();
2738 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2742 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2739 delete scd; 2743 delete scd;
2740 return NULL; 2744 return NULL;
2741 } 2745 }
2742 } // namespace internal 2746 } // namespace internal
2743 } // namespace v8 2747 } // 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