Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/api.h" | 7 #include "src/api.h" |
| 8 #include "src/assembler-inl.h" | 8 #include "src/assembler-inl.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 for (Code* code : new_code_objects_) { | 47 for (Code* code : new_code_objects_) { |
| 48 // Record all references to embedded objects in the new code object. | 48 // Record all references to embedded objects in the new code object. |
| 49 isolate_->heap()->RecordWritesIntoCode(code); | 49 isolate_->heap()->RecordWritesIntoCode(code); |
| 50 | 50 |
| 51 if (FLAG_serialize_age_code) code->PreAge(isolate_); | 51 if (FLAG_serialize_age_code) code->PreAge(isolate_); |
| 52 Assembler::FlushICache(isolate_, code->instruction_start(), | 52 Assembler::FlushICache(isolate_, code->instruction_start(), |
| 53 code->instruction_size()); | 53 code->instruction_size()); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 void Deserializer::RecordWritesForLargeObjects() { | |
| 58 Heap* heap = isolate_->heap(); | |
| 59 if (!heap->incremental_marking()->black_allocation()) return; | |
| 60 for (HeapObject* object : deserialized_large_objects_) { | |
| 61 heap->incremental_marking()->IterateBlackObject(object); | |
| 62 } | |
| 63 } | |
| 64 | |
| 57 bool Deserializer::ReserveSpace() { | 65 bool Deserializer::ReserveSpace() { |
| 58 #ifdef DEBUG | 66 #ifdef DEBUG |
| 59 for (int i = NEW_SPACE; i < kNumberOfSpaces; ++i) { | 67 for (int i = NEW_SPACE; i < kNumberOfSpaces; ++i) { |
| 60 CHECK(reservations_[i].size() > 0); | 68 CHECK(reservations_[i].size() > 0); |
| 61 } | 69 } |
| 62 #endif // DEBUG | 70 #endif // DEBUG |
| 63 DCHECK(allocated_maps_.is_empty()); | 71 DCHECK(allocated_maps_.is_empty()); |
| 64 if (!isolate_->heap()->ReserveSpace(reservations_, &allocated_maps_)) | 72 if (!isolate_->heap()->ReserveSpace(reservations_, &allocated_maps_)) |
| 65 return false; | 73 return false; |
| 66 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) { | 74 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 } else { | 172 } else { |
| 165 deserializing_user_code_ = true; | 173 deserializing_user_code_ = true; |
| 166 HandleScope scope(isolate); | 174 HandleScope scope(isolate); |
| 167 Handle<HeapObject> result; | 175 Handle<HeapObject> result; |
| 168 { | 176 { |
| 169 DisallowHeapAllocation no_gc; | 177 DisallowHeapAllocation no_gc; |
| 170 Object* root; | 178 Object* root; |
| 171 VisitRootPointer(Root::kPartialSnapshotCache, &root); | 179 VisitRootPointer(Root::kPartialSnapshotCache, &root); |
| 172 DeserializeDeferredObjects(); | 180 DeserializeDeferredObjects(); |
| 173 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects(); | 181 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects(); |
| 182 RecordWritesForLargeObjects(); | |
|
Hannes Payer (out of office)
2017/05/09 21:19:51
Ideally, we would move this one into RegisterReser
Jakob Kummerow
2017/05/10 11:09:07
Done.
| |
| 174 result = Handle<HeapObject>(HeapObject::cast(root)); | 183 result = Handle<HeapObject>(HeapObject::cast(root)); |
| 175 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); | 184 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); |
|
Hannes Payer (out of office)
2017/05/09 21:19:51
I guess that means we never have reservations for
Jakob Kummerow
2017/05/10 11:09:07
Correct; LO space doesn't use reservations (becaus
| |
| 176 } | 185 } |
| 177 CommitPostProcessedObjects(isolate); | 186 CommitPostProcessedObjects(isolate); |
| 178 return scope.CloseAndEscape(result); | 187 return scope.CloseAndEscape(result); |
| 179 } | 188 } |
| 180 } | 189 } |
| 181 | 190 |
| 182 Deserializer::~Deserializer() { | 191 Deserializer::~Deserializer() { |
| 183 #ifdef DEBUG | 192 #ifdef DEBUG |
| 184 // Do not perform checks if we aborted deserialization. | 193 // Do not perform checks if we aborted deserialization. |
| 185 if (source_.position() == 0) return; | 194 if (source_.position() == 0) return; |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 910 | 919 |
| 911 default: | 920 default: |
| 912 CHECK(false); | 921 CHECK(false); |
| 913 } | 922 } |
| 914 } | 923 } |
| 915 CHECK_EQ(limit, current); | 924 CHECK_EQ(limit, current); |
| 916 return true; | 925 return true; |
| 917 } | 926 } |
| 918 } // namespace internal | 927 } // namespace internal |
| 919 } // namespace v8 | 928 } // namespace v8 |
| OLD | NEW |