Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
dart::SourceReport Class Reference

#include <source_report.h>

Public Types

enum  ReportKind {
  kCallSites = 0x1 , kCoverage = 0x2 , kPossibleBreakpoints = 0x4 , kProfile = 0x8 ,
  kBranchCoverage = 0x10
}
 
enum  CompileMode { kNoCompile , kForceCompile }
 

Public Member Functions

 SourceReport (intptr_t report_set, CompileMode compile=kNoCompile, bool report_lines=false)
 
 SourceReport (intptr_t report_set, const GrowableObjectArray &library_filters, ZoneCStringSet *libraries_already_compiled=nullptr, CompileMode compile=kNoCompile, bool report_lines=false)
 
 ~SourceReport ()
 
void PrintJSON (JSONStream *js, const Script &script, TokenPosition start_pos=TokenPosition::kMinSource, TokenPosition end_pos=TokenPosition::kMaxSource)
 

Static Public Attributes

static const char * kCallSitesStr = "_CallSites"
 
static const char * kCoverageStr = "Coverage"
 
static const char * kPossibleBreakpointsStr = "PossibleBreakpoints"
 
static const char * kProfileStr = "_Profile"
 
static const char * kBranchCoverageStr = "BranchCoverage"
 

Detailed Description

Definition at line 23 of file source_report.h.

Member Enumeration Documentation

◆ CompileMode

Enumerator
kNoCompile 
kForceCompile 

Definition at line 39 of file source_report.h.

◆ ReportKind

Enumerator
kCallSites 
kCoverage 
kPossibleBreakpoints 
kProfile 
kBranchCoverage 

Definition at line 25 of file source_report.h.

Constructor & Destructor Documentation

◆ SourceReport() [1/2]

dart::SourceReport::SourceReport ( intptr_t  report_set,
CompileMode  compile = kNoCompile,
bool  report_lines = false 
)
explicit

Definition at line 26 of file source_report.cc.

29 : report_set_(report_set),
30 compile_mode_(compile_mode),
31 report_lines_(report_lines),
32 library_filters_(GrowableObjectArray::Handle()),
33 libraries_already_compiled_(nullptr),
34 thread_(nullptr),
35 script_(nullptr),
36 start_pos_(TokenPosition::kMinSource),
38 next_script_index_(0) {}
static Object & Handle()
Definition: object.h:407
static const TokenPosition kMaxSource
static const TokenPosition kMinSource

◆ SourceReport() [2/2]

dart::SourceReport::SourceReport ( intptr_t  report_set,
const GrowableObjectArray library_filters,
ZoneCStringSet libraries_already_compiled = nullptr,
CompileMode  compile = kNoCompile,
bool  report_lines = false 
)
explicit

Definition at line 40 of file source_report.cc.

45 : report_set_(report_set),
46 compile_mode_(compile_mode),
47 report_lines_(report_lines),
48 library_filters_(library_filters),
49 libraries_already_compiled_(libraries_already_compiled),
50 thread_(nullptr),
51 script_(nullptr),
52 start_pos_(TokenPosition::kMinSource),
54 next_script_index_(0) {}

◆ ~SourceReport()

dart::SourceReport::~SourceReport ( )

Definition at line 56 of file source_report.cc.

56 {
57 ClearScriptTable();
58}

Member Function Documentation

◆ PrintJSON()

void dart::SourceReport::PrintJSON ( JSONStream js,
const Script script,
TokenPosition  start_pos = TokenPosition::kMinSource,
TokenPosition  end_pos = TokenPosition::kMaxSource 
)

Definition at line 670 of file source_report.cc.

673 {
674 Init(Thread::Current(), &script, start_pos, end_pos);
675
676 JSONObject report(js);
677 report.AddProperty("type", "SourceReport");
678 {
679 JSONArray ranges(&report, "ranges");
680
681 const GrowableObjectArray& libs = GrowableObjectArray::Handle(
682 zone(), thread()->isolate_group()->object_store()->libraries());
683
684 // We only visit the libraries which actually load the specified script.
685 Library& lib = Library::Handle(zone());
686 for (intptr_t i = 0; i < libs.Length(); i++) {
687 lib ^= libs.At(i);
688 if (script.IsNull() || ScriptIsLoadedByLibrary(script, lib)) {
689 VisitLibrary(&ranges, lib);
690 }
691 }
692
693 // Visit all closures for this isolate.
694 VisitClosures(&ranges);
695
696 // Output constant coverage if coverage is requested.
697 if (IsReportRequested(kCoverage)) {
698 // Find all scripts. We need to go though all scripts because a script
699 // (even one we don't want) can add coverage to another library (i.e.
700 // potentially one we want).
701 DirectChainedHashMap<ScriptTableTrait> local_script_table;
702 GrowableArray<ScriptTableEntry*> local_script_table_entries;
703 CollectAllScripts(&local_script_table, &local_script_table_entries);
704 CollectConstConstructorCoverageFromScripts(&local_script_table_entries,
705 &ranges);
706 CleanupCollectedScripts(&local_script_table, &local_script_table_entries);
707 }
708 }
709
710 // Print the script table.
711 JSONArray scripts(&report, "scripts");
712 PrintScriptTable(&scripts);
713}
static Thread * Current()
Definition: thread.h:362
scripts
Printing Glyph Map Stats.

Member Data Documentation

◆ kBranchCoverageStr

const char * dart::SourceReport::kBranchCoverageStr = "BranchCoverage"
static

Definition at line 37 of file source_report.h.

◆ kCallSitesStr

const char * dart::SourceReport::kCallSitesStr = "_CallSites"
static

Definition at line 33 of file source_report.h.

◆ kCoverageStr

const char * dart::SourceReport::kCoverageStr = "Coverage"
static

Definition at line 34 of file source_report.h.

◆ kPossibleBreakpointsStr

const char * dart::SourceReport::kPossibleBreakpointsStr = "PossibleBreakpoints"
static

Definition at line 35 of file source_report.h.

◆ kProfileStr

const char * dart::SourceReport::kProfileStr = "_Profile"
static

Definition at line 36 of file source_report.h.


The documentation for this class was generated from the following files: