30 #include "../bridge/qscriptqobject_p.h" 31 #include <QtCore/qdatastream.h> 32 #include <QtCore/qmetaobject.h> 33 #include "CodeBlock.h" 34 #include "JSFunction.h" 36 #include "MacroAssemblerCodeRef.h" 154 frame = rewindContext;
160 rewindContext = rewindContext->callerFrame()->removeHostCallFrameFlag();
162 frame = rewindContext->callerFrame()->removeHostCallFrameFlag();
164 JSC::Instruction *returnPC = rewindContext->returnPC();
165 JSC::CodeBlock *codeBlock = frame->codeBlock();
168 JSC::JITCode code = codeBlock->getJITCode();
169 uintptr_t jitOffset =
reinterpret_cast<uintptr_t
>(JSC::ReturnAddressPtr(returnPC).value()) - reinterpret_cast<uintptr_t>(code.addressForCall().executableAddress());
172 if (jitOffset < code.size()) {
173 unsigned bytecodeOffset = codeBlock->getBytecodeIndex(frame, JSC::ReturnAddressPtr(returnPC));
175 unsigned bytecodeOffset = returnPC - codeBlock->instructions().begin();
178 lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), bytecodeOffset);
187 JSC::CodeBlock *codeBlock = frame->codeBlock();
189 JSC::SourceProvider *source = codeBlock->source();
195 JSC::JSObject *callee = frame->callee();
197 functionName = JSC::asInternalFunction(callee)->name(frame);
199 && !JSC::asFunction(callee)->isHostFunction()) {
201 JSC::FunctionExecutable *body = JSC::asFunction(callee)->jsExecutable();
204 for (
size_t i = 0; i < body->parameterCount(); ++i)
215 for (
int i = 0; i < formals.
count(); ++i)
330 return d->lineNumber;
341 return d->columnNumber;
360 return d->functionName;
373 return d->functionType;
390 return d->functionStartLineNumber;
407 return d->functionEndLineNumber;
421 return d->parameterNames;
442 return d->functionMetaIndex;
485 return !(*
this == other);
488 #ifndef QT_NO_DATASTREAM
The QScriptContext class represents a Qt Script function invocation.
static JSC::ExecState * frameForContext(QScriptContext *context)
QScriptEnginePrivate * scriptEngineFromExec(const JSC::ExecState *exec)
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
int functionEndLineNumber() const
Returns the line number where the definition of the called function ends, or -1 if the line number is...
static const JSC::ClassInfo info
static QScriptEnginePrivate * get(QScriptEngine *q)
QT_DEPRECATED int columnNumber() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
QScriptEngine * engine() const
Returns the QScriptEngine that this QScriptContext belongs to.
int functionStartLineNumber
bool isNull() const
Returns true if this QScriptContextInfo is null, i.e.
The QString class provides a Unicode character string.
int functionMetaIndex() const
Returns the meta index of the called function, or -1 if the meta index is not available.
FunctionType
This enum specifies the type of function being called.
QScriptContextInfo & operator=(const QScriptContextInfo &other)
Assigns the other info to this QScriptContextInfo, and returns a reference to this QScriptContextInfo...
QString fileName() const
Returns the name of the file where the code being executed was defined, if available; otherwise retur...
QExplicitlySharedDataPointer< QScriptContextInfoPrivate > d_ptr
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
friend Q_SCRIPT_EXPORT QDataStream & operator<<(QDataStream &, const QScriptContextInfo &)
Writes the given info to the specified stream.
int lineNumber() const
Returns the line number corresponding to the statement being executed, or -1 if the line number is no...
static QScriptContext * contextForFrame(JSC::ExecState *frame)
QScriptContextInfo()
Constructs a null QScriptContextInfo.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
int functionEndLineNumber
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QScriptContextInfoPrivate()
int functionStartLineNumber() const
Returns the line number where the definition of the called function starts, or -1 if the line number ...
QScriptContextInfo::FunctionType functionType
bool operator==(const QScriptContextInfo &other) const
Returns true if this QScriptContextInfo is equal to the other info, otherwise returns false...
~QScriptContextInfo()
Destroys the QScriptContextInfo.
QStringList parameterNames
The QScriptContextInfo class provides additional information about a QScriptContext.
~QScriptContextInfoPrivate()
#define Q_DECLARE_PUBLIC(Class)
friend Q_SCRIPT_EXPORT QDataStream & operator>>(QDataStream &, QScriptContextInfo &)
Reads a QScriptContextInfo from the specified stream into the given info.
QStringList functionParameterNames() const
Returns the names of the formal parameters of the called function, or an empty QStringList if the par...
FunctionType functionType() const
Returns the type of the called function.
QScriptContextInfo * q_ptr
The QDataStream class provides serialization of binary data to a QIODevice.
qint64 scriptId() const
Returns the ID of the script where the code being executed was defined, or -1 if the ID is not availa...
bool operator!=(const QScriptContextInfo &other) const
Returns true if this QScriptContextInfo is not equal to the other info, otherwise returns false...
static const JSC::ClassInfo info
static bool hasValidCodeBlockRegister(JSC::ExecState *frame)
QString functionName() const
Returns the name of the called function, or an empty string if the name is not available.