[coverage] Add --trace-block-coverage flag
Tracing block coverage prints raw generated slots in the format: {start_source_position,end_source_position} Slots are printed before being mutated during coverage collection. Bug: v8:6000 Change-Id: I3423e226a124e00c6b13ccd8dddb13d00e4989c7 Reviewed-on: https://chromium-review.googlesource.com/579374 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#46807}
This commit is contained in:
parent
95fdc090ab
commit
512ea51544
@ -290,6 +290,9 @@ DEFINE_IMPLICATION(track_field_types, track_fields)
|
||||
DEFINE_IMPLICATION(track_field_types, track_heap_object_fields)
|
||||
DEFINE_BOOL(type_profile, false, "collect type information")
|
||||
DEFINE_BOOL(block_coverage, false, "collect block coverage information")
|
||||
DEFINE_BOOL(trace_block_coverage, false,
|
||||
"trace collected block coverage information")
|
||||
DEFINE_IMPLICATION(trace_block_coverage, block_coverage)
|
||||
DEFINE_BOOL(feedback_normalization, false,
|
||||
"feed back normalization to constructors")
|
||||
// TODO(jkummerow): This currently adds too much load on the stub cache.
|
||||
|
@ -786,6 +786,9 @@ Handle<BytecodeArray> BytecodeGenerator::FinalizeBytecode(Isolate* isolate) {
|
||||
if (info()->is_block_coverage_enabled()) {
|
||||
info()->set_coverage_info(
|
||||
isolate->factory()->NewCoverageInfo(block_coverage_builder_->slots()));
|
||||
if (FLAG_trace_block_coverage) {
|
||||
info()->coverage_info()->Print(info()->shared_info()->name());
|
||||
}
|
||||
}
|
||||
|
||||
if (HasStackOverflow()) return Handle<BytecodeArray>();
|
||||
|
@ -333,5 +333,25 @@ void CoverageInfo::ResetBlockCount(int slot_index) {
|
||||
set(slot_start + kSlotBlockCountIndex, Smi::kZero);
|
||||
}
|
||||
|
||||
void CoverageInfo::Print(String* function_name) {
|
||||
DCHECK(FLAG_trace_block_coverage);
|
||||
DisallowHeapAllocation no_gc;
|
||||
|
||||
OFStream os(stdout);
|
||||
os << "Coverage info (";
|
||||
if (function_name->length() > 0) {
|
||||
auto function_name_cstr = function_name->ToCString();
|
||||
os << function_name_cstr.get();
|
||||
} else {
|
||||
os << "{anonymous}";
|
||||
}
|
||||
os << "):" << std::endl;
|
||||
|
||||
for (int i = 0; i < SlotCount(); i++) {
|
||||
os << "{" << StartSourcePosition(i) << "," << EndSourcePosition(i) << "}"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -162,6 +162,9 @@ class CoverageInfo : public FixedArray {
|
||||
|
||||
DECL_CAST(CoverageInfo)
|
||||
|
||||
// Print debug info.
|
||||
void Print(String* function_name);
|
||||
|
||||
private:
|
||||
static int FirstIndexForSlot(int slot_index) {
|
||||
return kFirstSlotIndex + slot_index * kSlotIndexCount;
|
||||
|
Loading…
Reference in New Issue
Block a user