5#ifndef RUNTIME_VM_SOURCE_REPORT_H_
6#define RUNTIME_VM_SOURCE_REPORT_H_
9#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
48 bool report_lines =
false);
53 bool report_lines =
false);
66 void ClearScriptTable();
72 Thread* thread()
const {
return thread_; }
73 Zone* zone()
const {
return thread_->
zone(); }
74 Isolate* isolate()
const {
return thread_->
isolate(); }
76 bool IsReportRequested(
ReportKind report_kind);
77 bool ShouldSkipFunction(
const Function& func);
78 bool ShouldSkipField(
const Field& field);
79 intptr_t GetScriptIndex(
const Script&
script);
80 bool ScriptIsLoadedByLibrary(
const Script&
script,
const Library& lib);
81 intptr_t GetTokenPosOrLine(
const Script&
script,
82 const TokenPosition& token_pos);
83 bool IsLibraryAlreadyCompiled(
const Library& lib);
84 bool ShouldFiltersIncludeScript(
const Script&
script);
85 bool ShouldFiltersIncludeUrl(
const String& url);
87 void PrintCallSitesData(JSONObject* jsobj,
90 void PrintCoverageData(JSONObject* jsobj,
93 bool report_branch_coverage);
94 void PrintPossibleBreakpointsData(JSONObject* jsobj,
97 void PrintProfileData(JSONObject* jsobj, ProfileFunction* profile_function);
99 void VerifyScriptTable();
101 void PrintScriptTable(JSONArray* jsarr);
103 void VisitFunction(JSONArray* jsarr,
104 const Function& func,
106 void VisitField(JSONArray* jsarr,
109 void VisitLibrary(JSONArray* jsarr,
const Library& lib);
110 void VisitClosures(JSONArray* jsarr);
112 struct ScriptTableEntry {
113 ScriptTableEntry() :
key(nullptr), index(-1),
script(nullptr) {}
121 struct ScriptTableTrait {
122 typedef ScriptTableEntry*
Value;
123 typedef const ScriptTableEntry*
Key;
124 typedef ScriptTableEntry*
Pair;
126 static Key KeyOf(
Pair kv) {
return kv; }
128 static Value ValueOf(
Pair kv) {
return kv; }
132 static inline bool IsKeyEqual(
Pair kv,
Key key) {
133 return kv->script->ptr() ==
key->script->ptr();
137 void CollectAllScripts(
138 DirectChainedHashMap<ScriptTableTrait>* local_script_table,
139 GrowableArray<ScriptTableEntry*>* local_script_table_entries);
141 void CleanupCollectedScripts(
142 DirectChainedHashMap<ScriptTableTrait>* local_script_table,
143 GrowableArray<ScriptTableEntry*>* local_script_table_entries);
145 void CollectConstConstructorCoverageFromScripts(
146 GrowableArray<ScriptTableEntry*>* local_script_table_entries,
149 intptr_t report_set_;
152 const GrowableObjectArray& library_filters_;
153 ZoneCStringSet* libraries_already_compiled_;
155 const Script* script_;
156 TokenPosition start_pos_;
157 TokenPosition end_pos_;
159 GrowableArray<ScriptTableEntry*> script_table_entries_;
160 DirectChainedHashMap<ScriptTableTrait> script_table_;
161 intptr_t next_script_index_;
void PrintJSON(JSONStream *js, const Script &script, TokenPosition start_pos=TokenPosition::kMinSource, TokenPosition end_pos=TokenPosition::kMaxSource)
static const char * kPossibleBreakpointsStr
static const char * kCallSitesStr
static const char * kCoverageStr
static const char * kBranchCoverageStr
SourceReport(intptr_t report_set, CompileMode compile=kNoCompile, bool report_lines=false)
static const char * kProfileStr
Isolate * isolate() const
static const TokenPosition kMaxSource
static const TokenPosition kMinSource
static uint32_t Hash(uint32_t key)