| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
| 6 | 6 |
| 7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/locations.h" | 9 #include "vm/locations.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { | 415 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { |
| 416 Function& function = Function::Handle(deopt_context->isolate()); | 416 Function& function = Function::Handle(deopt_context->isolate()); |
| 417 function ^= deopt_context->ObjectAt(object_table_index_); | 417 function ^= deopt_context->ObjectAt(object_table_index_); |
| 418 const Code& code = | 418 const Code& code = |
| 419 Code::Handle(deopt_context->isolate(), function.unoptimized_code()); | 419 Code::Handle(deopt_context->isolate(), function.unoptimized_code()); |
| 420 intptr_t pc_marker = code.EntryPoint() + | 420 intptr_t pc_marker = code.EntryPoint() + |
| 421 AssemblerMacros::kOffsetOfSavedPCfromEntrypoint; | 421 AssemblerMacros::kOffsetOfSavedPCfromEntrypoint; |
| 422 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); | 422 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); |
| 423 *to_addr = pc_marker; | 423 *to_addr = pc_marker; |
| 424 // Increment the deoptimization counter. This effectively increments each |
| 425 // function occurring in the optimized frame. |
| 426 function.set_deoptimization_counter(function.deoptimization_counter() + 1); |
| 427 // Clear invocation counter so that hopefully the function gets reoptimized |
| 428 // only after more feedback has been collected. |
| 429 function.set_usage_counter(0); |
| 430 if (function.HasOptimizedCode()) function.SwitchToUnoptimizedCode(); |
| 424 } | 431 } |
| 425 | 432 |
| 426 private: | 433 private: |
| 427 intptr_t object_table_index_; | 434 intptr_t object_table_index_; |
| 428 | 435 |
| 429 DISALLOW_COPY_AND_ASSIGN(DeoptPcMarkerInstr); | 436 DISALLOW_COPY_AND_ASSIGN(DeoptPcMarkerInstr); |
| 430 }; | 437 }; |
| 431 | 438 |
| 432 | 439 |
| 433 // Deoptimization instruction copying the caller saved FP from optimized frame. | 440 // Deoptimization instruction copying the caller saved FP from optimized frame. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 Smi* offset, | 639 Smi* offset, |
| 633 DeoptInfo* info, | 640 DeoptInfo* info, |
| 634 Smi* reason) { | 641 Smi* reason) { |
| 635 intptr_t i = index * kEntrySize; | 642 intptr_t i = index * kEntrySize; |
| 636 *offset ^= table.At(i); | 643 *offset ^= table.At(i); |
| 637 *info ^= table.At(i + 1); | 644 *info ^= table.At(i + 1); |
| 638 *reason ^= table.At(i + 2); | 645 *reason ^= table.At(i + 2); |
| 639 } | 646 } |
| 640 | 647 |
| 641 } // namespace dart | 648 } // namespace dart |
| OLD | NEW |