2013-06-24 10:07:48 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2016-01-19 09:38:36 +00:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-06-24 10:07:48 +00:00
|
|
|
**
|
2013-06-24 11:50:51 +00:00
|
|
|
** This file is part of the QtQml module of the Qt Toolkit.
|
2013-06-24 10:07:48 +00:00
|
|
|
**
|
2016-01-19 09:38:36 +00:00
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
2013-06-24 10:07:48 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 11:55:39 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
2016-01-19 09:38:36 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2013-06-24 10:07:48 +00:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2016-01-19 09:38:36 +00:00
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
2013-06-24 10:07:48 +00:00
|
|
|
**
|
2016-01-19 09:38:36 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 2.0 or (at your option) the GNU General
|
|
|
|
** Public license version 3 or any later version approved by the KDE Free
|
|
|
|
** Qt Foundation. The licenses are as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
2013-06-24 10:07:48 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-06-08 19:09:13 +00:00
|
|
|
#include "qv4instr_moth_p.h"
|
|
|
|
|
2014-02-14 12:58:40 +00:00
|
|
|
using namespace QV4;
|
|
|
|
using namespace QV4::Moth;
|
2012-06-08 19:09:13 +00:00
|
|
|
|
|
|
|
int Instr::size(Type type)
|
|
|
|
{
|
|
|
|
#define MOTH_RETURN_INSTR_SIZE(I, FMT) case I: return InstrMeta<(int)I>::Size;
|
|
|
|
switch (type) {
|
|
|
|
FOR_EACH_MOTH_INSTR(MOTH_RETURN_INSTR_SIZE)
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
#undef MOTH_RETURN_INSTR_SIZE
|
|
|
|
}
|
|
|
|
|
2017-06-22 09:16:11 +00:00
|
|
|
static QByteArray alignedNumber(int n) {
|
2017-06-13 10:34:46 +00:00
|
|
|
QByteArray number = QByteArray::number(n);
|
|
|
|
while (number.size() < 12)
|
|
|
|
number.prepend(' ');
|
|
|
|
return number;
|
|
|
|
}
|
|
|
|
|
2017-06-22 09:16:11 +00:00
|
|
|
static QString toString(QV4::ReturnedValue v)
|
2017-06-13 20:51:51 +00:00
|
|
|
{
|
|
|
|
#ifdef V4_BOOTSTRAP
|
|
|
|
return QStringLiteral("string-const(%1)").arg(v);
|
|
|
|
#else // !V4_BOOTSTRAP
|
|
|
|
Value val = Value::fromReturnedValue(v);
|
2017-06-22 09:16:11 +00:00
|
|
|
QString result;
|
|
|
|
if (val.isInt32())
|
|
|
|
result = QLatin1String("int ");
|
|
|
|
else if (val.isDouble())
|
|
|
|
result = QLatin1String("double ");
|
|
|
|
if (val.isEmpty())
|
|
|
|
result += QLatin1String("empty");
|
|
|
|
else
|
|
|
|
result += val.toQStringNoThrow();
|
2017-06-22 12:28:47 +00:00
|
|
|
return result;
|
2017-06-13 20:51:51 +00:00
|
|
|
#endif // V4_BOOTSTRAP
|
|
|
|
}
|
|
|
|
|
2017-06-14 11:58:38 +00:00
|
|
|
template<typename T>
|
2017-07-19 07:30:13 +00:00
|
|
|
size_t absoluteInstructionOffset(const char *codeStart, const T &instr)
|
2017-06-14 11:58:38 +00:00
|
|
|
{
|
|
|
|
return reinterpret_cast<const char *>(&instr) - codeStart + offsetof(T, offset) + instr.offset;
|
|
|
|
}
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
#define MOTH_BEGIN_INSTR(I) \
|
|
|
|
case Instr::I: {\
|
2017-07-11 14:55:49 +00:00
|
|
|
const InstrMeta<int(Instr::I)>::DataType &instr = InstrMeta<int(Instr::I)>::data(*genericInstr); \
|
2017-06-13 10:34:46 +00:00
|
|
|
Q_UNUSED(instr); \
|
|
|
|
QDebug d = qDebug(); \
|
2017-08-03 13:34:56 +00:00
|
|
|
d.noquote(); \
|
2017-06-13 10:34:46 +00:00
|
|
|
d.nospace(); \
|
2017-07-18 13:43:11 +00:00
|
|
|
d << alignedNumber(int(code - start)).constData() << ": " << #I << " "; \
|
2017-07-11 14:55:49 +00:00
|
|
|
code += InstrMeta<int(Instr::I)>::Size; \
|
2017-06-13 10:34:46 +00:00
|
|
|
|
|
|
|
#define MOTH_END_INSTR(I) } break;
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace QV4 {
|
|
|
|
namespace Moth {
|
|
|
|
|
2017-06-22 12:28:47 +00:00
|
|
|
void dumpConstantTable(const Value *constants, uint count)
|
|
|
|
{
|
|
|
|
QDebug d = qDebug();
|
|
|
|
d.nospace();
|
|
|
|
for (uint i = 0; i < count; ++i)
|
|
|
|
d << alignedNumber(i).constData() << ": "
|
|
|
|
<< toString(constants[i].asReturnedValue()).toUtf8().constData() << "\n";
|
|
|
|
}
|
|
|
|
|
2017-08-13 20:42:48 +00:00
|
|
|
void dumpBytecode(const char *code, int len, int nLocals, int nFormals)
|
2017-06-13 10:34:46 +00:00
|
|
|
{
|
|
|
|
const char *start = code;
|
|
|
|
const char *end = code + len;
|
|
|
|
while (code < end) {
|
|
|
|
const Instr *genericInstr = reinterpret_cast<const Instr *>(code);
|
|
|
|
switch (genericInstr->common.instructionType) {
|
|
|
|
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadReg)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.reg.dump(nFormals);
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_END_INSTR(LoadReg)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(StoreReg)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.reg.dump(nFormals);
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_END_INSTR(StoreReg)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(MoveReg)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.destReg.dump(nFormals) << ", " << instr.srcReg.dump(nFormals);
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_END_INSTR(MoveReg)
|
|
|
|
|
2017-07-11 14:55:49 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadConst)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "C" << instr.index;
|
2017-07-11 14:55:49 +00:00
|
|
|
MOTH_END_INSTR(LoadConst)
|
|
|
|
|
2017-08-11 22:10:04 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadNull)
|
|
|
|
MOTH_END_INSTR(LoadNull)
|
|
|
|
|
2017-08-13 20:54:11 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadZero)
|
|
|
|
MOTH_END_INSTR(LoadZero)
|
|
|
|
|
2017-08-12 14:41:28 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadTrue)
|
|
|
|
MOTH_END_INSTR(LoadTrue)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadFalse)
|
|
|
|
MOTH_END_INSTR(LoadFalse)
|
|
|
|
|
2017-08-11 22:10:04 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadUndefined)
|
|
|
|
MOTH_END_INSTR(LoadUndefined)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadInt)
|
|
|
|
d << instr.value;
|
|
|
|
MOTH_END_INSTR(LoadInt)
|
|
|
|
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_BEGIN_INSTR(MoveConst)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.destTemp.dump(nFormals) << ", C" << instr.constIndex;
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_END_INSTR(MoveConst)
|
|
|
|
|
2017-07-11 14:55:49 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadScopedLocal)
|
2017-08-13 20:42:48 +00:00
|
|
|
if (instr.index < nLocals)
|
|
|
|
d << "l" << instr.index << "@" << instr.scope;
|
|
|
|
else
|
|
|
|
d << "a" << (instr.index - nLocals) << "@" << instr.scope;
|
2017-07-11 14:55:49 +00:00
|
|
|
MOTH_END_INSTR(LoadScopedLocal)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(StoreScopedLocal)
|
2017-08-13 20:42:48 +00:00
|
|
|
if (instr.index < nLocals)
|
|
|
|
d << ", " << "l" << instr.index << "@" << instr.scope;
|
|
|
|
else
|
|
|
|
d << ", " << "a" << (instr.index - nLocals) << "@" << instr.scope;
|
2017-07-11 14:55:49 +00:00
|
|
|
MOTH_END_INSTR(StoreScopedLocal)
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadRuntimeString)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.stringId;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadRuntimeString)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadRegExp)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.regExpId;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadRegExp)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadClosure)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.value;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadClosure)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadName)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.name;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadName)
|
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadGlobalLookup)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.index;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(LoadGlobalLookup)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:02:26 +00:00
|
|
|
MOTH_BEGIN_INSTR(StoreNameSloppy)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.name;
|
2017-08-09 11:02:26 +00:00
|
|
|
MOTH_END_INSTR(StoreNameSloppy)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(StoreNameStrict)
|
|
|
|
d << instr.name;
|
|
|
|
MOTH_END_INSTR(StoreNameStrict)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadElement)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.index.dump(nFormals) << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadElement)
|
|
|
|
|
2017-07-21 08:55:35 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadElementA)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[acc]";
|
2017-07-21 08:55:35 +00:00
|
|
|
MOTH_END_INSTR(LoadElement)
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_BEGIN_INSTR(StoreElement)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.index.dump(nFormals) << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(StoreElement)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.name << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadProperty)
|
|
|
|
|
2017-07-21 08:55:35 +00:00
|
|
|
MOTH_BEGIN_INSTR(LoadPropertyA)
|
|
|
|
d << "acc[" << instr.name << "]";
|
|
|
|
MOTH_END_INSTR(LoadElementA)
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_BEGIN_INSTR(GetLookup)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "(" << instr.index << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(GetLookup)
|
|
|
|
|
2017-07-21 08:55:35 +00:00
|
|
|
MOTH_BEGIN_INSTR(GetLookupA)
|
|
|
|
d << "acc(" << instr.index << ")";
|
|
|
|
MOTH_END_INSTR(GetLookupA)
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_BEGIN_INSTR(StoreProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.name<< "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(StoreProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(SetLookup)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals);
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(SetLookup)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(StoreScopeObjectProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.propertyIndex << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(StoreScopeObjectProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadScopeObjectProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.propertyIndex << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadScopeObjectProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(StoreContextObjectProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.propertyIndex << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(StoreContextObjectProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadContextObjectProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.propertyIndex << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadContextObjectProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadIdObject)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.index << "]";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadIdObject)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CallValue)
|
2017-08-05 16:20:26 +00:00
|
|
|
d << "(" << instr.callData.dump(nFormals) << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CallValue)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CallProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "." << instr.name << "(" << instr.callData.dump(nFormals) << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CallProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CallPropertyLookup)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lookupIndex << "(" << instr.callData.dump(nFormals) << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CallPropertyLookup)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CallElement)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.index.dump(nFormals) << "]" << "(" << instr.callData.dump(nFormals) << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CallElement)
|
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(CallName)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.name << "(" << instr.callData.dump(nFormals) << ")";
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(CallName)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CallGlobalLookup)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.index << "(" << instr.callData.dump(nFormals) << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CallGlobalLookup)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(SetExceptionHandler)
|
2017-06-29 09:14:36 +00:00
|
|
|
if (instr.offset)
|
|
|
|
d << absoluteInstructionOffset(start, instr);
|
|
|
|
else
|
|
|
|
d << "<null>";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(SetExceptionHandler)
|
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(ThrowException)
|
|
|
|
MOTH_END_INSTR(ThrowException)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-06-20 12:30:03 +00:00
|
|
|
MOTH_BEGIN_INSTR(GetException)
|
2017-06-16 13:30:23 +00:00
|
|
|
MOTH_END_INSTR(HasException)
|
|
|
|
|
2017-06-20 12:30:03 +00:00
|
|
|
MOTH_BEGIN_INSTR(SetException)
|
2017-06-16 13:30:23 +00:00
|
|
|
MOTH_END_INSTR(SetExceptionFlag)
|
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(UnwindException)
|
|
|
|
MOTH_END_INSTR(UnwindException)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(PushCatchContext)
|
2017-08-08 08:56:34 +00:00
|
|
|
d << instr.reg.dump(nFormals) << ", " << instr.name;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(PushCatchContext)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(PushWithContext)
|
2017-08-08 08:56:34 +00:00
|
|
|
d << instr.reg.dump(nFormals);
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(PushWithContext)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(PopContext)
|
2017-08-08 08:56:34 +00:00
|
|
|
d << instr.reg.dump(nFormals);
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(PopContext)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(ForeachIteratorObject)
|
|
|
|
MOTH_END_INSTR(ForeachIteratorObject)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(ForeachNextPropertyName)
|
|
|
|
MOTH_END_INSTR(ForeachNextPropertyName)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(DeleteMember)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.member << "]";
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(DeleteMember)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(DeleteSubscript)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.base.dump(nFormals) << "[" << instr.index.dump(nFormals) << "]";
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(DeleteSubscript)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(DeleteName)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.name;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(DeleteName)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(TypeofName)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.name;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(TypeofName)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(TypeofValue)
|
|
|
|
MOTH_END_INSTR(TypeofValue)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(DeclareVar)
|
2017-06-13 10:34:46 +00:00
|
|
|
d << instr.isDeletable << ", " << instr.varName;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(DeclareVar)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(DefineArray)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.args.dump(nFormals) << ", " << instr.argc;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(DefineArray)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(DefineObjectLiteral)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.args.dump(nFormals)
|
2017-06-22 09:17:48 +00:00
|
|
|
<< ", " << instr.internalClassId
|
|
|
|
<< ", " << instr.arrayValueCount
|
|
|
|
<< ", " << instr.arrayGetterSetterCountAndFlags;
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(DefineObjectLiteral)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-07 08:10:47 +00:00
|
|
|
MOTH_BEGIN_INSTR(CreateMappedArgumentsObject)
|
|
|
|
MOTH_END_INSTR(CreateMappedArgumentsObject)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CreateUnmappedArgumentsObject)
|
|
|
|
MOTH_END_INSTR(CreateUnmappedArgumentsObject)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(ConvertThisToObject)
|
|
|
|
MOTH_END_INSTR(ConvertThisToObject)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CreateValue)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << "new" << instr.func.dump(nFormals) << "(" << instr.callData.dump(nFormals) << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CreateValue)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CreateProperty)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << "new" << instr.name << "(" << instr.callData.dump(nFormals) << instr.argc << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(CreateProperty)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(ConstructPropertyLookup)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << "new" << instr.index << "(" << instr.callData.dump(nFormals) << instr.argc << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(ConstructPropertyLookup)
|
|
|
|
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_BEGIN_INSTR(CreateName)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << "new" << instr.name << "(" << instr.callData.dump(nFormals) << instr.argc << ")";
|
2017-08-09 11:15:45 +00:00
|
|
|
MOTH_END_INSTR(CreateName)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(ConstructGlobalLookup)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << "new" << instr.index << "(" << instr.callData.dump(nFormals) << instr.argc << ")";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(ConstructGlobalLookup)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Jump)
|
2017-06-14 11:58:38 +00:00
|
|
|
d << absoluteInstructionOffset(start, instr);
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Jump)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(JumpEq)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc " << absoluteInstructionOffset(start, instr);
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(JumpEq)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(JumpNe)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc " << absoluteInstructionOffset(start, instr);
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(JumpNe)
|
|
|
|
|
2017-08-16 07:32:28 +00:00
|
|
|
MOTH_BEGIN_INSTR(CmpJmpEqNull)
|
|
|
|
d << absoluteInstructionOffset(start, instr);
|
|
|
|
MOTH_END_INSTR(CmpJmpEqNull)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CmpJmpNeNull)
|
|
|
|
d << absoluteInstructionOffset(start, instr);
|
|
|
|
MOTH_END_INSTR(CmpJmpNeNull)
|
|
|
|
|
2017-08-16 12:45:25 +00:00
|
|
|
MOTH_BEGIN_INSTR(CmpJmpEqInt)
|
|
|
|
d << instr.lhs << ", " << absoluteInstructionOffset(start, instr);
|
|
|
|
MOTH_END_INSTR(CmpJmpEq)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CmpJmpNeInt)
|
|
|
|
d << instr.lhs << ", " << absoluteInstructionOffset(start, instr);
|
|
|
|
MOTH_END_INSTR(CmpJmpNe)
|
|
|
|
|
|
|
|
|
2017-08-01 13:30:49 +00:00
|
|
|
MOTH_BEGIN_INSTR(CmpJmpEq)
|
2017-08-06 09:41:21 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", " << absoluteInstructionOffset(start, instr);
|
2017-08-01 13:30:49 +00:00
|
|
|
MOTH_END_INSTR(CmpJmpEq)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CmpJmpNe)
|
2017-08-06 09:41:21 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", " << absoluteInstructionOffset(start, instr);
|
2017-08-01 13:30:49 +00:00
|
|
|
MOTH_END_INSTR(CmpJmpNe)
|
|
|
|
|
2017-08-06 07:59:25 +00:00
|
|
|
MOTH_BEGIN_INSTR(CmpJmpGt)
|
2017-08-06 09:41:21 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", " << absoluteInstructionOffset(start, instr);
|
2017-08-06 07:59:25 +00:00
|
|
|
MOTH_END_INSTR(CmpJmpGt)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CmpJmpGe)
|
2017-08-06 09:41:21 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", " << absoluteInstructionOffset(start, instr);
|
2017-08-06 07:59:25 +00:00
|
|
|
MOTH_END_INSTR(CmpJmpGe)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CmpJmpLt)
|
2017-08-06 09:41:21 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", " << absoluteInstructionOffset(start, instr);
|
2017-08-06 07:59:25 +00:00
|
|
|
MOTH_END_INSTR(CmpJmpLt)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(CmpJmpLe)
|
2017-08-06 09:41:21 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", " << absoluteInstructionOffset(start, instr);
|
2017-08-06 07:59:25 +00:00
|
|
|
MOTH_END_INSTR(CmpJmpLe)
|
|
|
|
|
2017-06-14 11:59:31 +00:00
|
|
|
MOTH_BEGIN_INSTR(JumpStrictEqual)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << " " << absoluteInstructionOffset(start, instr);
|
2017-06-14 11:59:31 +00:00
|
|
|
MOTH_END_INSTR(JumpStrictEqual)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(JumpStrictNotEqual)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << " " << absoluteInstructionOffset(start, instr);
|
2017-06-14 11:59:31 +00:00
|
|
|
MOTH_END_INSTR(JumpStrictNotEqual)
|
|
|
|
|
2017-08-04 11:38:33 +00:00
|
|
|
MOTH_BEGIN_INSTR(JumpStrictEqualStackSlotInt)
|
|
|
|
d << instr.lhs.dump(nFormals) << ", " << instr.rhs << " " << absoluteInstructionOffset(start, instr);
|
|
|
|
MOTH_END_INSTR(JumpStrictEqualStackSlotInt)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(JumpStrictNotEqualStackSlotInt)
|
|
|
|
d << instr.lhs.dump(nFormals) << ", " << instr.rhs << " " << absoluteInstructionOffset(start, instr);
|
|
|
|
MOTH_END_INSTR(JumpStrictNotEqualStackSlotInt)
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_BEGIN_INSTR(UNot)
|
|
|
|
MOTH_END_INSTR(UNot)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(UPlus)
|
|
|
|
MOTH_END_INSTR(UPlus)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(UMinus)
|
|
|
|
MOTH_END_INSTR(UMinus)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(UCompl)
|
|
|
|
MOTH_END_INSTR(UCompl)
|
|
|
|
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_BEGIN_INSTR(Increment)
|
2017-06-20 09:28:27 +00:00
|
|
|
MOTH_END_INSTR(PreIncrement)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
2017-07-18 13:48:21 +00:00
|
|
|
MOTH_BEGIN_INSTR(Decrement)
|
2017-06-20 09:28:27 +00:00
|
|
|
MOTH_END_INSTR(PreDecrement)
|
|
|
|
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_BEGIN_INSTR(Binop)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.alu << ", " << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Binop)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Add)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Add)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BitAnd)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(BitAnd)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BitOr)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(BitOr)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BitXor)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(BitXor)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Shr)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Shr)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Shl)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Shl)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BitAndConst)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc, " << instr.rhs;
|
|
|
|
MOTH_END_INSTR(BitAndConst)
|
2017-06-13 10:34:46 +00:00
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BitOrConst)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc, " << instr.rhs;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(BitOr)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BitXorConst)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc, " << instr.rhs;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(BitXor)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(ShrConst)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc, " << instr.rhs;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(ShrConst)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(ShlConst)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << "acc, " << instr.rhs;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(ShlConst)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Mul)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Mul)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Sub)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(Sub)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(BinopContext)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.alu << " " << instr.lhs.dump(nFormals) << ", acc";
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(BinopContext)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Ret)
|
|
|
|
MOTH_END_INSTR(Ret)
|
|
|
|
|
|
|
|
#ifndef QT_NO_QML_DEBUGGER
|
|
|
|
MOTH_BEGIN_INSTR(Debug)
|
|
|
|
MOTH_END_INSTR(Debug)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(Line)
|
|
|
|
d << instr.lineNumber;
|
|
|
|
MOTH_END_INSTR(Line)
|
|
|
|
#endif // QT_NO_QML_DEBUGGER
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadQmlContext)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.result.dump(nFormals);
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadQmlContext)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadQmlImportedScripts)
|
2017-08-03 13:34:56 +00:00
|
|
|
d << instr.result.dump(nFormals);
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadQmlImportedScripts)
|
|
|
|
|
|
|
|
MOTH_BEGIN_INSTR(LoadQmlSingleton)
|
2017-07-18 13:48:21 +00:00
|
|
|
d << instr.name;
|
2017-06-13 10:34:46 +00:00
|
|
|
MOTH_END_INSTR(LoadQmlSingleton)
|
|
|
|
|
2017-06-27 14:06:29 +00:00
|
|
|
default:
|
|
|
|
Q_UNREACHABLE();
|
|
|
|
}
|
2017-06-13 10:34:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QT_END_NAMESPACE
|