| 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 deopt_infos_.Add(stub); | 857 deopt_infos_.Add(stub); |
| 858 return stub->entry_label(); | 858 return stub->entry_label(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 | 861 |
| 862 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 862 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
| 863 ASSERT(exception_handlers_list_ != NULL); | 863 ASSERT(exception_handlers_list_ != NULL); |
| 864 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( | 864 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( |
| 865 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); | 865 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); |
| 866 code.set_exception_handlers(handlers); | 866 code.set_exception_handlers(handlers); |
| 867 INC_STAT(isolate(), total_code_size, |
| 868 ExceptionHandlers::InstanceSize(handlers.num_entries())); |
| 869 INC_STAT(isolate(), total_code_size, handlers.num_entries() * sizeof(uword)); |
| 867 } | 870 } |
| 868 | 871 |
| 869 | 872 |
| 870 void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { | 873 void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { |
| 871 ASSERT(pc_descriptors_list_ != NULL); | 874 ASSERT(pc_descriptors_list_ != NULL); |
| 872 const PcDescriptors& descriptors = PcDescriptors::Handle( | 875 const PcDescriptors& descriptors = PcDescriptors::Handle( |
| 873 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); | 876 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); |
| 874 if (!is_optimizing_) descriptors.Verify(parsed_function_.function()); | 877 if (!is_optimizing_) descriptors.Verify(parsed_function_.function()); |
| 875 code.set_pc_descriptors(descriptors); | 878 code.set_pc_descriptors(descriptors); |
| 876 code.set_entry_patch_pc_offset(entry_patch_pc_offset_); | 879 code.set_entry_patch_pc_offset(entry_patch_pc_offset_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 info.end_pos = 0; | 945 info.end_pos = 0; |
| 943 info.set_index(parsed_function().current_context_var()->index()); | 946 info.set_index(parsed_function().current_context_var()->index()); |
| 944 var_descs.SetVar(0, Symbols::CurrentContextVar(), &info); | 947 var_descs.SetVar(0, Symbols::CurrentContextVar(), &info); |
| 945 } | 948 } |
| 946 code.set_var_descriptors(var_descs); | 949 code.set_var_descriptors(var_descs); |
| 947 } | 950 } |
| 948 | 951 |
| 949 | 952 |
| 950 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { | 953 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
| 951 ASSERT(code.static_calls_target_table() == Array::null()); | 954 ASSERT(code.static_calls_target_table() == Array::null()); |
| 952 code.set_static_calls_target_table( | 955 const Array& targets = |
| 953 Array::Handle(Array::MakeArray(static_calls_target_table_))); | 956 Array::Handle(Array::MakeArray(static_calls_target_table_)); |
| 957 code.set_static_calls_target_table(targets); |
| 958 INC_STAT(isolate(), total_code_size, targets.Length() * sizeof(uword)); |
| 954 } | 959 } |
| 955 | 960 |
| 956 | 961 |
| 957 // Returns 'true' if code generation for this function is complete, i.e., | 962 // Returns 'true' if code generation for this function is complete, i.e., |
| 958 // no fall-through to regular code is needed. | 963 // no fall-through to regular code is needed. |
| 959 void FlowGraphCompiler::TryIntrinsify() { | 964 void FlowGraphCompiler::TryIntrinsify() { |
| 960 // Intrinsification skips arguments checks, therefore disable if in checked | 965 // Intrinsification skips arguments checks, therefore disable if in checked |
| 961 // mode. | 966 // mode. |
| 962 if (FLAG_intrinsify && !isolate()->TypeChecksEnabled()) { | 967 if (FLAG_intrinsify && !isolate()->TypeChecksEnabled()) { |
| 963 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { | 968 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 | 1729 |
| 1725 | 1730 |
| 1726 void FlowGraphCompiler::FrameStateClear() { | 1731 void FlowGraphCompiler::FrameStateClear() { |
| 1727 ASSERT(!is_optimizing()); | 1732 ASSERT(!is_optimizing()); |
| 1728 frame_state_.TruncateTo(0); | 1733 frame_state_.TruncateTo(0); |
| 1729 } | 1734 } |
| 1730 #endif | 1735 #endif |
| 1731 | 1736 |
| 1732 | 1737 |
| 1733 } // namespace dart | 1738 } // namespace dart |
| OLD | NEW |