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

Side by Side Diff: src/snapshot/startup-serializer.cc

Issue 2561783002: [serializer] wipe simulator redirects for accessor infos. (Closed)
Patch Set: fix Created 4 years 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/snapshot/startup-serializer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/startup-serializer.h" 5 #include "src/snapshot/startup-serializer.h"
6 6
7 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
8 #include "src/v8threads.h" 8 #include "src/v8threads.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 StartupSerializer::StartupSerializer( 13 StartupSerializer::StartupSerializer(
14 Isolate* isolate, 14 Isolate* isolate,
15 v8::SnapshotCreator::FunctionCodeHandling function_code_handling) 15 v8::SnapshotCreator::FunctionCodeHandling function_code_handling)
16 : Serializer(isolate), 16 : Serializer(isolate),
17 clear_function_code_(function_code_handling == 17 clear_function_code_(function_code_handling ==
18 v8::SnapshotCreator::FunctionCodeHandling::kClear), 18 v8::SnapshotCreator::FunctionCodeHandling::kClear),
19 serializing_builtins_(false) { 19 serializing_builtins_(false) {
20 InitializeCodeAddressMap(); 20 InitializeCodeAddressMap();
21 } 21 }
22 22
23 StartupSerializer::~StartupSerializer() { 23 StartupSerializer::~StartupSerializer() {
24 RestoreExternalReferenceRedirectors(&accessor_infos_);
24 OutputStatistics("StartupSerializer"); 25 OutputStatistics("StartupSerializer");
25 } 26 }
26 27
27 void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, 28 void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
28 WhereToPoint where_to_point, int skip) { 29 WhereToPoint where_to_point, int skip) {
29 DCHECK(!obj->IsJSFunction()); 30 DCHECK(!obj->IsJSFunction());
30 31
31 if (clear_function_code_) { 32 if (clear_function_code_) {
32 if (obj->IsCode()) { 33 if (obj->IsCode()) {
33 Code* code = Code::cast(obj); 34 Code* code = Code::cast(obj);
(...skipping 25 matching lines...) Expand all
59 if (root_has_been_serialized_.test(root_index)) { 60 if (root_has_been_serialized_.test(root_index)) {
60 PutRoot(root_index, obj, how_to_code, where_to_point, skip); 61 PutRoot(root_index, obj, how_to_code, where_to_point, skip);
61 return; 62 return;
62 } 63 }
63 } 64 }
64 65
65 if (SerializeBackReference(obj, how_to_code, where_to_point, skip)) return; 66 if (SerializeBackReference(obj, how_to_code, where_to_point, skip)) return;
66 67
67 FlushSkip(skip); 68 FlushSkip(skip);
68 69
70 if (isolate_->external_reference_redirector() && obj->IsAccessorInfo()) {
71 // Wipe external reference redirects in the accessor info.
72 AccessorInfo* info = AccessorInfo::cast(obj);
73 Address original_address = Foreign::cast(info->getter())->foreign_address();
74 Foreign::cast(info->js_getter())->set_foreign_address(original_address);
75 accessor_infos_.Add(info);
76 }
77
69 // Object has not yet been serialized. Serialize it here. 78 // Object has not yet been serialized. Serialize it here.
70 ObjectSerializer object_serializer(this, obj, &sink_, how_to_code, 79 ObjectSerializer object_serializer(this, obj, &sink_, how_to_code,
71 where_to_point); 80 where_to_point);
72 object_serializer.Serialize(); 81 object_serializer.Serialize();
73 82
74 if (serializing_immortal_immovables_roots_ && 83 if (serializing_immortal_immovables_roots_ &&
75 root_index != RootIndexMap::kInvalidRootIndex) { 84 root_index != RootIndexMap::kInvalidRootIndex) {
76 // Make sure that the immortal immovable root has been included in the first 85 // Make sure that the immortal immovable root has been included in the first
77 // chunk of its reserved space , so that it is deserialized onto the first 86 // chunk of its reserved space , so that it is deserialized onto the first
78 // page of its space and stays immortal immovable. 87 // page of its space and stays immortal immovable.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (root_index == Heap::kStackLimitRootIndex || 181 if (root_index == Heap::kStackLimitRootIndex ||
173 root_index == Heap::kRealStackLimitRootIndex) { 182 root_index == Heap::kRealStackLimitRootIndex) {
174 return true; 183 return true;
175 } 184 }
176 return Heap::RootIsImmortalImmovable(root_index) != 185 return Heap::RootIsImmortalImmovable(root_index) !=
177 serializing_immortal_immovables_roots_; 186 serializing_immortal_immovables_roots_;
178 } 187 }
179 188
180 } // namespace internal 189 } // namespace internal
181 } // namespace v8 190 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/startup-serializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698