Index: runtime/vm/intermediate_language.cc |
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc |
index a4d70faf9b5a513af6b9a315108e3234a4cefd57..7f54b49b44c705d0766f1e67d971d01a93d9a8fb 100644 |
--- a/runtime/vm/intermediate_language.cc |
+++ b/runtime/vm/intermediate_language.cc |
@@ -31,6 +31,9 @@ DEFINE_FLAG(bool, propagate_ic_data, true, |
"Propagate IC data from unoptimized to optimized IC calls."); |
DEFINE_FLAG(bool, two_args_smi_icd, true, |
"Generate special IC stubs for two args Smi operations"); |
+DEFINE_FLAG(bool, ic_range_profiling, true, |
+ "Generate special IC stubs collecting range information " |
+ "for binary and unary arithmetic operations"); |
DEFINE_FLAG(bool, unbox_numeric_fields, true, |
"Support unboxed double and float32x4 fields."); |
DECLARE_FLAG(bool, enable_type_checks); |
@@ -2886,6 +2889,19 @@ void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
ExternalLabel target_label(label_address); |
compiler->EmitInstanceCall(&target_label, *call_ic_data, ArgumentCount(), |
deopt_id(), token_pos(), locs()); |
+ } else if (FLAG_ic_range_profiling && |
+ (Token::IsBinaryArithmeticOperator(token_kind()) || |
+ Token::IsUnaryArithmeticOperator(token_kind()))) { |
+ ASSERT(Token::IsUnaryArithmeticOperator(token_kind()) == |
+ (ArgumentCount() == 1)); |
+ ASSERT(Token::IsBinaryArithmeticOperator(token_kind()) == |
+ (ArgumentCount() == 2)); |
+ StubCode* stub_code = isolate->stub_code(); |
+ ExternalLabel target_label((ArgumentCount() == 1) ? |
+ stub_code->UnaryRangeCollectingInlineCacheEntryPoint() : |
+ stub_code->BinaryRangeCollectingInlineCacheEntryPoint()); |
+ compiler->EmitInstanceCall(&target_label, *call_ic_data, ArgumentCount(), |
+ deopt_id(), token_pos(), locs()); |
} else { |
compiler->GenerateInstanceCall(deopt_id(), |
token_pos(), |