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

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

Issue 2200333004: [serializer][heap] Record references in deserialized code objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 4 years, 4 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/snapshot/deserializer.h ('k') | test/cctest/test-serialize.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 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/deserializer.h" 5 #include "src/snapshot/deserializer.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/external-reference-table.h" 8 #include "src/external-reference-table.h"
9 #include "src/heap/heap.h" 9 #include "src/heap/heap.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 19 matching lines...) Expand all
30 30
31 void Deserializer::FlushICacheForNewIsolate() { 31 void Deserializer::FlushICacheForNewIsolate() {
32 DCHECK(!deserializing_user_code_); 32 DCHECK(!deserializing_user_code_);
33 // The entire isolate is newly deserialized. Simply flush all code pages. 33 // The entire isolate is newly deserialized. Simply flush all code pages.
34 for (Page* p : *isolate_->heap()->code_space()) { 34 for (Page* p : *isolate_->heap()->code_space()) {
35 Assembler::FlushICache(isolate_, p->area_start(), 35 Assembler::FlushICache(isolate_, p->area_start(),
36 p->area_end() - p->area_start()); 36 p->area_end() - p->area_start());
37 } 37 }
38 } 38 }
39 39
40 void Deserializer::FlushICacheForNewCodeObjects() { 40 void Deserializer::FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects() {
41 DCHECK(deserializing_user_code_); 41 DCHECK(deserializing_user_code_);
42 for (Code* code : new_code_objects_) { 42 for (Code* code : new_code_objects_) {
43 // Record all references to embedded objects in the new code object.
44 isolate_->heap()->RecordWritesIntoCode(code);
45
43 if (FLAG_serialize_age_code) code->PreAge(isolate_); 46 if (FLAG_serialize_age_code) code->PreAge(isolate_);
44 Assembler::FlushICache(isolate_, code->instruction_start(), 47 Assembler::FlushICache(isolate_, code->instruction_start(),
45 code->instruction_size()); 48 code->instruction_size());
46 } 49 }
47 } 50 }
48 51
49 bool Deserializer::ReserveSpace() { 52 bool Deserializer::ReserveSpace() {
50 #ifdef DEBUG 53 #ifdef DEBUG
51 for (int i = NEW_SPACE; i < kNumberOfSpaces; ++i) { 54 for (int i = NEW_SPACE; i < kNumberOfSpaces; ++i) {
52 CHECK(reservations_[i].length() > 0); 55 CHECK(reservations_[i].length() > 0);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return Handle<SharedFunctionInfo>(); 143 return Handle<SharedFunctionInfo>();
141 } else { 144 } else {
142 deserializing_user_code_ = true; 145 deserializing_user_code_ = true;
143 HandleScope scope(isolate); 146 HandleScope scope(isolate);
144 Handle<SharedFunctionInfo> result; 147 Handle<SharedFunctionInfo> result;
145 { 148 {
146 DisallowHeapAllocation no_gc; 149 DisallowHeapAllocation no_gc;
147 Object* root; 150 Object* root;
148 VisitPointer(&root); 151 VisitPointer(&root);
149 DeserializeDeferredObjects(); 152 DeserializeDeferredObjects();
150 FlushICacheForNewCodeObjects(); 153 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects();
151 result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root)); 154 result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root));
152 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); 155 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_);
153 } 156 }
154 CommitPostProcessedObjects(isolate); 157 CommitPostProcessedObjects(isolate);
155 return scope.CloseAndEscape(result); 158 return scope.CloseAndEscape(result);
156 } 159 }
157 } 160 }
158 161
159 Deserializer::~Deserializer() { 162 Deserializer::~Deserializer() {
160 // TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed. 163 // TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed.
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 809
807 default: 810 default:
808 CHECK(false); 811 CHECK(false);
809 } 812 }
810 } 813 }
811 CHECK_EQ(limit, current); 814 CHECK_EQ(limit, current);
812 return true; 815 return true;
813 } 816 }
814 } // namespace internal 817 } // namespace internal
815 } // namespace v8 818 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/deserializer.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698