// Various configuration flags for a compilation, as well as some properties
// of the compiled code produced by a compilation.
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+#define TRACE_TURBO_STATS(V, num) V(TraceTurboStats, trace_turbo_stats, num)
+#else
+#define TRACE_TURBO_STATS(V, num)
+#endif
+
#define FLAGS(V) \
V(FunctionContextSpecializing, function_context_specializing, 0) \
V(Inlining, inlining, 1) \
V(InlineJSWasmCalls, inline_js_wasm_calls, 17) \
V(TurboshaftTraceReduction, turboshaft_trace_reduction, 18) \
V(CouldNotInlineAllCandidates, could_not_inline_all_candidates, 19) \
- V(ShadowStackCompliantLazyDeopt, shadow_stack_compliant_lazy_deopt, 20)
+ V(ShadowStackCompliantLazyDeopt, shadow_stack_compliant_lazy_deopt, 20) \
+ TRACE_TURBO_STATS(V, 21)
enum Flag {
#define DEF_ENUM(Camel, Lower, Bit) k##Camel = 1 << Bit,
return std::move(canonical_handles_);
}
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ const char* stats_turbo_filename() const {
+ return stats_turbo_filename_.get();
+ }
+
+ void set_stats_turbo_filename(std::unique_ptr<char[]> filename) {
+ stats_turbo_filename_ = std::move(filename);
+ }
+
+ size_t source_size() const {
+ return source_size_;
+ }
+
+ void set_source_size(size_t size) {
+ source_size_ = size;
+ }
+#endif
+
private:
void ConfigureFlags();
base::Vector<const char> debug_name_;
std::unique_ptr<char[]> trace_turbo_filename_;
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ std::unique_ptr<char[]> stats_turbo_filename_;
+ size_t source_size_{};
+#endif
TickCounter tick_counter_;
return info->trace_turbo_filename();
}
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+const char* get_cached_stats_turbo_filename(OptimizedCompilationInfo* info) {
+ if (!info->stats_turbo_filename()) {
+ info->set_stats_turbo_filename(
+ GetVisualizerLogFileName(info, v8_flags.trace_turbo_path, nullptr,
+ "txt"));
+ }
+ return info->stats_turbo_filename();
+}
+#endif
+
TurboJsonFile::TurboJsonFile(OptimizedCompilationInfo* info,
std::ios_base::openmode mode)
: std::ofstream(get_cached_trace_turbo_filename(info), mode) {}
TurboJsonFile::~TurboJsonFile() { flush(); }
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+TurboStatsFile::TurboStatsFile(OptimizedCompilationInfo* info,
+ std::ios_base::openmode mode)
+ : std::ofstream(get_cached_stats_turbo_filename(info), mode) {}
+
+TurboStatsFile::~TurboStatsFile() { flush(); }
+#endif
+
TurboCfgFile::TurboCfgFile(Isolate* isolate)
: std::ofstream(Isolate::GetTurboCfgFileName(isolate).c_str(),
std::ios_base::app) {}
: phase_scope_(data->pipeline_statistics(), phase_name),
zone_scope_(data->zone_stats(), phase_name),
origin_scope_(data->node_origins(), phase_name) {
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ data_ = data;
+ phase_name_ = phase_name;
+ if (phase_name_ && data_->info()->trace_turbo_stats()) {
+ TurboStatsFile stats_of(data_->info(), std::ios_base::app);
+ stats_of << "start phase " << phase_name_;
+ stats_of << ": current: "
+ << data_->zone_stats()->GetCurrentAllocatedBytes();
+ stats_of << ", max: "
+ << data_->zone_stats()->GetMaxAllocatedBytes();
+ stats_of << ", total: "
+ << data_->zone_stats()->GetTotalAllocatedBytes();
+ stats_of << "\n";
+ }
+#else
DCHECK_NOT_NULL(phase_name);
+#endif // defined(BUILDING_V8_FOR_TIZEN_TV)
}
#endif // V8_RUNTIME_CALL_STATS
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ PipelineRunScope(const PipelineRunScope&) = delete;
+ PipelineRunScope& operator=(const PipelineRunScope&) = delete;
+ PipelineRunScope(const PipelineRunScope&&) = delete;
+ PipelineRunScope& operator=(const PipelineRunScope&&) = delete;
+
+ ~PipelineRunScope() {
+ if (phase_name_ && data_->info()->trace_turbo_stats()) {
+ TurboStatsFile stats_of(data_->info(), std::ios_base::app);
+ stats_of << "end phase " << phase_name_;
+ stats_of << ": current: "
+ << data_->zone_stats()->GetCurrentAllocatedBytes();
+ stats_of << ", max: "
+ << data_->zone_stats()->GetMaxAllocatedBytes();
+ stats_of << ", total: "
+ << data_->zone_stats()->GetTotalAllocatedBytes();
+ stats_of << "\n";
+ }
+ }
+#endif // defined(BUILDING_V8_FOR_TIZEN_TV)
+
Zone* zone() { return zone_scope_.zone(); }
private:
#ifdef V8_RUNTIME_CALL_STATS
RuntimeCallTimerScope runtime_call_timer_scope;
#endif // V8_RUNTIME_CALL_STATS
+
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ TFPipelineData* data_;
+ const char* phase_name_;
+#endif // defined(BUILDING_V8_FOR_TIZEN_TV)
};
// LocalIsolateScope encapsulates the phase where persistent handles are
graph_reducer->AddReducer(reducer);
}
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+void InitTurboStatsFile(OptimizedCompilationInfo* info) {
+ if (info && info->trace_turbo_stats()) {
+ TurboStatsFile stats_of(info, std::ios_base::trunc);
+ stats_of << "function: " << info->GetDebugName().get() << '\n';
+ stats_of << "code size: " << info->source_size() << '\n';
+ }
+}
+#endif // defined(BUILDING_V8_FOR_TIZEN_TV)
+
TurbofanPipelineStatistics* CreatePipelineStatistics(
Handle<Script> script, OptimizedCompilationInfo* info, Isolate* isolate,
ZoneStats* zone_stats) {
pipeline_statistics->BeginPhaseKind("V8.TFInitializing");
}
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(info);
+#endif
+
if (info->trace_turbo_json()) {
TurboJsonFile json_of(info, std::ios_base::trunc);
json_of << "{\"function\" : ";
pipeline_statistics->BeginPhaseKind("V8.WasmInitializing");
}
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(info);
+#endif
+
if (info->trace_turbo_json()) {
TurboJsonFile json_of(info, std::ios_base::trunc);
std::unique_ptr<char[]> function_name = info->GetDebugName();
PipelineImpl pipeline(&data);
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(&info);
+#endif
+
// Trace initial graph (if requested).
if (info.trace_turbo_json() || info.trace_turbo_graph()) {
CodeTracer::StreamScope tracing_scope(data.GetCodeTracer());
TraceWrapperCompilation("TurboFan", &info, &data);
PipelineImpl pipeline(&data);
+
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(&info);
+#endif
+
pipeline.RunPrintAndVerify("V8.WasmNativeStubMachineCode", true);
pipeline.Run<MemoryOptimizationPhase>();
PipelineImpl pipeline(&data);
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(&info);
+#endif
+
{
turboshaft::PipelineData turboshaft_data(
&zone_stats, turboshaft::TurboshaftPipelineKind::kWasm, nullptr, &info,
PipelineImpl pipeline(&data);
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(info);
+#endif
+
if (data.info()->trace_turbo_json() || data.info()->trace_turbo_graph()) {
CodeTracer::StreamScope tracing_scope(data.GetCodeTracer());
tracing_scope.stream()
PipelineImpl pipeline(&data);
+#if defined(BUILDING_V8_FOR_TIZEN_TV)
+ InitTurboStatsFile(info);
+#endif
+
if (info->trace_turbo_json()) {
TurboJsonFile json_of(info, std::ios_base::trunc);
json_of << "{\"function\":\"" << info->GetDebugName().get()