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

Unified Diff: src/runtime/runtime-debug.cc

Issue 2882973002: [coverage] Block coverage with support for IfStatements (Closed)
Patch Set: Comment nit Created 3 years, 7 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
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index b65757b2de4957df4070fb4dee50359b995fec1b..cbc46caf24661664b0659a019788100324f48c21 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -1965,5 +1965,28 @@ RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) {
+ SealHandleScope shs(isolate);
+ CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
+ Coverage::SelectMode(isolate, enable ? debug::Coverage::kBlockBinary
+ : debug::Coverage::kBestEffort);
+ return isolate->heap()->undefined_value();
+}
+
+RUNTIME_FUNCTION(Runtime_IncBlockCounter) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 0);
rmcilroy 2017/05/18 14:17:59 Unused?
jgruber 2017/05/22 09:43:32 The vector is needed to get to the SFI below.
rmcilroy 2017/05/22 11:08:46 Sorry missed this. It's more normal to get the SFI
jgruber 2017/05/22 11:10:08 Sure, will do.
+ CONVERT_SMI_ARG_CHECKED(slot_index, 1);
rmcilroy 2017/05/18 14:17:59 coverage_array_slot
jgruber 2017/05/22 09:43:32 Done.
+
+ DCHECK(FLAG_block_coverage);
+
+ SharedFunctionInfo* shared = vector->shared_function_info();
+ CoverageInfo* coverage_info = CoverageInfo::cast(shared->coverage_info());
+ coverage_info->IncrementBlockCount(slot_index);
+
+ return isolate->heap()->undefined_value();
+}
+
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698