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

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

Issue 1513883002: Polymorphic calls in precompilation invoke megamorphic calls when tests fail (instead of deoptimizi… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: g Created 5 years 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 DECLARE_FLAG(bool, background_compilation); 49 DECLARE_FLAG(bool, background_compilation);
50 DECLARE_FLAG(bool, code_comments); 50 DECLARE_FLAG(bool, code_comments);
51 DECLARE_FLAG(bool, deoptimize_alot); 51 DECLARE_FLAG(bool, deoptimize_alot);
52 DECLARE_FLAG(int, deoptimize_every); 52 DECLARE_FLAG(int, deoptimize_every);
53 DECLARE_FLAG(charp, deoptimize_filter); 53 DECLARE_FLAG(charp, deoptimize_filter);
54 DECLARE_FLAG(bool, disassemble); 54 DECLARE_FLAG(bool, disassemble);
55 DECLARE_FLAG(bool, disassemble_optimized); 55 DECLARE_FLAG(bool, disassemble_optimized);
56 DECLARE_FLAG(bool, emit_edge_counters); 56 DECLARE_FLAG(bool, emit_edge_counters);
57 DECLARE_FLAG(bool, fields_may_be_reset); 57 DECLARE_FLAG(bool, fields_may_be_reset);
58 DECLARE_FLAG(bool, guess_other_cid); 58 DECLARE_FLAG(bool, guess_icdata_cid);
59 DECLARE_FLAG(bool, ic_range_profiling); 59 DECLARE_FLAG(bool, ic_range_profiling);
60 DECLARE_FLAG(bool, intrinsify); 60 DECLARE_FLAG(bool, intrinsify);
61 DECLARE_FLAG(bool, load_deferred_eagerly); 61 DECLARE_FLAG(bool, load_deferred_eagerly);
62 DECLARE_FLAG(int, optimization_counter_threshold); 62 DECLARE_FLAG(int, optimization_counter_threshold);
63 DECLARE_FLAG(bool, propagate_ic_data); 63 DECLARE_FLAG(bool, propagate_ic_data);
64 DECLARE_FLAG(int, regexp_optimization_counter_threshold); 64 DECLARE_FLAG(int, regexp_optimization_counter_threshold);
65 DECLARE_FLAG(int, reoptimization_counter_threshold); 65 DECLARE_FLAG(int, reoptimization_counter_threshold);
66 DECLARE_FLAG(int, stacktrace_every); 66 DECLARE_FLAG(int, stacktrace_every);
67 DECLARE_FLAG(charp, stacktrace_filter); 67 DECLARE_FLAG(charp, stacktrace_filter);
68 DECLARE_FLAG(bool, support_debugger); 68 DECLARE_FLAG(bool, support_debugger);
(...skipping 21 matching lines...) Expand all
90 FLAG_optimization_counter_threshold = -1; 90 FLAG_optimization_counter_threshold = -1;
91 FLAG_use_field_guards = false; 91 FLAG_use_field_guards = false;
92 FLAG_use_osr = false; 92 FLAG_use_osr = false;
93 FLAG_emit_edge_counters = false; 93 FLAG_emit_edge_counters = false;
94 FLAG_support_debugger = false; 94 FLAG_support_debugger = false;
95 FLAG_ic_range_profiling = false; 95 FLAG_ic_range_profiling = false;
96 FLAG_collect_code = false; 96 FLAG_collect_code = false;
97 FLAG_load_deferred_eagerly = true; 97 FLAG_load_deferred_eagerly = true;
98 FLAG_deoptimize_alot = false; // Used in some tests. 98 FLAG_deoptimize_alot = false; // Used in some tests.
99 FLAG_deoptimize_every = 0; // Used in some tests. 99 FLAG_deoptimize_every = 0; // Used in some tests.
100 FLAG_guess_other_cid = true;
101 Compiler::set_always_optimize(true); 100 Compiler::set_always_optimize(true);
102 // Triggers assert if we try to recompile (e.g., because of deferred 101 // Triggers assert if we try to recompile (e.g., because of deferred
103 // loading, deoptimization, ...). Noopt mode simulates behavior 102 // loading, deoptimization, ...). Noopt mode simulates behavior
104 // of precompiled code, therefore do not allow recompilation. 103 // of precompiled code, therefore do not allow recompilation.
105 Compiler::set_allow_recompilation(false); 104 Compiler::set_allow_recompilation(false);
106 // Precompilation finalizes all classes and thus allows CHA optimizations. 105 // Precompilation finalizes all classes and thus allows CHA optimizations.
107 // Do not require CHA triggered deoptimization. 106 // Do not require CHA triggered deoptimization.
108 FLAG_use_cha_deopt = false; 107 FLAG_use_cha_deopt = false;
109 // Calling the PrintStopMessage stub is not supported in precompiled code 108 // Calling the PrintStopMessage stub is not supported in precompiled code
110 // since it is done at places where no pool pointer is loaded. 109 // since it is done at places where no pool pointer is loaded.
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 ICData::kDeoptPolymorphicInstanceCallTestFail); 1761 ICData::kDeoptPolymorphicInstanceCallTestFail);
1763 Label ok; 1762 Label ok;
1764 EmitTestAndCall(ic_data, argument_count, argument_names, 1763 EmitTestAndCall(ic_data, argument_count, argument_names,
1765 deopt, // No cid match. 1764 deopt, // No cid match.
1766 &ok, // Found cid. 1765 &ok, // Found cid.
1767 deopt_id, token_pos, locs); 1766 deopt_id, token_pos, locs);
1768 assembler()->Bind(&ok); 1767 assembler()->Bind(&ok);
1769 } else { 1768 } else {
1770 // Instead of deoptimizing, do a megamorphic call when no matching 1769 // Instead of deoptimizing, do a megamorphic call when no matching
1771 // cid found. 1770 // cid found.
1772 Label megamorphic, ok; 1771 Label ok;
1772 MegamorphicSlowPath* slow_path =
1773 new MegamorphicSlowPath(ic_data, argument_count, deopt_id,
1774 token_pos, locs, CurrentTryIndex());
1775 AddSlowPathCode(slow_path);
1773 EmitTestAndCall(ic_data, argument_count, argument_names, 1776 EmitTestAndCall(ic_data, argument_count, argument_names,
1774 &megamorphic, // No cid match. 1777 slow_path->entry_label(), // No cid match.
1775 &ok, // Found cid. 1778 &ok, // Found cid.
1776 deopt_id, token_pos, locs); 1779 deopt_id, token_pos, locs);
1777 // Fall through if last test is match. 1780
1778 assembler()->Jump(&ok); 1781 assembler()->Bind(slow_path->exit_label());
1779 assembler()->Bind(&megamorphic);
1780 EmitMegamorphicInstanceCall(ic_data, argument_count, deopt_id,
1781 token_pos, locs);
1782 assembler()->Bind(&ok); 1782 assembler()->Bind(&ok);
1783 } 1783 }
1784 } 1784 }
1785 1785
1786 1786
1787 #if defined(DEBUG) 1787 #if defined(DEBUG)
1788 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { 1788 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) {
1789 ASSERT(!is_optimizing()); 1789 ASSERT(!is_optimizing());
1790 1790
1791 switch (instr->tag()) { 1791 switch (instr->tag()) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 1852
1853 1853
1854 void FlowGraphCompiler::FrameStateClear() { 1854 void FlowGraphCompiler::FrameStateClear() {
1855 ASSERT(!is_optimizing()); 1855 ASSERT(!is_optimizing());
1856 frame_state_.TruncateTo(0); 1856 frame_state_.TruncateTo(0);
1857 } 1857 }
1858 #endif 1858 #endif
1859 1859
1860 1860
1861 } // namespace dart 1861 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698