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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } else { | 817 } else { |
816 // Finalize the stack map array and add it to the code object. | 818 // Finalize the stack map array and add it to the code object. |
817 ASSERT(is_optimizing()); | 819 ASSERT(is_optimizing()); |
818 code.set_stackmaps( | 820 code.set_stackmaps( |
819 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); | 821 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); |
820 } | 822 } |
821 } | 823 } |
822 | 824 |
823 | 825 |
824 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { | 826 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { |
| 827 if (parsed_function().node_sequence() == NULL) { |
| 828 ASSERT(flow_graph().IsIrregexpFunction()); |
| 829 return; |
| 830 } |
| 831 |
825 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( | 832 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( |
826 parsed_function_.node_sequence()->scope()->GetVarDescriptors( | 833 parsed_function_.node_sequence()->scope()->GetVarDescriptors( |
827 parsed_function_.function())); | 834 parsed_function_.function())); |
828 code.set_var_descriptors(var_descs); | 835 code.set_var_descriptors(var_descs); |
829 } | 836 } |
830 | 837 |
831 | 838 |
832 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { | 839 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
833 ASSERT(code.static_calls_target_table() == Array::null()); | 840 ASSERT(code.static_calls_target_table() == Array::null()); |
834 code.set_static_calls_target_table( | 841 code.set_static_calls_target_table( |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 threshold = FLAG_optimization_counter_scale * basic_blocks + | 1494 threshold = FLAG_optimization_counter_scale * basic_blocks + |
1488 FLAG_min_optimization_counter_threshold; | 1495 FLAG_min_optimization_counter_threshold; |
1489 if (threshold > FLAG_optimization_counter_threshold) { | 1496 if (threshold > FLAG_optimization_counter_threshold) { |
1490 threshold = FLAG_optimization_counter_threshold; | 1497 threshold = FLAG_optimization_counter_threshold; |
1491 } | 1498 } |
1492 } | 1499 } |
1493 return threshold; | 1500 return threshold; |
1494 } | 1501 } |
1495 | 1502 |
1496 } // namespace dart | 1503 } // namespace dart |
OLD | NEW |