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/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 DisallowHeapAllocation no_gc; | 121 DisallowHeapAllocation no_gc; |
122 // Keep track of the code space start and end pointers in case new | 122 // Keep track of the code space start and end pointers in case new |
123 // code objects were unserialized | 123 // code objects were unserialized |
124 OldSpace* code_space = isolate_->heap()->code_space(); | 124 OldSpace* code_space = isolate_->heap()->code_space(); |
125 Address start_address = code_space->top(); | 125 Address start_address = code_space->top(); |
126 Object* root; | 126 Object* root; |
127 VisitPointer(&root); | 127 VisitPointer(&root); |
128 DeserializeDeferredObjects(); | 128 DeserializeDeferredObjects(); |
129 | 129 |
| 130 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); |
| 131 |
130 // 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 |
131 // 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 |
132 // new code, which also has to be flushed from instruction cache. | 134 // new code, which also has to be flushed from instruction cache. |
133 CHECK_EQ(start_address, code_space->top()); | 135 CHECK_EQ(start_address, code_space->top()); |
134 return Handle<Object>(root, isolate); | 136 return Handle<Object>(root, isolate); |
135 } | 137 } |
136 | 138 |
137 MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode( | 139 MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode( |
138 Isolate* isolate) { | 140 Isolate* isolate) { |
139 Initialize(isolate); | 141 Initialize(isolate); |
140 if (!ReserveSpace()) { | 142 if (!ReserveSpace()) { |
141 return Handle<SharedFunctionInfo>(); | 143 return Handle<SharedFunctionInfo>(); |
142 } else { | 144 } else { |
143 deserializing_user_code_ = true; | 145 deserializing_user_code_ = true; |
144 HandleScope scope(isolate); | 146 HandleScope scope(isolate); |
145 Handle<SharedFunctionInfo> result; | 147 Handle<SharedFunctionInfo> result; |
146 { | 148 { |
147 DisallowHeapAllocation no_gc; | 149 DisallowHeapAllocation no_gc; |
148 Object* root; | 150 Object* root; |
149 VisitPointer(&root); | 151 VisitPointer(&root); |
150 DeserializeDeferredObjects(); | 152 DeserializeDeferredObjects(); |
151 FlushICacheForNewCodeObjects(); | 153 FlushICacheForNewCodeObjects(); |
152 result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root)); | 154 result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root)); |
153 } | 155 } |
154 CommitPostProcessedObjects(isolate); | 156 CommitPostProcessedObjects(isolate); |
| 157 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); |
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. |
161 // DCHECK(source_.AtEOF()); | 164 // DCHECK(source_.AtEOF()); |
162 attached_objects_.Dispose(); | 165 attached_objects_.Dispose(); |
163 } | 166 } |
164 | 167 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 807 |
805 default: | 808 default: |
806 CHECK(false); | 809 CHECK(false); |
807 } | 810 } |
808 } | 811 } |
809 CHECK_EQ(limit, current); | 812 CHECK_EQ(limit, current); |
810 return true; | 813 return true; |
811 } | 814 } |
812 } // namespace internal | 815 } // namespace internal |
813 } // namespace v8 | 816 } // namespace v8 |
OLD | NEW |