Remove --perf-prof flag on non-linux
The fuzzers picked up this flag, and are now complaining that they run into UNREACHABLE/FATAL too often because the {PerfJitLogger} is not implemented on non-linux platforms. This CL removes the flag if it's not supported, so users get a warning about the unknown flag, but otherwise it's ignored. This should unblock the fuzzers, and slightly reduces binary size on non-linux. R=ahaas@chromium.org Bug: chromium:1035233 Change-Id: I6b9282318bc82ff23173bc83ae31cb2d8cbdcdb7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1993969 Commit-Queue: Clemens Backes <clemensb@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#65695}
This commit is contained in:
parent
b44f8abb2a
commit
25f242ad76
@ -27,6 +27,12 @@
|
||||
|
||||
#include "src/diagnostics/perf-jit.h"
|
||||
|
||||
// Only compile the {PerfJitLogger} on Linux.
|
||||
#if V8_OS_LINUX
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <memory>
|
||||
|
||||
#include "src/codegen/assembler.h"
|
||||
@ -38,19 +44,9 @@
|
||||
#include "src/utils/ostreams.h"
|
||||
#include "src/wasm/wasm-code-manager.h"
|
||||
|
||||
#if V8_OS_LINUX
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
// jumbo: conflicts with v8::internal::InstanceType::MAP_TYPE
|
||||
#undef MAP_TYPE // NOLINT
|
||||
#include <unistd.h>
|
||||
#endif // V8_OS_LINUX
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
#if V8_OS_LINUX
|
||||
|
||||
struct PerfJitHeader {
|
||||
uint32_t magic_;
|
||||
uint32_t version_;
|
||||
@ -524,6 +520,7 @@ void PerfJitLogger::LogWriteHeader() {
|
||||
LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header));
|
||||
}
|
||||
|
||||
#endif // V8_OS_LINUX
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_OS_LINUX
|
||||
|
@ -28,13 +28,16 @@
|
||||
#ifndef V8_DIAGNOSTICS_PERF_JIT_H_
|
||||
#define V8_DIAGNOSTICS_PERF_JIT_H_
|
||||
|
||||
#include "include/v8config.h"
|
||||
|
||||
// {PerfJitLogger} is only implemented on Linux.
|
||||
#if V8_OS_LINUX
|
||||
|
||||
#include "src/logging/log.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
#if V8_OS_LINUX
|
||||
|
||||
// Linux perf tool logging support.
|
||||
class PerfJitLogger : public CodeEventLogger {
|
||||
public:
|
||||
@ -121,37 +124,9 @@ class PerfJitLogger : public CodeEventLogger {
|
||||
static uint64_t code_index_;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// PerfJitLogger is only implemented on Linux.
|
||||
class PerfJitLogger : public CodeEventLogger {
|
||||
public:
|
||||
explicit PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {}
|
||||
|
||||
void CodeMoveEvent(AbstractCode from, AbstractCode to) override {
|
||||
FATAL("--perf-prof is only available on Linux");
|
||||
}
|
||||
|
||||
void CodeDisableOptEvent(Handle<AbstractCode> code,
|
||||
Handle<SharedFunctionInfo> shared) override {
|
||||
FATAL("--perf-prof is only available on Linux");
|
||||
}
|
||||
|
||||
void LogRecordedBuffer(Handle<AbstractCode> code,
|
||||
MaybeHandle<SharedFunctionInfo> maybe_shared,
|
||||
const char* name, int length) override {
|
||||
FATAL("--perf-prof is only available on Linux");
|
||||
}
|
||||
|
||||
void LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
|
||||
int length) override {
|
||||
FATAL("--perf-prof is only available on Linux");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // V8_OS_LINUX
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_OS_LINUX
|
||||
|
||||
#endif // V8_DIAGNOSTICS_PERF_JIT_H_
|
||||
|
@ -1493,24 +1493,40 @@ DEFINE_BOOL(prof_browser_mode, true,
|
||||
DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
|
||||
DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
|
||||
DEFINE_BOOL(ll_prof, false, "Enable low-level linux profiler.")
|
||||
DEFINE_BOOL(perf_basic_prof, false,
|
||||
|
||||
#if V8_OS_LINUX
|
||||
#define DEFINE_PERF_PROF_BOOL(nam, cmt) DEFINE_BOOL(nam, false, cmt)
|
||||
#define DEFINE_PERF_PROF_IMPLICATION DEFINE_IMPLICATION
|
||||
#else
|
||||
#define DEFINE_PERF_PROF_BOOL(nam, cmt) DEFINE_BOOL_READONLY(nam, false, cmt)
|
||||
#define DEFINE_PERF_PROF_IMPLICATION(...)
|
||||
#endif
|
||||
|
||||
DEFINE_PERF_PROF_BOOL(perf_basic_prof,
|
||||
"Enable perf linux profiler (basic support).")
|
||||
DEFINE_NEG_IMPLICATION(perf_basic_prof, compact_code_space)
|
||||
DEFINE_BOOL(perf_basic_prof_only_functions, false,
|
||||
DEFINE_PERF_PROF_BOOL(
|
||||
perf_basic_prof_only_functions,
|
||||
"Only report function code ranges to perf (i.e. no stubs).")
|
||||
DEFINE_IMPLICATION(perf_basic_prof_only_functions, perf_basic_prof)
|
||||
DEFINE_BOOL(perf_prof, false,
|
||||
"Enable perf linux profiler (experimental annotate support).")
|
||||
DEFINE_BOOL(perf_prof_annotate_wasm, false,
|
||||
DEFINE_PERF_PROF_IMPLICATION(perf_basic_prof_only_functions, perf_basic_prof)
|
||||
DEFINE_PERF_PROF_BOOL(
|
||||
perf_prof, "Enable perf linux profiler (experimental annotate support).")
|
||||
DEFINE_PERF_PROF_BOOL(
|
||||
perf_prof_annotate_wasm,
|
||||
"Used with --perf-prof, load wasm source map and provide annotate "
|
||||
"support (experimental).")
|
||||
DEFINE_NEG_IMPLICATION(perf_prof, compact_code_space)
|
||||
// TODO(v8:8462) Remove implication once perf supports remapping.
|
||||
DEFINE_NEG_IMPLICATION(perf_prof, write_protect_code_memory)
|
||||
DEFINE_NEG_IMPLICATION(perf_prof, wasm_write_protect_code_memory)
|
||||
DEFINE_BOOL(perf_prof_unwinding_info, false,
|
||||
DEFINE_PERF_PROF_BOOL(
|
||||
perf_prof_unwinding_info,
|
||||
"Enable unwinding info for perf linux profiler (experimental).")
|
||||
DEFINE_IMPLICATION(perf_prof, perf_prof_unwinding_info)
|
||||
DEFINE_PERF_PROF_IMPLICATION(perf_prof, perf_prof_unwinding_info)
|
||||
|
||||
#undef DEFINE_PERF_PROF_BOOL
|
||||
#undef DEFINE_PERF_PROF_IMPLICATION
|
||||
|
||||
DEFINE_STRING(gc_fake_mmap, "/tmp/__v8_gc__",
|
||||
"Specify the name of the file for fake gc mmap used in ll_prof")
|
||||
DEFINE_BOOL(log_internal_timer_events, false, "Time internal events.")
|
||||
|
@ -1916,10 +1916,16 @@ bool Logger::SetUp(Isolate* isolate) {
|
||||
AddCodeEventListener(perf_basic_logger_.get());
|
||||
}
|
||||
|
||||
#if V8_OS_LINUX
|
||||
if (FLAG_perf_prof) {
|
||||
perf_jit_logger_ = std::make_unique<PerfJitLogger>(isolate);
|
||||
AddCodeEventListener(perf_jit_logger_.get());
|
||||
}
|
||||
#else
|
||||
static_assert(
|
||||
!FLAG_perf_prof,
|
||||
"--perf-prof should be statically disabled on non-Linux platforms");
|
||||
#endif
|
||||
|
||||
if (FLAG_ll_prof) {
|
||||
ll_logger_ =
|
||||
@ -1992,10 +1998,12 @@ FILE* Logger::TearDown() {
|
||||
perf_basic_logger_.reset();
|
||||
}
|
||||
|
||||
#if V8_OS_LINUX
|
||||
if (perf_jit_logger_) {
|
||||
RemoveCodeEventListener(perf_jit_logger_.get());
|
||||
perf_jit_logger_.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ll_logger_) {
|
||||
RemoveCodeEventListener(ll_logger_.get());
|
||||
|
@ -317,7 +317,9 @@ class Logger : public CodeEventListener {
|
||||
bool is_logging_;
|
||||
std::unique_ptr<Log> log_;
|
||||
std::unique_ptr<PerfBasicLogger> perf_basic_logger_;
|
||||
#if V8_OS_LINUX
|
||||
std::unique_ptr<PerfJitLogger> perf_jit_logger_;
|
||||
#endif
|
||||
std::unique_ptr<LowLevelLogger> ll_logger_;
|
||||
std::unique_ptr<JitLogger> jit_logger_;
|
||||
std::set<int> logged_source_code_;
|
||||
|
@ -3,8 +3,9 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Test enabled only on supported architectures.
|
||||
#if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM) || \
|
||||
defined(V8_TARGET_ARCH_ARM64)
|
||||
#if V8_OS_LINUX && \
|
||||
(defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM) || \
|
||||
defined(V8_TARGET_ARCH_ARM64))
|
||||
|
||||
#include "src/flags/flags.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
|
Loading…
Reference in New Issue
Block a user