| 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { | 1616 void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { |
| 1616 ASSERT(pc_descriptors_list_ != NULL); | 1617 ASSERT(pc_descriptors_list_ != NULL); |
| 1617 const PcDescriptors& descriptors = PcDescriptors::Handle( | 1618 const PcDescriptors& descriptors = PcDescriptors::Handle( |
| 1618 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); | 1619 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); |
| 1619 descriptors.Verify(parsed_function_.function().is_optimizable()); | 1620 descriptors.Verify(parsed_function_.function().is_optimizable()); |
| 1620 code.set_pc_descriptors(descriptors); | 1621 code.set_pc_descriptors(descriptors); |
| 1621 } | 1622 } |
| 1622 | 1623 |
| 1623 | 1624 |
| 1624 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { | 1625 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { |
| 1625 // TODO(srdjan): Compute stack maps for optimizing compiler. | 1626 if (stackmap_builder_ == NULL) { |
| 1626 code.set_stackmaps(Array::Handle()); | 1627 // The unoptimizing compiler has no stack maps. |
| 1628 code.set_stackmaps(Array::Handle()); |
| 1629 } else { |
| 1630 // Finalize the stack map array and add it to the code object. |
| 1631 code.set_stackmaps( |
| 1632 Array::Handle(stackmap_builder_->FinalizeStackmaps(code))); |
| 1633 } |
| 1627 } | 1634 } |
| 1628 | 1635 |
| 1629 | 1636 |
| 1630 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { | 1637 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { |
| 1631 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( | 1638 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( |
| 1632 parsed_function_.node_sequence()->scope()->GetVarDescriptors()); | 1639 parsed_function_.node_sequence()->scope()->GetVarDescriptors()); |
| 1633 code.set_var_descriptors(var_descs); | 1640 code.set_var_descriptors(var_descs); |
| 1634 } | 1641 } |
| 1635 | 1642 |
| 1636 | 1643 |
| 1637 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 1644 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
| 1638 ASSERT(exception_handlers_list_ != NULL); | 1645 ASSERT(exception_handlers_list_ != NULL); |
| 1639 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( | 1646 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( |
| 1640 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); | 1647 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); |
| 1641 code.set_exception_handlers(handlers); | 1648 code.set_exception_handlers(handlers); |
| 1642 } | 1649 } |
| 1643 | 1650 |
| 1644 | 1651 |
| 1645 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 1652 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
| 1646 code.set_comments(assembler_->GetCodeComments()); | 1653 code.set_comments(assembler_->GetCodeComments()); |
| 1647 } | 1654 } |
| 1648 | 1655 |
| 1649 #undef __ | 1656 #undef __ |
| 1650 | 1657 |
| 1651 } // namespace dart | 1658 } // namespace dart |
| 1652 | 1659 |
| 1653 #endif // defined TARGET_ARCH_X64 | 1660 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |