Skip to content

Commit 3542e4e

Browse files
committed
src: enable perf maps and jit dumps on macOS
1 parent 94fb854 commit 3542e4e

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "src/common/assert-scope.h"
3131

3232
// Only compile the {LinuxPerfJitLogger} on Linux.
33-
#if V8_OS_LINUX
33+
#if V8_OS_LINUX || V8_OS_DARWIN
3434

3535
#include <fcntl.h>
3636
#include <sys/mman.h>
@@ -150,8 +150,14 @@ void LinuxPerfJitLogger::OpenJitDumpFile() {
150150
if (v8_flags.perf_prof_delete_file)
151151
CHECK_EQ(0, unlink(perf_dump_name.begin()));
152152

153+
#if V8_OS_DARWIN
154+
// On macOS, samply uses a preload to find jitdumps and this mmap can be slow.
155+
// https://bugzilla-dev.allizom.org/show_bug.cgi?id=1827214
156+
marker_address_ = nullptr;
157+
#else
153158
marker_address_ = OpenMarkerFile(fd);
154159
if (marker_address_ == nullptr) return;
160+
#endif
155161

156162
perf_output_handle_ = fdopen(fd, "w+");
157163
if (perf_output_handle_ == nullptr) return;
@@ -549,4 +555,4 @@ void LinuxPerfJitLogger::LogWriteHeader() {
549555
} // namespace internal
550556
} // namespace v8
551557

552-
#endif // V8_OS_LINUX
558+
#endif // V8_OS_LINUX || V8_OS_DARWIN

deps/v8/src/diagnostics/perf-jit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "include/v8config.h"
3232

3333
// {LinuxPerfJitLogger} is only implemented on Linux.
34-
#if V8_OS_LINUX
34+
#if V8_OS_LINUX || V8_OS_DARWIN
3535

3636
#include "src/logging/log.h"
3737

@@ -140,6 +140,6 @@ class LinuxPerfJitLogger : public CodeEventLogger {
140140
} // namespace internal
141141
} // namespace v8
142142

143-
#endif // V8_OS_LINUX
143+
#endif // V8_OS_LINUX || V8_OS_DARWIN
144144

145145
#endif // V8_DIAGNOSTICS_PERF_JIT_H_

deps/v8/src/flags/flag-definitions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,7 @@ DEFINE_IMPLICATION(prof, log_code)
23202320

23212321
DEFINE_BOOL(ll_prof, false, "Enable low-level linux profiler.")
23222322

2323-
#if V8_OS_LINUX
2323+
#if V8_OS_LINUX || V8_OS_DARWIN
23242324
#define DEFINE_PERF_PROF_BOOL(nam, cmt) DEFINE_BOOL(nam, false, cmt)
23252325
#define DEFINE_PERF_PROF_IMPLICATION DEFINE_IMPLICATION
23262326
#else

deps/v8/src/logging/log.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void CodeEventLogger::RegExpCodeCreateEvent(Handle<AbstractCode> code,
333333
}
334334

335335
// Linux perf tool logging support.
336-
#if V8_OS_LINUX
336+
#if V8_OS_LINUX || V8_OS_DARWIN
337337
class LinuxPerfBasicLogger : public CodeEventLogger {
338338
public:
339339
explicit LinuxPerfBasicLogger(Isolate* isolate);
@@ -449,7 +449,7 @@ void LinuxPerfBasicLogger::LogRecordedBuffer(const wasm::WasmCode* code,
449449
code->instructions().length(), name, length);
450450
}
451451
#endif // V8_ENABLE_WEBASSEMBLY
452-
#endif // V8_OS_LINUX
452+
#endif // V8_OS_LINUX || V8_OS_DARWIN
453453

454454
// External LogEventListener
455455
ExternalLogEventListener::ExternalLogEventListener(Isolate* isolate)
@@ -2141,7 +2141,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
21412141
PrepareLogFileName(log_file_name, isolate, v8_flags.logfile);
21422142
log_ = std::make_unique<LogFile>(this, log_file_name.str());
21432143

2144-
#if V8_OS_LINUX
2144+
#if V8_OS_LINUX || V8_OS_DARWIN
21452145
if (v8_flags.perf_basic_prof) {
21462146
perf_basic_logger_ = std::make_unique<LinuxPerfBasicLogger>(isolate);
21472147
AddLogEventListener(perf_basic_logger_.get());
@@ -2279,7 +2279,7 @@ FILE* V8FileLogger::TearDownAndGetLogFile() {
22792279
ticker_.reset();
22802280
timer_.Stop();
22812281

2282-
#if V8_OS_LINUX
2282+
#if V8_OS_LINUX || V8_OS_DARWIN
22832283
if (perf_basic_logger_) {
22842284
RemoveLogEventListener(perf_basic_logger_.get());
22852285
perf_basic_logger_.reset();

deps/v8/src/logging/log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class V8FileLogger : public LogEventListener {
342342

343343
std::atomic<bool> is_logging_;
344344
std::unique_ptr<LogFile> log_;
345-
#if V8_OS_LINUX
345+
#if V8_OS_LINUX || V8_OS_DARWIN
346346
std::unique_ptr<LinuxPerfBasicLogger> perf_basic_logger_;
347347
std::unique_ptr<LinuxPerfJitLogger> perf_jit_logger_;
348348
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy