| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return true; | 221 return true; |
| 222 } | 222 } |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 | 225 |
| 226 | 226 |
| 227 static bool IsEmptyBlock(BlockEntryInstr* block) { | 227 static bool IsEmptyBlock(BlockEntryInstr* block) { |
| 228 return !block->IsCatchBlockEntry() && | 228 return !block->IsCatchBlockEntry() && |
| 229 !block->HasNonRedundantParallelMove() && | 229 !block->HasNonRedundantParallelMove() && |
| 230 block->next()->IsGoto() && | 230 block->next()->IsGoto() && |
| 231 !block->next()->AsGoto()->HasNonRedundantParallelMove(); | 231 !block->next()->AsGoto()->HasNonRedundantParallelMove() && |
| 232 !block->IsIndirectEntry(); |
| 232 } | 233 } |
| 233 | 234 |
| 234 | 235 |
| 235 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { | 236 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { |
| 236 BlockInfo* block_info = block_info_[block->postorder_number()]; | 237 BlockInfo* block_info = block_info_[block->postorder_number()]; |
| 237 | 238 |
| 238 // Break out of cycles in the control flow graph. | 239 // Break out of cycles in the control flow graph. |
| 239 if (block_info->is_marked()) { | 240 if (block_info->is_marked()) { |
| 240 return; | 241 return; |
| 241 } | 242 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 BlockEntryInstr* entry = block_order()[i]; | 349 BlockEntryInstr* entry = block_order()[i]; |
| 349 assembler()->Comment("B%" Pd "", entry->block_id()); | 350 assembler()->Comment("B%" Pd "", entry->block_id()); |
| 350 set_current_block(entry); | 351 set_current_block(entry); |
| 351 | 352 |
| 352 if (WasCompacted(entry)) { | 353 if (WasCompacted(entry)) { |
| 353 continue; | 354 continue; |
| 354 } | 355 } |
| 355 | 356 |
| 356 LoopInfoComment(assembler(), *entry, *loop_headers); | 357 LoopInfoComment(assembler(), *entry, *loop_headers); |
| 357 | 358 |
| 359 entry->set_offset(assembler()->CodeSize()); |
| 358 entry->EmitNativeCode(this); | 360 entry->EmitNativeCode(this); |
| 359 // Compile all successors until an exit, branch, or a block entry. | 361 // Compile all successors until an exit, branch, or a block entry. |
| 360 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 362 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| 361 Instruction* instr = it.Current(); | 363 Instruction* instr = it.Current(); |
| 362 if (FLAG_code_comments || | 364 if (FLAG_code_comments || |
| 363 FLAG_disassemble || | 365 FLAG_disassemble || |
| 364 FLAG_disassemble_optimized) { | 366 FLAG_disassemble_optimized) { |
| 365 if (FLAG_source_lines) { | 367 if (FLAG_source_lines) { |
| 366 EmitSourceLine(instr); | 368 EmitSourceLine(instr); |
| 367 } | 369 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 } else { | 822 } else { |
| 821 // Finalize the stack map array and add it to the code object. | 823 // Finalize the stack map array and add it to the code object. |
| 822 ASSERT(is_optimizing()); | 824 ASSERT(is_optimizing()); |
| 823 code.set_stackmaps( | 825 code.set_stackmaps( |
| 824 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); | 826 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); |
| 825 } | 827 } |
| 826 } | 828 } |
| 827 | 829 |
| 828 | 830 |
| 829 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { | 831 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { |
| 832 if (parsed_function().node_sequence() == NULL) { |
| 833 ASSERT(flow_graph().IsIrregexpFunction()); |
| 834 return; |
| 835 } |
| 836 |
| 830 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( | 837 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( |
| 831 parsed_function_.node_sequence()->scope()->GetVarDescriptors( | 838 parsed_function_.node_sequence()->scope()->GetVarDescriptors( |
| 832 parsed_function_.function())); | 839 parsed_function_.function())); |
| 833 code.set_var_descriptors(var_descs); | 840 code.set_var_descriptors(var_descs); |
| 834 } | 841 } |
| 835 | 842 |
| 836 | 843 |
| 837 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { | 844 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
| 838 ASSERT(code.static_calls_target_table() == Array::null()); | 845 ASSERT(code.static_calls_target_table() == Array::null()); |
| 839 code.set_static_calls_target_table( | 846 code.set_static_calls_target_table( |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 case kUnboxedMint: | 1517 case kUnboxedMint: |
| 1511 return mint_class(); | 1518 return mint_class(); |
| 1512 default: | 1519 default: |
| 1513 UNREACHABLE(); | 1520 UNREACHABLE(); |
| 1514 return Class::ZoneHandle(); | 1521 return Class::ZoneHandle(); |
| 1515 } | 1522 } |
| 1516 } | 1523 } |
| 1517 | 1524 |
| 1518 | 1525 |
| 1519 } // namespace dart | 1526 } // namespace dart |
| OLD | NEW |