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/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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); | 130 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); |
131 | 131 |
132 // There's no code deserialized here. If this assert fires then that's | 132 // There's no code deserialized here. If this assert fires then that's |
133 // changed and logging should be added to notify the profiler et al of the | 133 // changed and logging should be added to notify the profiler et al of the |
134 // new code, which also has to be flushed from instruction cache. | 134 // new code, which also has to be flushed from instruction cache. |
135 CHECK_EQ(start_address, code_space->top()); | 135 CHECK_EQ(start_address, code_space->top()); |
136 return Handle<Object>(root, isolate); | 136 return Handle<Object>(root, isolate); |
137 } | 137 } |
138 | 138 |
139 MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode( | 139 MaybeHandle<HeapObject> Deserializer::DeserializeObject(Isolate* isolate) { |
140 Isolate* isolate) { | |
141 Initialize(isolate); | 140 Initialize(isolate); |
142 if (!ReserveSpace()) { | 141 if (!ReserveSpace()) { |
143 return Handle<SharedFunctionInfo>(); | 142 return MaybeHandle<HeapObject>(); |
144 } else { | 143 } else { |
145 deserializing_user_code_ = true; | 144 deserializing_user_code_ = true; |
146 HandleScope scope(isolate); | 145 HandleScope scope(isolate); |
147 Handle<SharedFunctionInfo> result; | 146 Handle<HeapObject> result; |
148 { | 147 { |
149 DisallowHeapAllocation no_gc; | 148 DisallowHeapAllocation no_gc; |
150 Object* root; | 149 Object* root; |
151 VisitPointer(&root); | 150 VisitPointer(&root); |
152 DeserializeDeferredObjects(); | 151 DeserializeDeferredObjects(); |
153 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects(); | 152 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects(); |
154 result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root)); | 153 result = Handle<HeapObject>(HeapObject::cast(root)); |
155 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); | 154 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); |
156 } | 155 } |
157 CommitPostProcessedObjects(isolate); | 156 CommitPostProcessedObjects(isolate); |
158 return scope.CloseAndEscape(result); | 157 return scope.CloseAndEscape(result); |
159 } | 158 } |
160 } | 159 } |
161 | 160 |
162 Deserializer::~Deserializer() { | 161 Deserializer::~Deserializer() { |
163 // TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed. | 162 // TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed. |
164 // DCHECK(source_.AtEOF()); | 163 // DCHECK(source_.AtEOF()); |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 808 |
810 default: | 809 default: |
811 CHECK(false); | 810 CHECK(false); |
812 } | 811 } |
813 } | 812 } |
814 CHECK_EQ(limit, current); | 813 CHECK_EQ(limit, current); |
815 return true; | 814 return true; |
816 } | 815 } |
817 } // namespace internal | 816 } // namespace internal |
818 } // namespace v8 | 817 } // namespace v8 |
OLD | NEW |