Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: src/debug/debug.cc

Issue 2882973002: [coverage] Block coverage with support for IfStatements (Closed)
Patch Set: Address comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-coverage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 2ba0a54d46c41e3f47c708fbef1a9b6daba56758..8789991d494dcc18d0494237371f51f055f6e322 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -488,6 +488,8 @@ void Debug::Unload() {
// Return debugger is not loaded.
if (!is_loaded()) return;
+ if (FLAG_block_coverage) RemoveAllCoverageInfos();
+
// Clear debugger context global handle.
GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location());
debug_context_ = Handle<Context>();
@@ -821,20 +823,10 @@ void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
// Clear out all the debug break code.
void Debug::ClearAllBreakPoints() {
- DebugInfoListNode* prev = nullptr;
- DebugInfoListNode* current = debug_info_list_;
- while (current != nullptr) {
- DebugInfoListNode* next = current->next();
- Handle<DebugInfo> debug_info = current->debug_info();
- ClearBreakPoints(debug_info);
- if (debug_info->ClearBreakInfo()) {
- FreeDebugInfoListNode(prev, current);
- current = next;
- } else {
- prev = current;
- current = next;
- }
- }
+ ClearAllDebugInfos([=](Handle<DebugInfo> info) {
+ ClearBreakPoints(info);
+ return info->ClearBreakInfo();
+ });
}
void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared,
@@ -1618,6 +1610,25 @@ Handle<DebugInfo> Debug::GetOrCreateDebugInfo(
return debug_info;
}
+void Debug::InstallCoverageInfo(Handle<SharedFunctionInfo> shared,
+ Handle<CoverageInfo> coverage_info) {
+ DCHECK(FLAG_block_coverage);
+ DCHECK(!coverage_info.is_null());
+
+ Handle<DebugInfo> debug_info = GetOrCreateDebugInfo(shared);
+
+ DCHECK(!debug_info->HasCoverageInfo());
+
+ debug_info->set_flags(debug_info->flags() | DebugInfo::kHasCoverageInfo);
+ debug_info->set_coverage_info(*coverage_info);
+}
+
+void Debug::RemoveAllCoverageInfos() {
+ DCHECK(FLAG_block_coverage);
+ ClearAllDebugInfos(
+ [=](Handle<DebugInfo> info) { return info->ClearCoverageInfo(); });
+}
+
void Debug::FindDebugInfo(Handle<DebugInfo> debug_info,
DebugInfoListNode** prev, DebugInfoListNode** curr) {
HandleScope scope(isolate_);
@@ -1632,6 +1643,22 @@ void Debug::FindDebugInfo(Handle<DebugInfo> debug_info,
UNREACHABLE();
}
+void Debug::ClearAllDebugInfos(DebugInfoClearFunction clear_function) {
+ DebugInfoListNode* prev = nullptr;
+ DebugInfoListNode* current = debug_info_list_;
+ while (current != nullptr) {
+ DebugInfoListNode* next = current->next();
+ Handle<DebugInfo> debug_info = current->debug_info();
+ if (clear_function(debug_info)) {
+ FreeDebugInfoListNode(prev, current);
+ current = next;
+ } else {
+ prev = current;
+ current = next;
+ }
+ }
+}
+
void Debug::RemoveBreakInfoAndMaybeFree(Handle<DebugInfo> debug_info) {
bool should_unlink = debug_info->ClearBreakInfo();
if (should_unlink) {
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-coverage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698