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 FLAG_always_megamorphic_calls = value; | |
63 FLAG_optimization_counter_threshold = -1; | |
Florian Schneider
2015/05/01 20:47:58
Will this handler called ever with (value == false
srdjan
2015/05/01 20:55:11
Done.
| |
64 FLAG_use_field_guards = false; | |
Florian Schneider
2015/05/01 20:47:58
FLAG_use_osr = false;
to avoid generating OSR che
srdjan
2015/05/01 20:55:11
Done.
| |
65 } | |
66 | |
67 | |
68 // --unopt disables optimizer and tunes unoptimized code to run as fast | |
Florian Schneider
2015/05/01 20:47:58
s/unopt/noopt/
srdjan
2015/05/01 20:55:11
Done.
| |
69 // as possible. | |
70 DEFINE_FLAG_HANDLER(NooptModeHandler, | |
71 noopt, | |
72 "Run fast unoptimized code only."); | |
73 | |
74 | |
58 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 75 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
59 // with PushArgument. Recursively allocates from outermost to innermost | 76 // with PushArgument. Recursively allocates from outermost to innermost |
60 // environment. | 77 // environment. |
61 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( | 78 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( |
62 Environment* env, | 79 Environment* env, |
63 intptr_t* stack_height) { | 80 intptr_t* stack_height) { |
64 if (env == NULL) return; | 81 if (env == NULL) return; |
65 AllocateIncomingParametersRecursive(env->outer(), stack_height); | 82 AllocateIncomingParametersRecursive(env->outer(), stack_height); |
66 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { | 83 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { |
67 if (it.CurrentLocation().IsInvalid() && | 84 if (it.CurrentLocation().IsInvalid() && |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
976 assembler()->Bind(&intrinsic_slow_path_label_); | 993 assembler()->Bind(&intrinsic_slow_path_label_); |
977 } | 994 } |
978 | 995 |
979 | 996 |
980 void FlowGraphCompiler::GenerateInstanceCall( | 997 void FlowGraphCompiler::GenerateInstanceCall( |
981 intptr_t deopt_id, | 998 intptr_t deopt_id, |
982 intptr_t token_pos, | 999 intptr_t token_pos, |
983 intptr_t argument_count, | 1000 intptr_t argument_count, |
984 LocationSummary* locs, | 1001 LocationSummary* locs, |
985 const ICData& ic_data) { | 1002 const ICData& ic_data) { |
1003 if (FLAG_always_megamorphic_calls) { | |
1004 EmitMegamorphicInstanceCall(ic_data, argument_count, | |
1005 deopt_id, token_pos, locs); | |
1006 return; | |
1007 } | |
986 ASSERT(!ic_data.IsNull()); | 1008 ASSERT(!ic_data.IsNull()); |
987 uword label_address = 0; | 1009 uword label_address = 0; |
988 StubCode* stub_code = isolate()->stub_code(); | 1010 StubCode* stub_code = isolate()->stub_code(); |
989 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { | 1011 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
990 // Emit IC call that will count and thus may need reoptimization at | 1012 // Emit IC call that will count and thus may need reoptimization at |
991 // function entry. | 1013 // function entry. |
992 ASSERT(!is_optimizing() | 1014 ASSERT(!is_optimizing() |
993 || may_reoptimize() | 1015 || may_reoptimize() |
994 || flow_graph().IsCompiledForOsr()); | 1016 || flow_graph().IsCompiledForOsr()); |
995 switch (ic_data.NumArgsTested()) { | 1017 switch (ic_data.NumArgsTested()) { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1689 | 1711 |
1690 | 1712 |
1691 void FlowGraphCompiler::FrameStateClear() { | 1713 void FlowGraphCompiler::FrameStateClear() { |
1692 ASSERT(!is_optimizing()); | 1714 ASSERT(!is_optimizing()); |
1693 frame_state_.TruncateTo(0); | 1715 frame_state_.TruncateTo(0); |
1694 } | 1716 } |
1695 #endif | 1717 #endif |
1696 | 1718 |
1697 | 1719 |
1698 } // namespace dart | 1720 } // namespace dart |
OLD | NEW |