OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/deferred_objects.h" | 5 #include "vm/deferred_objects.h" |
6 | 6 |
7 #include "vm/code_patcher.h" | 7 #include "vm/code_patcher.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/deopt_instructions.h" | 9 #include "vm/deopt_instructions.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 | 157 |
158 void DeferredPcMarker::Materialize(DeoptContext* deopt_context) { | 158 void DeferredPcMarker::Materialize(DeoptContext* deopt_context) { |
159 Thread* thread = deopt_context->thread(); | 159 Thread* thread = deopt_context->thread(); |
160 Zone* zone = deopt_context->zone(); | 160 Zone* zone = deopt_context->zone(); |
161 uword* dest_addr = reinterpret_cast<uword*>(slot()); | 161 uword* dest_addr = reinterpret_cast<uword*>(slot()); |
162 Function& function = Function::Handle(zone); | 162 Function& function = Function::Handle(zone); |
163 function ^= deopt_context->ObjectAt(index_); | 163 function ^= deopt_context->ObjectAt(index_); |
164 ASSERT(!function.IsNull()); | 164 if (function.IsNull()) { |
| 165 // Callee's PC marker is not used (pc of Deoptimize stub). Set to 0. |
| 166 *dest_addr = 0; |
| 167 return; |
| 168 } |
165 const Error& error = Error::Handle(zone, | 169 const Error& error = Error::Handle(zone, |
166 Compiler::EnsureUnoptimizedCode(thread, function)); | 170 Compiler::EnsureUnoptimizedCode(thread, function)); |
167 if (!error.IsNull()) { | 171 if (!error.IsNull()) { |
168 Exceptions::PropagateError(error); | 172 Exceptions::PropagateError(error); |
169 } | 173 } |
170 const Code& code = Code::Handle(zone, function.unoptimized_code()); | 174 const Code& code = Code::Handle(zone, function.unoptimized_code()); |
171 ASSERT(!code.IsNull()); | 175 ASSERT(!code.IsNull()); |
172 ASSERT(function.HasCode()); | 176 ASSERT(function.HasCode()); |
173 *reinterpret_cast<RawObject**>(dest_addr) = code.raw(); | 177 const intptr_t pc_marker = |
| 178 code.EntryPoint() + Assembler::EntryPointToPcMarkerOffset(); |
| 179 *dest_addr = pc_marker; |
174 | 180 |
175 if (FLAG_trace_deoptimization_verbose) { | 181 if (FLAG_trace_deoptimization_verbose) { |
176 OS::PrintErr("materializing pc marker at 0x%" Px ": %s, %s\n", | 182 OS::PrintErr("materializing pc marker at 0x%" Px ": %s, %s\n", |
177 reinterpret_cast<uword>(slot()), code.ToCString(), | 183 reinterpret_cast<uword>(slot()), code.ToCString(), |
178 function.ToCString()); | 184 function.ToCString()); |
179 } | 185 } |
180 | 186 |
181 // Increment the deoptimization counter. This effectively increments each | 187 // Increment the deoptimization counter. This effectively increments each |
182 // function occurring in the optimized frame. | 188 // function occurring in the optimized frame. |
183 function.set_deoptimization_counter(function.deoptimization_counter() + 1); | 189 function.set_deoptimization_counter(function.deoptimization_counter() + 1); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", | 335 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", |
330 offset.Value(), | 336 offset.Value(), |
331 value.ToCString()); | 337 value.ToCString()); |
332 } | 338 } |
333 } | 339 } |
334 } | 340 } |
335 } | 341 } |
336 } | 342 } |
337 | 343 |
338 } // namespace dart | 344 } // namespace dart |
OLD | NEW |