[vm] Remove special casing for late error throws
Since https://dart-review.googlesource.com/c/sdk/+/355000 landed, we don't need to special case the coverage collector to ignore throws of late initialization errors. TEST=No behavior changes, so using CI Change-Id: I3bce5409f32f48c53035181dbd4c27e3570fbf2b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355600 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Liam Appelbe <liama@google.com>
This commit is contained in:
committed by
Commit Queue
parent
d976ce5b13
commit
082fdca1c9
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user