Index: runtime/vm/flow_graph_builder.cc |
=================================================================== |
--- runtime/vm/flow_graph_builder.cc (revision 43426) |
+++ runtime/vm/flow_graph_builder.cc (working copy) |
@@ -56,6 +56,17 @@ |
1.4426950408889634, 0.4342944819032518, 3.1415926535897932, |
0.7071067811865476, 1.4142135623730951}; |
+ |
+static bool TypeChecksEnabled() { |
+ return FLAG_enable_type_checks || Isolate::Current()->checked_mode(); |
+} |
+ |
+ |
+static bool AssertsEnabled() { |
+ return FLAG_enable_asserts || Isolate::Current()->checked_mode(); |
+} |
+ |
+ |
uword FlowGraphBuilder::FindDoubleConstant(double value) { |
intptr_t len = sizeof(kCommonDoubleConstants) / sizeof(double); // NOLINT |
for (intptr_t i = 0; i < len; i++) { |
@@ -889,7 +900,7 @@ |
void TestGraphVisitor::ReturnValue(Value* value) { |
- if (FLAG_enable_type_checks || FLAG_enable_asserts) { |
+ if (TypeChecksEnabled() || AssertsEnabled()) { |
value = Bind(new(I) AssertBooleanInstr(condition_token_pos(), value)); |
} |
Value* constant_true = Bind(new(I) ConstantInstr(Bool::True())); |
@@ -924,7 +935,7 @@ |
false)); // No number check. |
} else { |
branch = new(I) BranchInstr(comp); |
- branch->set_is_checked(FLAG_enable_type_checks); |
+ branch->set_is_checked(TypeChecksEnabled()); |
} |
AddInstruction(branch); |
CloseFragment(); |
@@ -934,7 +945,7 @@ |
void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateInstr* neg) { |
- ASSERT(!FLAG_enable_type_checks); |
+ ASSERT(!TypeChecksEnabled()); |
Value* constant_true = Bind(new(I) ConstantInstr(Bool::True())); |
StrictCompareInstr* comp = |
new(I) StrictCompareInstr(condition_token_pos(), |
@@ -956,7 +967,7 @@ |
MergeBranchWithComparison(comp); |
return; |
} |
- if (!FLAG_enable_type_checks) { |
+ if (!TypeChecksEnabled()) { |
BooleanNegateInstr* neg = definition->AsBooleanNegate(); |
if (neg != NULL) { |
MergeBranchWithNegate(neg); |
@@ -1045,7 +1056,7 @@ |
RawPcDescriptors::kRuntimeCall)); |
} |
- if (FLAG_enable_type_checks) { |
+ if (TypeChecksEnabled()) { |
const bool is_implicit_dynamic_getter = |
(!function.is_static() && |
((function.kind() == RawFunction::kImplicitGetter) || |
@@ -1244,7 +1255,7 @@ |
TestGraphVisitor for_left(owner(), node->left()->token_pos()); |
node->left()->Visit(&for_left); |
EffectGraphVisitor empty(owner()); |
- if (FLAG_enable_type_checks || FLAG_enable_asserts) { |
+ if (TypeChecksEnabled() || AssertsEnabled()) { |
ValueGraphVisitor for_right(owner()); |
node->right()->Visit(&for_right); |
Value* right_value = for_right.value(); |
@@ -1309,7 +1320,7 @@ |
ValueGraphVisitor for_right(owner()); |
node->right()->Visit(&for_right); |
Value* right_value = for_right.value(); |
- if (FLAG_enable_type_checks|| FLAG_enable_asserts) { |
+ if (TypeChecksEnabled()|| AssertsEnabled()) { |
right_value = |
for_right.Bind(new(I) AssertBooleanInstr(node->right()->token_pos(), |
right_value)); |
@@ -1768,7 +1779,7 @@ |
2, |
owner()->ic_data_array()); |
if (node->kind() == Token::kNE) { |
- if (FLAG_enable_type_checks || FLAG_enable_asserts) { |
+ if (TypeChecksEnabled() || AssertsEnabled()) { |
Value* value = Bind(result); |
result = new(I) AssertBooleanInstr(node->token_pos(), value); |
} |
@@ -1814,7 +1825,7 @@ |
node->operand()->Visit(&for_value); |
Append(for_value); |
Value* value = for_value.value(); |
- if (FLAG_enable_type_checks || FLAG_enable_asserts) { |
+ if (TypeChecksEnabled() || AssertsEnabled()) { |
value = |
Bind(new(I) AssertBooleanInstr(node->operand()->token_pos(), value)); |
} |
@@ -3417,7 +3428,7 @@ |
node->value()->Visit(&for_value); |
Append(for_value); |
Value* store_value = for_value.value(); |
- if (FLAG_enable_type_checks) { |
+ if (TypeChecksEnabled()) { |
store_value = BuildAssignableValue(node->value()->token_pos(), |
store_value, |
node->local().type(), |
@@ -3458,7 +3469,7 @@ |
node->value()->Visit(&for_value); |
Append(for_value); |
Value* store_value = for_value.value(); |
- if (FLAG_enable_type_checks) { |
+ if (TypeChecksEnabled()) { |
const AbstractType& type = |
AbstractType::ZoneHandle(I, node->field().type()); |
const String& dst_name = String::ZoneHandle(I, node->field().name()); |
@@ -3820,7 +3831,7 @@ |
} |
} |
- if (FLAG_enable_type_checks && is_top_level_sequence) { |
+ if (TypeChecksEnabled() && is_top_level_sequence) { |
const Function& function = owner()->function(); |
const int num_params = function.NumParameters(); |
int pos = 0; |