chromium/v8/src/diagnostics/perf-jit.cc

// Copyright 2016 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
//       copyright notice, this list of conditions and the following
//       disclaimer in the documentation and/or other materials provided
//       with the distribution.
//     * Neither the name of Google Inc. nor the names of its
//       contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/diagnostics/perf-jit.h"

#include "src/common/assert-scope.h"
#include "src/flags/flags.h"

// Only compile the {LinuxPerfJitLogger} on Linux.
#if V8_OS_LINUX

#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>

#include <memory>

#include "src/base/platform/wrappers.h"
#include "src/codegen/assembler.h"
#include "src/codegen/source-position-table.h"
#include "src/diagnostics/eh-frame.h"
#include "src/objects/code-kind.h"
#include "src/objects/objects-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/utils/ostreams.h"

#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-code-manager.h"
#endif  // V8_ENABLE_WEBASSEMBLY

namespace v8 {
namespace internal {

base::LazyRecursiveMutex& GetFileMutex() {}

struct PerfJitHeader {};

struct PerfJitBase {};

struct PerfJitCodeLoad : PerfJitBase {};

struct PerfJitDebugEntry {};

struct PerfJitCodeDebugInfo : PerfJitBase {};

struct PerfJitCodeUnwindingInfo : PerfJitBase {};

const char LinuxPerfJitLogger::kFilenameFormatString[] =;

// Extra padding for the PID in the filename
const int LinuxPerfJitLogger::kFilenameBufferPadding =;

static const char kStringTerminator[] =;

// The following static variables are protected by
// GetFileMutex().
int LinuxPerfJitLogger::process_id_ =;
uint64_t LinuxPerfJitLogger::reference_count_ =;
void* LinuxPerfJitLogger::marker_address_ =;
uint64_t LinuxPerfJitLogger::code_index_ =;
FILE* LinuxPerfJitLogger::perf_output_handle_ =;

void LinuxPerfJitLogger::OpenJitDumpFile() {}

void LinuxPerfJitLogger::CloseJitDumpFile() {}

void* LinuxPerfJitLogger::OpenMarkerFile(int fd) {}

void LinuxPerfJitLogger::CloseMarkerFile(void* marker_address) {}

LinuxPerfJitLogger::LinuxPerfJitLogger(Isolate* isolate)
    :{}

LinuxPerfJitLogger::~LinuxPerfJitLogger() {}

uint64_t LinuxPerfJitLogger::GetTimestamp() {}

void LinuxPerfJitLogger::LogRecordedBuffer(
    Tagged<AbstractCode> abstract_code,
    MaybeHandle<SharedFunctionInfo> maybe_sfi, const char* name, int length) {}

#if V8_ENABLE_WEBASSEMBLY
void LinuxPerfJitLogger::LogRecordedBuffer(const wasm::WasmCode* code,
                                           const char* name, int length) {}
#endif  // V8_ENABLE_WEBASSEMBLY

void LinuxPerfJitLogger::WriteJitCodeLoadEntry(const uint8_t* code_pointer,
                                               uint32_t code_size,
                                               const char* name,
                                               int name_length) {}

namespace {

constexpr char kUnknownScriptNameString[] =;
constexpr size_t kUnknownScriptNameStringLen =;

namespace {
base::Vector<const char> GetScriptName(Tagged<Object> maybeScript,
                                       std::unique_ptr<char[]>* storage,
                                       const DisallowGarbageCollection& no_gc) {}

}  // namespace

SourcePositionInfo GetSourcePositionInfo(Isolate* isolate, Tagged<Code> code,
                                         Handle<SharedFunctionInfo> function,
                                         SourcePosition pos) {}

}  // namespace

void LinuxPerfJitLogger::LogWriteDebugInfo(Tagged<Code> code,
                                           Handle<SharedFunctionInfo> shared) {}

#if V8_ENABLE_WEBASSEMBLY
void LinuxPerfJitLogger::LogWriteDebugInfo(const wasm::WasmCode* code) {}
#endif  // V8_ENABLE_WEBASSEMBLY

void LinuxPerfJitLogger::LogWriteUnwindingInfo(Tagged<Code> code) {}

void LinuxPerfJitLogger::LogWriteBytes(const char* bytes, int size) {}

void LinuxPerfJitLogger::LogWriteHeader() {}

}  // namespace internal
}  // namespace v8

#endif  // V8_OS_LINUX