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