| 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/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 Assembler* assembler, | 84 Assembler* assembler, |
| 85 const ParsedFunction& parsed_function, | 85 const ParsedFunction& parsed_function, |
| 86 const GrowableArray<BlockEntryInstr*>& block_order, | 86 const GrowableArray<BlockEntryInstr*>& block_order, |
| 87 bool is_optimizing) | 87 bool is_optimizing) |
| 88 : FlowGraphVisitor(block_order), | 88 : FlowGraphVisitor(block_order), |
| 89 assembler_(assembler), | 89 assembler_(assembler), |
| 90 parsed_function_(parsed_function), | 90 parsed_function_(parsed_function), |
| 91 block_info_(block_order.length()), | 91 block_info_(block_order.length()), |
| 92 current_block_(NULL), | 92 current_block_(NULL), |
| 93 pc_descriptors_list_(NULL), | 93 pc_descriptors_list_(NULL), |
| 94 stackmap_builder_(NULL), |
| 94 exception_handlers_list_(NULL), | 95 exception_handlers_list_(NULL), |
| 95 deopt_stubs_(), | 96 deopt_stubs_(), |
| 96 is_optimizing_(is_optimizing) { | 97 is_optimizing_(is_optimizing) { |
| 97 } | 98 } |
| 98 | 99 |
| 99 | 100 |
| 100 void FlowGraphCompiler::InitCompiler() { | 101 void FlowGraphCompiler::InitCompiler() { |
| 101 pc_descriptors_list_ = new DescriptorList(); | 102 pc_descriptors_list_ = new DescriptorList(); |
| 102 exception_handlers_list_ = new ExceptionHandlerList(); | 103 exception_handlers_list_ = new ExceptionHandlerList(); |
| 103 block_info_.Clear(); | 104 block_info_.Clear(); |
| (...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { | 1694 void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { |
| 1694 ASSERT(pc_descriptors_list_ != NULL); | 1695 ASSERT(pc_descriptors_list_ != NULL); |
| 1695 const PcDescriptors& descriptors = PcDescriptors::Handle( | 1696 const PcDescriptors& descriptors = PcDescriptors::Handle( |
| 1696 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); | 1697 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); |
| 1697 descriptors.Verify(parsed_function_.function().is_optimizable()); | 1698 descriptors.Verify(parsed_function_.function().is_optimizable()); |
| 1698 code.set_pc_descriptors(descriptors); | 1699 code.set_pc_descriptors(descriptors); |
| 1699 } | 1700 } |
| 1700 | 1701 |
| 1701 | 1702 |
| 1702 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { | 1703 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { |
| 1703 // TODO(srdjan): Compute stack maps for optimizing compiler. | 1704 if (stackmap_builder_ == NULL) { |
| 1704 code.set_stackmaps(Array::Handle()); | 1705 // The unoptimizing compiler has no stack maps. |
| 1706 code.set_stackmaps(Array::Handle()); |
| 1707 } else { |
| 1708 // Finalize the stack map array and add it to the code object. |
| 1709 code.set_stackmaps( |
| 1710 Array::Handle(stackmap_builder_->FinalizeStackmaps(code))); |
| 1711 } |
| 1705 } | 1712 } |
| 1706 | 1713 |
| 1707 | 1714 |
| 1708 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { | 1715 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { |
| 1709 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( | 1716 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( |
| 1710 parsed_function_.node_sequence()->scope()->GetVarDescriptors()); | 1717 parsed_function_.node_sequence()->scope()->GetVarDescriptors()); |
| 1711 code.set_var_descriptors(var_descs); | 1718 code.set_var_descriptors(var_descs); |
| 1712 } | 1719 } |
| 1713 | 1720 |
| 1714 | 1721 |
| 1715 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 1722 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
| 1716 ASSERT(exception_handlers_list_ != NULL); | 1723 ASSERT(exception_handlers_list_ != NULL); |
| 1717 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( | 1724 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( |
| 1718 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); | 1725 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); |
| 1719 code.set_exception_handlers(handlers); | 1726 code.set_exception_handlers(handlers); |
| 1720 } | 1727 } |
| 1721 | 1728 |
| 1722 | 1729 |
| 1723 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 1730 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
| 1724 code.set_comments(assembler_->GetCodeComments()); | 1731 code.set_comments(assembler_->GetCodeComments()); |
| 1725 } | 1732 } |
| 1726 | 1733 |
| 1727 #undef __ | 1734 #undef __ |
| 1728 | 1735 |
| 1729 } // namespace dart | 1736 } // namespace dart |
| 1730 | 1737 |
| 1731 #endif // defined TARGET_ARCH_X64 | 1738 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |