Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qv4functiontable_unix.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
5
#
include
"qv4functiontable_p.h"
6
#
include
"qv4function_p.h"
7
8
#
include
<
assembler
/
MacroAssemblerCodeRef
.
h
>
9
10
#
include
<
QtCore
/
qfile
.
h
>
11
#
include
<
QtCore
/
qcoreapplication
.
h
>
12
13
QT_BEGIN_NAMESPACE
14
15
namespace
QV4
{
16
17
void
generateFunctionTable
(Function *function, JSC::MacroAssemblerCodeRef *codeRef)
18
{
19
// This implements writing of JIT'd addresses so that perf can find the
20
// symbol names.
21
//
22
// Perf expects the mapping to be in a certain place and have certain
23
// content, for more information, see:
24
// https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt
25
static
bool
doProfile = !qEnvironmentVariableIsEmpty(
"QV4_PROFILE_WRITE_PERF_MAP"
);
26
if
(Q_UNLIKELY(doProfile)) {
27
static
QFile perfMapFile(QString::fromLatin1(
"/tmp/perf-%1.map"
)
28
.arg(QCoreApplication::applicationPid()));
29
static
const
bool
isOpen = perfMapFile.open(QIODevice::WriteOnly);
30
if
(!isOpen) {
31
qWarning(
"QV4::JIT::Assembler: Cannot write perf map file."
);
32
doProfile =
false
;
33
}
else
{
34
const
void
*address = codeRef->code().executableAddress();
35
perfMapFile.write(QByteArray::number(
reinterpret_cast
<quintptr>(address), 16));
36
perfMapFile.putChar(
' '
);
37
perfMapFile.write(QByteArray::number(
static_cast
<qsizetype>(codeRef->size()), 16));
38
perfMapFile.putChar(
' '
);
39
perfMapFile.write(Function::prettyName(function, address).toUtf8());
40
perfMapFile.putChar(
'\n'
);
41
perfMapFile.flush();
42
}
43
}
44
}
45
46
void
destroyFunctionTable
(Function *function, JSC::MacroAssemblerCodeRef *codeRef)
47
{
48
Q_UNUSED(function);
49
Q_UNUSED(codeRef);
50
51
// It's not advisable to remove things from the perf map file, as it's primarily used to analyze
52
// a trace after the application has terminated. We want to know about all functions that were
53
// ever jitted then. If the memory ranges overlap, we will have a problem when analyzing the
54
// trace. The JIT should try to avoid this.
55
}
56
57
size_t
exceptionHandlerSize
()
58
{
59
return
0;
60
}
61
62
}
// QV4
63
64
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QV4
Definition
qjsvalue.h:24
QV4::exceptionHandlerSize
size_t exceptionHandlerSize()
Definition
qv4functiontable_noop.cpp:23
QV4::generateFunctionTable
void generateFunctionTable(Function *function, JSC::MacroAssemblerCodeRef *codeRef)
Definition
qv4functiontable_noop.cpp:11
QV4::destroyFunctionTable
void destroyFunctionTable(Function *function, JSC::MacroAssemblerCodeRef *codeRef)
Definition
qv4functiontable_noop.cpp:17
qtdeclarative
src
qml
jsruntime
qv4functiontable_unix.cpp
Generated on
for Qt by
1.18.0