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" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/debugger.h" | 12 #include "vm/debugger.h" |
13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
14 #include "vm/exceptions.h" | 14 #include "vm/exceptions.h" |
15 #include "vm/flow_graph_allocator.h" | 15 #include "vm/flow_graph_allocator.h" |
16 #include "vm/il_printer.h" | 16 #include "vm/il_printer.h" |
17 #include "vm/intrinsifier.h" | 17 #include "vm/intrinsifier.h" |
18 #include "vm/locations.h" | 18 #include "vm/locations.h" |
19 #include "vm/log.h" | 19 #include "vm/log.h" |
20 #include "vm/longjump.h" | 20 #include "vm/longjump.h" |
21 #include "vm/object_store.h" | 21 #include "vm/object_store.h" |
22 #include "vm/parser.h" | 22 #include "vm/parser.h" |
23 #include "vm/raw_object.h" | 23 #include "vm/raw_object.h" |
24 #include "vm/stack_frame.h" | 24 #include "vm/stack_frame.h" |
25 #include "vm/stub_code.h" | 25 #include "vm/stub_code.h" |
26 #include "vm/symbols.h" | 26 #include "vm/symbols.h" |
27 | 27 |
28 namespace dart { | 28 namespace dart { |
29 | 29 |
| 30 DEFINE_FLAG(bool, always_megamorphic_calls, false, |
| 31 "Instance call always as megamorphic."); |
30 DEFINE_FLAG(bool, trace_inlining_intervals, false, | 32 DEFINE_FLAG(bool, trace_inlining_intervals, false, |
31 "Inlining interval diagnostics"); | 33 "Inlining interval diagnostics"); |
32 DEFINE_FLAG(bool, enable_simd_inline, true, | 34 DEFINE_FLAG(bool, enable_simd_inline, true, |
33 "Enable inlining of SIMD related method calls."); | 35 "Enable inlining of SIMD related method calls."); |
34 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, | 36 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, |
35 "The minimum invocation count for a function."); | 37 "The minimum invocation count for a function."); |
36 DEFINE_FLAG(int, optimization_counter_scale, 2000, | 38 DEFINE_FLAG(int, optimization_counter_scale, 2000, |
37 "The scale of invocation count, by size of the function."); | 39 "The scale of invocation count, by size of the function."); |
38 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); | 40 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); |
39 | 41 |
40 DECLARE_FLAG(bool, code_comments); | 42 DECLARE_FLAG(bool, code_comments); |
41 DECLARE_FLAG(int, deoptimize_every); | 43 DECLARE_FLAG(int, deoptimize_every); |
42 DECLARE_FLAG(charp, deoptimize_filter); | 44 DECLARE_FLAG(charp, deoptimize_filter); |
43 DECLARE_FLAG(bool, disassemble); | 45 DECLARE_FLAG(bool, disassemble); |
44 DECLARE_FLAG(bool, disassemble_optimized); | 46 DECLARE_FLAG(bool, disassemble_optimized); |
45 DECLARE_FLAG(bool, emit_edge_counters); | 47 DECLARE_FLAG(bool, emit_edge_counters); |
46 DECLARE_FLAG(bool, enable_type_checks); | 48 DECLARE_FLAG(bool, enable_type_checks); |
47 DECLARE_FLAG(bool, intrinsify); | 49 DECLARE_FLAG(bool, intrinsify); |
48 DECLARE_FLAG(int, optimization_counter_threshold); | 50 DECLARE_FLAG(int, optimization_counter_threshold); |
49 DECLARE_FLAG(bool, propagate_ic_data); | 51 DECLARE_FLAG(bool, propagate_ic_data); |
50 DECLARE_FLAG(int, regexp_optimization_counter_threshold); | 52 DECLARE_FLAG(int, regexp_optimization_counter_threshold); |
51 DECLARE_FLAG(int, reoptimization_counter_threshold); | 53 DECLARE_FLAG(int, reoptimization_counter_threshold); |
52 DECLARE_FLAG(int, stacktrace_every); | 54 DECLARE_FLAG(int, stacktrace_every); |
53 DECLARE_FLAG(charp, stacktrace_filter); | 55 DECLARE_FLAG(charp, stacktrace_filter); |
54 DECLARE_FLAG(bool, use_cha); | 56 DECLARE_FLAG(bool, use_cha); |
| 57 DECLARE_FLAG(bool, use_field_guards); |
55 DECLARE_FLAG(bool, use_osr); | 58 DECLARE_FLAG(bool, use_osr); |
56 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 59 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
57 | 60 |
| 61 static void NooptModeHandler(bool value) { |
| 62 if (value) { |
| 63 FLAG_always_megamorphic_calls = value; |
| 64 FLAG_optimization_counter_threshold = -1; |
| 65 FLAG_use_field_guards = false; |
| 66 FLAG_use_osr = false; |
| 67 } |
| 68 } |
| 69 |
| 70 |
| 71 // --noopt disables optimizer and tunes unoptimized code to run as fast |
| 72 // as possible. |
| 73 DEFINE_FLAG_HANDLER(NooptModeHandler, |
| 74 noopt, |
| 75 "Run fast unoptimized code only."); |
| 76 |
| 77 |
58 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 78 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
59 // with PushArgument. Recursively allocates from outermost to innermost | 79 // with PushArgument. Recursively allocates from outermost to innermost |
60 // environment. | 80 // environment. |
61 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( | 81 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( |
62 Environment* env, | 82 Environment* env, |
63 intptr_t* stack_height) { | 83 intptr_t* stack_height) { |
64 if (env == NULL) return; | 84 if (env == NULL) return; |
65 AllocateIncomingParametersRecursive(env->outer(), stack_height); | 85 AllocateIncomingParametersRecursive(env->outer(), stack_height); |
66 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { | 86 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { |
67 if (it.CurrentLocation().IsInvalid() && | 87 if (it.CurrentLocation().IsInvalid() && |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 assembler()->Bind(&intrinsic_slow_path_label_); | 996 assembler()->Bind(&intrinsic_slow_path_label_); |
977 } | 997 } |
978 | 998 |
979 | 999 |
980 void FlowGraphCompiler::GenerateInstanceCall( | 1000 void FlowGraphCompiler::GenerateInstanceCall( |
981 intptr_t deopt_id, | 1001 intptr_t deopt_id, |
982 intptr_t token_pos, | 1002 intptr_t token_pos, |
983 intptr_t argument_count, | 1003 intptr_t argument_count, |
984 LocationSummary* locs, | 1004 LocationSummary* locs, |
985 const ICData& ic_data) { | 1005 const ICData& ic_data) { |
| 1006 if (FLAG_always_megamorphic_calls) { |
| 1007 EmitMegamorphicInstanceCall(ic_data, argument_count, |
| 1008 deopt_id, token_pos, locs); |
| 1009 return; |
| 1010 } |
986 ASSERT(!ic_data.IsNull()); | 1011 ASSERT(!ic_data.IsNull()); |
987 uword label_address = 0; | 1012 uword label_address = 0; |
988 StubCode* stub_code = isolate()->stub_code(); | 1013 StubCode* stub_code = isolate()->stub_code(); |
989 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { | 1014 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
990 // Emit IC call that will count and thus may need reoptimization at | 1015 // Emit IC call that will count and thus may need reoptimization at |
991 // function entry. | 1016 // function entry. |
992 ASSERT(!is_optimizing() | 1017 ASSERT(!is_optimizing() |
993 || may_reoptimize() | 1018 || may_reoptimize() |
994 || flow_graph().IsCompiledForOsr()); | 1019 || flow_graph().IsCompiledForOsr()); |
995 switch (ic_data.NumArgsTested()) { | 1020 switch (ic_data.NumArgsTested()) { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 | 1714 |
1690 | 1715 |
1691 void FlowGraphCompiler::FrameStateClear() { | 1716 void FlowGraphCompiler::FrameStateClear() { |
1692 ASSERT(!is_optimizing()); | 1717 ASSERT(!is_optimizing()); |
1693 frame_state_.TruncateTo(0); | 1718 frame_state_.TruncateTo(0); |
1694 } | 1719 } |
1695 #endif | 1720 #endif |
1696 | 1721 |
1697 | 1722 |
1698 } // namespace dart | 1723 } // namespace dart |
OLD | NEW |