Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 1190473004: Add flag polymorphic_with_deopt (default true) and handle case when false: use megamorphic instead … (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: g Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 falls through to a megamorphic call");
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
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 deoptimizing, do a megamorphic call when no matching
1693 // cid found.
1694 Label megamorphic, ok;
1695 EmitTestAndCall(ic_data, argument_count, argument_names,
1696 &megamorphic, // No cid match.
1697 &ok, // Found cid.
1698 deopt_id, token_pos, locs);
1699 // Fall through if last test is match.
1700 assembler()->Jump(&ok);
1701 assembler()->Bind(&megamorphic);
1702 EmitMegamorphicInstanceCall(ic_data, argument_count, deopt_id,
1703 token_pos, locs);
1704 assembler()->Bind(&ok);
1705 }
1706 }
1707
1708
1672 #if defined(DEBUG) 1709 #if defined(DEBUG)
1673 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { 1710 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) {
1674 ASSERT(!is_optimizing()); 1711 ASSERT(!is_optimizing());
1675 1712
1676 switch (instr->tag()) { 1713 switch (instr->tag()) {
1677 case Instruction::kPushArgument: 1714 case Instruction::kPushArgument:
1678 case Instruction::kPushTemp: 1715 case Instruction::kPushTemp:
1679 // Do nothing. 1716 // Do nothing.
1680 break; 1717 break;
1681 1718
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 1774
1738 1775
1739 void FlowGraphCompiler::FrameStateClear() { 1776 void FlowGraphCompiler::FrameStateClear() {
1740 ASSERT(!is_optimizing()); 1777 ASSERT(!is_optimizing());
1741 frame_state_.TruncateTo(0); 1778 frame_state_.TruncateTo(0);
1742 } 1779 }
1743 #endif 1780 #endif
1744 1781
1745 1782
1746 } // namespace dart 1783 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698