chromium/third_party/perfetto/src/trace_processor/importers/proto/v8_tracker.cc

/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/importers/proto/v8_tracker.h"

#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>

#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/base64.h"
#include "perfetto/ext/base/flat_hash_map.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/protozero/field.h"
#include "perfetto/trace_processor/trace_blob.h"
#include "perfetto/trace_processor/trace_blob_view.h"
#include "protos/perfetto/trace/chrome/v8.pbzero.h"
#include "src/trace_processor/importers/common/address_range.h"
#include "src/trace_processor/importers/common/jit_cache.h"
#include "src/trace_processor/importers/common/mapping_tracker.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/proto/jit_tracker.h"
#include "src/trace_processor/importers/proto/string_encoding_utils.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/tables/jit_tables_py.h"
#include "src/trace_processor/tables/v8_tables_py.h"
#include "src/trace_processor/types/trace_processor_context.h"

namespace perfetto {
namespace trace_processor {
namespace {

InternedV8Isolate;
InternedV8JsFunction;
InternedV8JsScript;
InternedV8WasmScript;
V8InternalCode;
V8JsCode;
V8RegExpCode;
V8String;
V8WasmCode;

bool IsInterpretedCode(const V8JsCode::Decoder& code) {}

bool IsNativeCode(const V8JsCode::Decoder& code) {}

base::StringView JsScriptTypeToString(int32_t type) {}

base::StringView JsFunctionKindToString(int32_t kind) {}

base::StringView JsCodeTierToString(int32_t tier) {}

base::StringView InternalCodeTypeToString(int32_t type) {}

base::StringView WasmCodeTierToString(int32_t tier) {}

}  // namespace

V8Tracker::V8Tracker(TraceProcessorContext* context) :{}

V8Tracker::~V8Tracker() = default;

std::optional<IsolateId> V8Tracker::InternIsolate(protozero::ConstBytes bytes) {}

UserMemoryMapping* V8Tracker::FindEmbeddedBlobMapping(
    UniquePid upid,
    AddressRange embedded_blob_code) const {}

std::pair<V8Tracker::IsolateCodeRanges, bool> V8Tracker::GetIsolateCodeRanges(
    UniquePid upid,
    const protos::pbzero::InternedV8Isolate::Decoder& isolate) {}

AddressRangeMap<JitCache*> V8Tracker::CreateJitCaches(
    UniquePid upid,
    const IsolateCodeRanges& code_ranges) {}

AddressRangeMap<JitCache*> V8Tracker::GetOrCreateSharedJitCaches(
    UniquePid upid,
    const IsolateCodeRanges& code_ranges) {}

IsolateId V8Tracker::CreateIsolate(
    const InternedV8Isolate::Decoder& isolate_proto) {}

tables::V8IsolateTable::ConstRowReference V8Tracker::InsertIsolate(
    const InternedV8Isolate::Decoder& isolate) {}

tables::V8JsScriptTable::Id V8Tracker::InternJsScript(
    protozero::ConstBytes bytes,
    IsolateId isolate_id) {}

tables::V8WasmScriptTable::Id V8Tracker::InternWasmScript(
    protozero::ConstBytes bytes,
    IsolateId isolate_id) {}

tables::V8JsFunctionTable::Id V8Tracker::InternJsFunction(
    protozero::ConstBytes bytes,
    StringId name,
    tables::V8JsScriptTable::Id script_id) {}

JitCache* V8Tracker::MaybeFindJitCache(IsolateId isolate_id,
                                       AddressRange code_range) const {}

JitCache* V8Tracker::FindJitCache(IsolateId isolate_id,
                                  AddressRange code_range) const {}

void V8Tracker::AddJsCode(int64_t timestamp,
                          UniqueTid utid,
                          IsolateId isolate_id,
                          tables::V8JsFunctionTable::Id function_id,
                          const V8JsCode::Decoder& code) {}

void V8Tracker::AddInternalCode(int64_t timestamp,
                                UniqueTid utid,
                                IsolateId isolate_id,
                                const V8InternalCode::Decoder& code) {}

void V8Tracker::AddWasmCode(int64_t timestamp,
                            UniqueTid utid,
                            IsolateId isolate_id,
                            tables::V8WasmScriptTable::Id script_id,
                            const V8WasmCode::Decoder& code) {}

void V8Tracker::AddRegExpCode(int64_t timestamp,
                              UniqueTid utid,
                              IsolateId isolate_id,
                              const V8RegExpCode::Decoder& code) {}

StringId V8Tracker::InternV8String(const V8String::Decoder& v8_string) {}

}  // namespace trace_processor
}  // namespace perfetto