Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qv4stackframe.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 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
4#include "qv4stackframe_p.h"
5#include <private/qv4qobjectwrapper_p.h>
6#include <QtCore/qstring.h>
7
8using namespace QV4;
9
14
19
21{
22 if (!frame->v4Function || frame->instructionPointer <= 0)
23 return nullptr;
24
26 return entry.codeOffset < offset;
27 };
28
29 const QV4::CompiledData::Function *cf = frame->v4Function->compiledFunction;
30 const uint offset = frame->instructionPointer;
31 const CompiledData::CodeOffsetToLineAndStatement *lineAndStatementNumbers
33 const uint nLineAndStatementNumbers = cf->nLineAndStatementNumbers;
34 return std::lower_bound(
35 lineAndStatementNumbers, lineAndStatementNumbers + nLineAndStatementNumbers,
36 offset, findLine) - 1;
37}
38
40{
41 if (auto *line = lineAndStatement(this))
42 return line->line;
43 return missingLineNumber();
44}
45
47{
48 if (auto *statement = lineAndStatement(this))
49 return statement->statement;
50 return -1;
51}
52
54{
55 // Remove the first bit so that we can cast to positive int and negate.
56 // Remove the last bit so that it can't be -1.
57 const int result = -int(quintptr(this) & 0x7ffffffe);
58 Q_ASSERT(result < -1);
59 return result;
60}
61
63{
64 if (isJSTypesFrame())
65 return static_cast<const JSTypesStackFrame *>(this)->thisObject();
66
67 Q_ASSERT(isMetaTypesFrame());
68 const auto metaTypesFrame = static_cast<const MetaTypesStackFrame *>(this);
69 return QObjectWrapper::wrap(metaTypesFrame->context()->engine(), metaTypesFrame->thisObject());
70}
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
quint64 ReturnedValue
GLenum GLuint GLintptr offset
GLuint entry
GLuint64EXT * result
[6]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
size_t quintptr
Definition qtypes.h:167
unsigned int uint
Definition qtypes.h:34
static const CompiledData::CodeOffsetToLineAndStatement * lineAndStatement(const CppStackFrame *frame)
QFrame frame
[0]
const CodeOffsetToLineAndStatement * lineAndStatementNumberTable() const
int missingLineNumber() const
int statementNumber() const
QString function() const
QString source() const
ReturnedValue thisObject() const
QString sourceFile() const
Heap::String * name() const
QString toQString() const
Definition qv4string_p.h:92
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)