Index: runtime/vm/flow_graph_builder.cc |
=================================================================== |
--- runtime/vm/flow_graph_builder.cc (revision 36530) |
+++ runtime/vm/flow_graph_builder.cc (working copy) |
@@ -42,7 +42,9 @@ |
DECLARE_FLAG(bool, enable_type_checks); |
DECLARE_FLAG(bool, warning_as_error); |
DECLARE_FLAG(bool, silent_warnings); |
+DECLARE_FLAG(int, optimization_counter_threshold); |
+DECLARE_FLAG(bool, enable_debugger); |
// TODO(srdjan): Allow compiler to add constants as they are encountered in |
// the compilation. |
@@ -999,7 +1001,7 @@ |
// statements for which there is no associated source position. |
const Function& function = owner()->parsed_function()->function(); |
if ((node->token_pos() != Scanner::kNoSourcePos) && |
- !function.is_native()) { |
+ !function.is_native() && FLAG_enable_debugger) { |
AddInstruction(new DebugStepCheckInstr(node->token_pos(), |
PcDescriptors::kReturn)); |
} |
@@ -3108,8 +3110,10 @@ |
// call. |
if (node->value()->IsLiteralNode() || |
node->value()->IsLoadLocalNode()) { |
- AddInstruction(new DebugStepCheckInstr(node->token_pos(), |
- PcDescriptors::kRuntimeCall)); |
+ if (FLAG_enable_debugger) { |
+ AddInstruction(new DebugStepCheckInstr(node->token_pos(), |
+ PcDescriptors::kRuntimeCall)); |
+ } |
} |
ValueGraphVisitor for_value(owner()); |
@@ -3166,14 +3170,16 @@ |
dst_name); |
} |
- store_value = Bind(BuildStoreExprTemp(store_value)); |
- GuardFieldInstr* guard = |
- new GuardFieldInstr(store_value, |
- node->field(), |
- Isolate::Current()->GetNextDeoptId()); |
- AddInstruction(guard); |
+ if (FLAG_optimization_counter_threshold >= 0) { |
+ store_value = Bind(BuildStoreExprTemp(store_value)); |
+ GuardFieldInstr* guard = |
+ new GuardFieldInstr(store_value, |
+ node->field(), |
+ Isolate::Current()->GetNextDeoptId()); |
+ AddInstruction(guard); |
+ store_value = Bind(BuildLoadExprTemp()); |
+ } |
- store_value = Bind(BuildLoadExprTemp()); |
StoreInstanceFieldInstr* store = |
new StoreInstanceFieldInstr(node->field(), |
for_instance.value(), |
@@ -3519,12 +3525,15 @@ |
!function.is_native()) { |
// Always allocate CheckOverflowInstr so that deopt-ids match regardless |
// if we inline or not. |
- CheckStackOverflowInstr* check = |
- new CheckStackOverflowInstr(function.token_pos(), 0); |
- // If we are inlining don't actually attach the stack check. We must still |
- // create the stack check in order to allocate a deopt id. |
- if (!owner()->IsInlining()) { |
- AddInstruction(check); |
+ if (!function.IsImplicitGetterFunction() && |
+ !function.IsImplicitSetterFunction()) { |
+ CheckStackOverflowInstr* check = |
+ new CheckStackOverflowInstr(function.token_pos(), 0); |
+ // If we are inlining don't actually attach the stack check. We must still |
+ // create the stack check in order to allocate a deopt id. |
+ if (!owner()->IsInlining()) { |
+ AddInstruction(check); |
+ } |
} |
} |