| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 Code::Handle(ci_table->LookupCode(caller_frame->pc())); | 845 Code::Handle(ci_table->LookupCode(caller_frame->pc())); |
| 846 const Function& function = Function::Handle(optimized_code.function()); | 846 const Function& function = Function::Handle(optimized_code.function()); |
| 847 ASSERT(!function.IsNull()); | 847 ASSERT(!function.IsNull()); |
| 848 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); | 848 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); |
| 849 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); | 849 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); |
| 850 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); | 850 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); |
| 851 const PcDescriptors& descriptors = | 851 const PcDescriptors& descriptors = |
| 852 PcDescriptors::Handle(optimized_code.pc_descriptors()); | 852 PcDescriptors::Handle(optimized_code.pc_descriptors()); |
| 853 ASSERT(!descriptors.IsNull()); | 853 ASSERT(!descriptors.IsNull()); |
| 854 // Locate node id at deoptimization point inside optimized code. | 854 // Locate node id at deoptimization point inside optimized code. |
| 855 intptr_t deopt_node_id = AstNode::kInvalidId; | 855 intptr_t deopt_node_id = AstNode::kNoId; |
| 856 for (int i = 0; i < descriptors.Length(); i++) { | 856 for (int i = 0; i < descriptors.Length(); i++) { |
| 857 if (static_cast<uword>(descriptors.PC(i)) == caller_frame->pc()) { | 857 if (static_cast<uword>(descriptors.PC(i)) == caller_frame->pc()) { |
| 858 deopt_node_id = descriptors.NodeId(i); | 858 deopt_node_id = descriptors.NodeId(i); |
| 859 break; | 859 break; |
| 860 } | 860 } |
| 861 } | 861 } |
| 862 ASSERT(deopt_node_id != AstNode::kInvalidId); | 862 ASSERT(deopt_node_id != AstNode::kNoId); |
| 863 uword continue_at_pc = | 863 uword continue_at_pc = |
| 864 unoptimized_code.GetDeoptPcAtNodeId(deopt_node_id); | 864 unoptimized_code.GetDeoptPcAtNodeId(deopt_node_id); |
| 865 ASSERT(continue_at_pc != 0); | 865 ASSERT(continue_at_pc != 0); |
| 866 if (FLAG_trace_deopt) { | 866 if (FLAG_trace_deopt) { |
| 867 OS::Print("Deoptimizing at pc 0x%x id %d '%s' -> continue at 0x%x \n", | 867 OS::Print("Deoptimizing at pc 0x%x id %d '%s' -> continue at 0x%x \n", |
| 868 caller_frame->pc(), deopt_node_id, function.ToFullyQualifiedCString(), | 868 caller_frame->pc(), deopt_node_id, function.ToFullyQualifiedCString(), |
| 869 continue_at_pc); | 869 continue_at_pc); |
| 870 } | 870 } |
| 871 caller_frame->set_pc(continue_at_pc); | 871 caller_frame->set_pc(continue_at_pc); |
| 872 // Clear invocation counter so that the function gets optimized after | 872 // Clear invocation counter so that the function gets optimized after |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 } | 964 } |
| 965 } | 965 } |
| 966 } | 966 } |
| 967 // The cache is null terminated, therefore the loop above should never | 967 // The cache is null terminated, therefore the loop above should never |
| 968 // terminate by itself. | 968 // terminate by itself. |
| 969 UNREACHABLE(); | 969 UNREACHABLE(); |
| 970 return Code::null(); | 970 return Code::null(); |
| 971 } | 971 } |
| 972 | 972 |
| 973 } // namespace dart | 973 } // namespace dart |
| OLD | NEW |