diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc index b5500515203..e039309eeb2 100644 --- a/runtime/vm/source_report.cc +++ b/runtime/vm/source_report.cc @@ -330,29 +330,6 @@ intptr_t SourceReport::GetTokenPosOrLine(const Script& script, return line; } -bool SourceReport::ShouldCoverageSkipCallSite(const ICData* ic_data) { - if (ic_data == nullptr) return true; - if (!ic_data->is_static_call()) return false; - Function& func = Function::Handle(ic_data->GetTargetAt(0)); - - // Ignore calls to the LateError functions. These are used to throw errors to - // do with late variables. These errors shouldn't be hit in working code, so - // shouldn't count against the coverage total. - // See https://github.com/dart-lang/coverage/issues/341 - if (late_error_class_id_ == ClassId::kIllegalCid) { - const auto& dart_internal = Library::Handle(Library::InternalLibrary()); - const auto& late_error_class = - Class::Handle(dart_internal.LookupClass(Symbols::LateError())); - ASSERT(!late_error_class.IsNull()); - late_error_class_id_ = late_error_class.id(); - } - Class& cls = Class::Handle(func.Owner()); - if (late_error_class_id_ == cls.id()) { - return true; - } - return false; -} - void SourceReport::PrintCoverageData(JSONObject* jsobj, const Function& function, const Code& code, @@ -386,7 +363,7 @@ void SourceReport::PrintCoverageData(JSONObject* jsobj, } auto update_coverage = [&](TokenPosition token_pos, bool was_executed) { - if (!token_pos.IsWithin(begin_pos, end_pos)) { + if (!(token_pos.IsReal() && token_pos.IsWithin(begin_pos, end_pos))) { return; } @@ -408,7 +385,7 @@ void SourceReport::PrintCoverageData(JSONObject* jsobj, HANDLESCOPE(thread()); ASSERT(iter.DeoptId() < ic_data_array->length()); const ICData* ic_data = (*ic_data_array)[iter.DeoptId()]; - if (!ShouldCoverageSkipCallSite(ic_data)) { + if (ic_data != nullptr) { const TokenPosition& token_pos = iter.TokenPos(); update_coverage(token_pos, ic_data->AggregateCount() > 0); } diff --git a/runtime/vm/source_report.h b/runtime/vm/source_report.h index a4f7c11fb8a..5a1cecb7f30 100644 --- a/runtime/vm/source_report.h +++ b/runtime/vm/source_report.h @@ -76,7 +76,6 @@ class SourceReport { bool IsReportRequested(ReportKind report_kind); bool ShouldSkipFunction(const Function& func); bool ShouldSkipField(const Field& field); - bool ShouldCoverageSkipCallSite(const ICData* ic_data); intptr_t GetScriptIndex(const Script& script); bool ScriptIsLoadedByLibrary(const Script& script, const Library& lib); intptr_t GetTokenPosOrLine(const Script& script,