| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 Compiler::EnsureUnoptimizedCode(thread, function)); | 166 Compiler::EnsureUnoptimizedCode(thread, function)); |
| 167 if (!error.IsNull()) { | 167 if (!error.IsNull()) { |
| 168 Exceptions::PropagateError(error); | 168 Exceptions::PropagateError(error); |
| 169 } | 169 } |
| 170 const Code& code = Code::Handle(zone, function.unoptimized_code()); | 170 const Code& code = Code::Handle(zone, function.unoptimized_code()); |
| 171 ASSERT(!code.IsNull()); | 171 ASSERT(!code.IsNull()); |
| 172 ASSERT(function.HasCode()); | 172 ASSERT(function.HasCode()); |
| 173 *reinterpret_cast<RawObject**>(dest_addr) = code.raw(); | 173 *reinterpret_cast<RawObject**>(dest_addr) = code.raw(); |
| 174 | 174 |
| 175 if (FLAG_trace_deoptimization_verbose) { | 175 if (FLAG_trace_deoptimization_verbose) { |
| 176 OS::PrintErr("materializing pc marker at 0x%" Px ": %s, %s\n", | 176 THR_Print("materializing pc marker at 0x%" Px ": %s, %s\n", |
| 177 reinterpret_cast<uword>(slot()), code.ToCString(), | 177 reinterpret_cast<uword>(slot()), code.ToCString(), |
| 178 function.ToCString()); | 178 function.ToCString()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Increment the deoptimization counter. This effectively increments each | 181 // Increment the deoptimization counter. This effectively increments each |
| 182 // function occurring in the optimized frame. | 182 // function occurring in the optimized frame. |
| 183 function.set_deoptimization_counter(function.deoptimization_counter() + 1); | 183 if (deopt_context->deoptimizing_code()) { |
| 184 function.set_deoptimization_counter(function.deoptimization_counter() + 1); |
| 185 } |
| 184 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 186 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 185 OS::PrintErr("Deoptimizing %s (count %d)\n", | 187 THR_Print("Deoptimizing '%s' (count %d)\n", |
| 186 function.ToFullyQualifiedCString(), | 188 function.ToFullyQualifiedCString(), |
| 187 function.deoptimization_counter()); | 189 function.deoptimization_counter()); |
| 188 } | 190 } |
| 189 // Clear invocation counter so that hopefully the function gets reoptimized | 191 // Clear invocation counter so that hopefully the function gets reoptimized |
| 190 // only after more feedback has been collected. | 192 // only after more feedback has been collected. |
| 191 function.set_usage_counter(0); | 193 function.set_usage_counter(0); |
| 192 if (function.HasOptimizedCode()) { | 194 if (function.HasOptimizedCode()) { |
| 193 function.SwitchToUnoptimizedCode(); | 195 function.SwitchToUnoptimizedCode(); |
| 194 } | 196 } |
| 195 } | 197 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", | 331 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", |
| 330 offset.Value(), | 332 offset.Value(), |
| 331 value.ToCString()); | 333 value.ToCString()); |
| 332 } | 334 } |
| 333 } | 335 } |
| 334 } | 336 } |
| 335 } | 337 } |
| 336 } | 338 } |
| 337 | 339 |
| 338 } // namespace dart | 340 } // namespace dart |
| OLD | NEW |