Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 #include "vm/parser.h" | 23 #include "vm/parser.h" |
| 24 #include "vm/raw_object.h" | 24 #include "vm/raw_object.h" |
| 25 #include "vm/stack_frame.h" | 25 #include "vm/stack_frame.h" |
| 26 #include "vm/stub_code.h" | 26 #include "vm/stub_code.h" |
| 27 #include "vm/symbols.h" | 27 #include "vm/symbols.h" |
| 28 | 28 |
| 29 namespace dart { | 29 namespace dart { |
| 30 | 30 |
| 31 DEFINE_FLAG(bool, always_megamorphic_calls, false, | 31 DEFINE_FLAG(bool, always_megamorphic_calls, false, |
| 32 "Instance call always as megamorphic."); | 32 "Instance call always as megamorphic."); |
| 33 DEFINE_FLAG(bool, trace_inlining_intervals, false, | |
| 34 "Inlining interval diagnostics"); | |
| 35 DEFINE_FLAG(bool, enable_simd_inline, true, | 33 DEFINE_FLAG(bool, enable_simd_inline, true, |
| 36 "Enable inlining of SIMD related method calls."); | 34 "Enable inlining of SIMD related method calls."); |
| 37 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, | 35 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, |
| 38 "The minimum invocation count for a function."); | 36 "The minimum invocation count for a function."); |
| 39 DEFINE_FLAG(int, optimization_counter_scale, 2000, | 37 DEFINE_FLAG(int, optimization_counter_scale, 2000, |
| 40 "The scale of invocation count, by size of the function."); | 38 "The scale of invocation count, by size of the function."); |
| 39 DEFINE_FLAG(bool, polymorphic_with_deopt, true, | |
| 40 "Polymorphic calls can be generated so that failure either causes " | |
| 41 "deoptimization or megamorphic call"); | |
|
rmacnak
2015/06/16 20:47:33
causes deoptimization or falls through to a megamo
srdjan
2015/06/16 21:06:12
Done.
| |
| 41 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); | 42 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); |
| 43 DEFINE_FLAG(bool, trace_inlining_intervals, false, | |
| 44 "Inlining interval diagnostics"); | |
| 42 DEFINE_FLAG(bool, use_megamorphic_stub, true, "Out of line megamorphic lookup"); | 45 DEFINE_FLAG(bool, use_megamorphic_stub, true, "Out of line megamorphic lookup"); |
| 43 | 46 |
| 44 DECLARE_FLAG(bool, code_comments); | 47 DECLARE_FLAG(bool, code_comments); |
| 45 DECLARE_FLAG(bool, deoptimize_alot); | 48 DECLARE_FLAG(bool, deoptimize_alot); |
| 46 DECLARE_FLAG(int, deoptimize_every); | 49 DECLARE_FLAG(int, deoptimize_every); |
| 47 DECLARE_FLAG(charp, deoptimize_filter); | 50 DECLARE_FLAG(charp, deoptimize_filter); |
| 48 DECLARE_FLAG(bool, disassemble); | 51 DECLARE_FLAG(bool, disassemble); |
| 49 DECLARE_FLAG(bool, disassemble_optimized); | 52 DECLARE_FLAG(bool, disassemble_optimized); |
| 50 DECLARE_FLAG(bool, emit_edge_counters); | 53 DECLARE_FLAG(bool, emit_edge_counters); |
| 51 DECLARE_FLAG(bool, ic_range_profiling); | 54 DECLARE_FLAG(bool, ic_range_profiling); |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1662 } | 1665 } |
| 1663 const Array& res = Array::Handle( | 1666 const Array& res = Array::Handle( |
| 1664 Array::New(inline_id_to_function_.length(), Heap::kOld)); | 1667 Array::New(inline_id_to_function_.length(), Heap::kOld)); |
| 1665 for (intptr_t i = 0; i < inline_id_to_function_.length(); i++) { | 1668 for (intptr_t i = 0; i < inline_id_to_function_.length(); i++) { |
| 1666 res.SetAt(i, *inline_id_to_function_[i]); | 1669 res.SetAt(i, *inline_id_to_function_[i]); |
| 1667 } | 1670 } |
| 1668 return res.raw(); | 1671 return res.raw(); |
| 1669 } | 1672 } |
| 1670 | 1673 |
| 1671 | 1674 |
| 1675 void FlowGraphCompiler::EmitPolymorphicInstanceCall( | |
| 1676 const ICData& ic_data, | |
| 1677 intptr_t argument_count, | |
| 1678 const Array& argument_names, | |
| 1679 intptr_t deopt_id, | |
| 1680 intptr_t token_pos, | |
| 1681 LocationSummary* locs) { | |
| 1682 if (FLAG_polymorphic_with_deopt) { | |
| 1683 Label* deopt = AddDeoptStub(deopt_id, | |
| 1684 ICData::kDeoptPolymorphicInstanceCallTestFail); | |
| 1685 Label ok; | |
| 1686 EmitTestAndCall(ic_data, argument_count, argument_names, | |
| 1687 deopt, // No cid match. | |
| 1688 &ok, // Found cid. | |
| 1689 deopt_id, token_pos, locs); | |
| 1690 assembler()->Bind(&ok); | |
| 1691 } else { | |
| 1692 // Instead of deoptimization call megamorphic when no matching cid found. | |
|
rmacnak
2015/06/16 20:47:33
Instead of deoptimizing, do a megamorphic call whe
srdjan
2015/06/16 21:06:12
Done.
| |
| 1693 Label megamorphic, ok; | |
| 1694 EmitTestAndCall(ic_data, argument_count, argument_names, | |
| 1695 &megamorphic, // No cid match. | |
| 1696 &ok, // Found cid. | |
| 1697 deopt_id, token_pos, locs); | |
| 1698 // Fall through if last test is match. | |
| 1699 assembler()->Jump(&ok); | |
| 1700 assembler()->Bind(&megamorphic); | |
| 1701 EmitMegamorphicInstanceCall(ic_data, argument_count, deopt_id, | |
| 1702 token_pos, locs); | |
| 1703 assembler()->Bind(&ok); | |
| 1704 } | |
| 1705 } | |
| 1706 | |
| 1707 | |
| 1672 #if defined(DEBUG) | 1708 #if defined(DEBUG) |
| 1673 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { | 1709 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { |
| 1674 ASSERT(!is_optimizing()); | 1710 ASSERT(!is_optimizing()); |
| 1675 | 1711 |
| 1676 switch (instr->tag()) { | 1712 switch (instr->tag()) { |
| 1677 case Instruction::kPushArgument: | 1713 case Instruction::kPushArgument: |
| 1678 case Instruction::kPushTemp: | 1714 case Instruction::kPushTemp: |
| 1679 // Do nothing. | 1715 // Do nothing. |
| 1680 break; | 1716 break; |
| 1681 | 1717 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1737 | 1773 |
| 1738 | 1774 |
| 1739 void FlowGraphCompiler::FrameStateClear() { | 1775 void FlowGraphCompiler::FrameStateClear() { |
| 1740 ASSERT(!is_optimizing()); | 1776 ASSERT(!is_optimizing()); |
| 1741 frame_state_.TruncateTo(0); | 1777 frame_state_.TruncateTo(0); |
| 1742 } | 1778 } |
| 1743 #endif | 1779 #endif |
| 1744 | 1780 |
| 1745 | 1781 |
| 1746 } // namespace dart | 1782 } // namespace dart |
| OLD | NEW |