Index: src/debug/debug-coverage.cc |
diff --git a/src/debug/debug-coverage.cc b/src/debug/debug-coverage.cc |
index 8a13b6c92dc5facc5e738d6eb5e673a8b5098fcb..25d80cedf00012ef191774e768d1b491595ff45b 100644 |
--- a/src/debug/debug-coverage.cc |
+++ b/src/debug/debug-coverage.cc |
@@ -103,27 +103,16 @@ Coverage* Coverage::Collect(Isolate* isolate, bool reset_count) { |
std::vector<CoverageFunction>* functions = &result->back().functions; |
std::vector<SharedFunctionInfo*> sorted; |
- bool has_toplevel = false; |
{ |
// Sort functions by start position, from outer to inner functions. |
SharedFunctionInfo::ScriptIterator infos(script_handle); |
while (SharedFunctionInfo* info = infos.Next()) { |
- has_toplevel |= info->is_toplevel(); |
sorted.push_back(info); |
} |
std::sort(sorted.begin(), sorted.end(), CompareSharedFunctionInfo); |
} |
- functions->reserve(sorted.size() + (has_toplevel ? 0 : 1)); |
- |
- if (!has_toplevel) { |
- // Add a replacement toplevel function if it does not exist. |
- int source_end = String::cast(script->source())->length(); |
- functions->emplace_back(0, source_end, 1u, |
- isolate->factory()->empty_string()); |
- } |
- |
// Use sorted list to reconstruct function nesting. |
for (SharedFunctionInfo* info : sorted) { |
int start = StartPosition(info); |