| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 FLAG_deoptimize_filter) != NULL) { | 220 FLAG_deoptimize_filter) != NULL) { |
| 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->HasParallelMove() && | 228 return !block->HasParallelMove() && |
| 229 block->next()->IsGoto() && | 229 block->next()->IsGoto() && |
| 230 !block->next()->AsGoto()->HasParallelMove(); | 230 !block->next()->AsGoto()->HasParallelMove() && |
| 231 !block->IsIndirectEntry(); |
| 231 } | 232 } |
| 232 | 233 |
| 233 | 234 |
| 234 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { | 235 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { |
| 235 BlockInfo* block_info = block_info_[block->postorder_number()]; | 236 BlockInfo* block_info = block_info_[block->postorder_number()]; |
| 236 | 237 |
| 237 // Break out of cycles in the control flow graph. | 238 // Break out of cycles in the control flow graph. |
| 238 if (block_info->is_marked()) { | 239 if (block_info->is_marked()) { |
| 239 return; | 240 return; |
| 240 } | 241 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 BlockEntryInstr* entry = block_order()[i]; | 348 BlockEntryInstr* entry = block_order()[i]; |
| 348 assembler()->Comment("B%" Pd "", entry->block_id()); | 349 assembler()->Comment("B%" Pd "", entry->block_id()); |
| 349 set_current_block(entry); | 350 set_current_block(entry); |
| 350 | 351 |
| 351 if (WasCompacted(entry)) { | 352 if (WasCompacted(entry)) { |
| 352 continue; | 353 continue; |
| 353 } | 354 } |
| 354 | 355 |
| 355 LoopInfoComment(assembler(), *entry, *loop_headers); | 356 LoopInfoComment(assembler(), *entry, *loop_headers); |
| 356 | 357 |
| 358 entry->set_offset(assembler()->CodeSize()); |
| 357 entry->EmitNativeCode(this); | 359 entry->EmitNativeCode(this); |
| 358 // Compile all successors until an exit, branch, or a block entry. | 360 // Compile all successors until an exit, branch, or a block entry. |
| 359 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 361 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| 360 Instruction* instr = it.Current(); | 362 Instruction* instr = it.Current(); |
| 361 if (FLAG_code_comments || | 363 if (FLAG_code_comments || |
| 362 FLAG_disassemble || | 364 FLAG_disassemble || |
| 363 FLAG_disassemble_optimized) { | 365 FLAG_disassemble_optimized) { |
| 364 if (FLAG_source_lines) { | 366 if (FLAG_source_lines) { |
| 365 EmitSourceLine(instr); | 367 EmitSourceLine(instr); |
| 366 } | 368 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 } else { | 800 } else { |
| 799 // Finalize the stack map array and add it to the code object. | 801 // Finalize the stack map array and add it to the code object. |
| 800 ASSERT(is_optimizing()); | 802 ASSERT(is_optimizing()); |
| 801 code.set_stackmaps( | 803 code.set_stackmaps( |
| 802 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); | 804 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); |
| 803 } | 805 } |
| 804 } | 806 } |
| 805 | 807 |
| 806 | 808 |
| 807 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { | 809 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { |
| 808 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( | 810 if (flow_graph().IsIrregexpFunction()) { |
| 809 parsed_function_.node_sequence()->scope()->GetVarDescriptors( | 811 code.set_var_descriptors(LocalVarDescriptors::Handle()); |
| 810 parsed_function_.function())); | 812 } else { |
| 811 code.set_var_descriptors(var_descs); | 813 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( |
| 814 parsed_function_.node_sequence()->scope()->GetVarDescriptors( |
| 815 parsed_function_.function())); |
| 816 code.set_var_descriptors(var_descs); |
| 817 } |
| 812 } | 818 } |
| 813 | 819 |
| 814 | 820 |
| 815 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { | 821 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
| 816 ASSERT(code.static_calls_target_table() == Array::null()); | 822 ASSERT(code.static_calls_target_table() == Array::null()); |
| 817 code.set_static_calls_target_table( | 823 code.set_static_calls_target_table( |
| 818 Array::Handle(Array::MakeArray(static_calls_target_table_))); | 824 Array::Handle(Array::MakeArray(static_calls_target_table_))); |
| 819 } | 825 } |
| 820 | 826 |
| 821 | 827 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 threshold = FLAG_optimization_counter_scale * basic_blocks + | 1476 threshold = FLAG_optimization_counter_scale * basic_blocks + |
| 1471 FLAG_min_optimization_counter_threshold; | 1477 FLAG_min_optimization_counter_threshold; |
| 1472 if (threshold > FLAG_optimization_counter_threshold) { | 1478 if (threshold > FLAG_optimization_counter_threshold) { |
| 1473 threshold = FLAG_optimization_counter_threshold; | 1479 threshold = FLAG_optimization_counter_threshold; |
| 1474 } | 1480 } |
| 1475 } | 1481 } |
| 1476 return threshold; | 1482 return threshold; |
| 1477 } | 1483 } |
| 1478 | 1484 |
| 1479 } // namespace dart | 1485 } // namespace dart |
| OLD | NEW |