| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtQml module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qv4instr_moth_p.h" |
| 41 | #include <private/qv4compileddata_p.h> |
| 42 | #include <private/qv4calldata_p.h> |
| 43 | |
| 44 | #include <QtCore/qdebug.h> |
| 45 | |
| 46 | using namespace QV4; |
| 47 | using namespace QV4::Moth; |
| 48 | |
| 49 | int InstrInfo::size(Instr::Type type) |
| 50 | { |
| 51 | #define MOTH_RETURN_INSTR_SIZE(I) case Instr::Type::I: case Instr::Type::I##_Wide: return InstrMeta<int(Instr::Type::I)>::Size; |
| 52 | switch (type) { |
| 53 | FOR_EACH_MOTH_INSTR_ALL(MOTH_RETURN_INSTR_SIZE) |
| 54 | } |
| 55 | #undef MOTH_RETURN_INSTR_SIZE |
| 56 | Q_UNREACHABLE(); |
| 57 | } |
| 58 | |
| 59 | static QByteArray alignedNumber(int n) { |
| 60 | QByteArray number = QByteArray::number(n); |
| 61 | return number.prepend(n: 8 - number.size(), ch: ' '); |
| 62 | } |
| 63 | |
| 64 | static QByteArray alignedLineNumber(int line) { |
| 65 | if (line > 0) |
| 66 | return alignedNumber(n: static_cast<int>(line)); |
| 67 | return QByteArray(" " ); |
| 68 | } |
| 69 | |
| 70 | static QByteArray rawBytes(const char *data, int n) |
| 71 | { |
| 72 | QByteArray ba; |
| 73 | while (n) { |
| 74 | uint num = *reinterpret_cast<const uchar *>(data); |
| 75 | if (num < 16) |
| 76 | ba += '0'; |
| 77 | ba += QByteArray::number(num, base: 16) + " " ; |
| 78 | ++data; |
| 79 | --n; |
| 80 | } |
| 81 | while (ba.size() < 25) |
| 82 | ba += ' '; |
| 83 | return ba; |
| 84 | } |
| 85 | |
| 86 | #define ABSOLUTE_OFFSET() \ |
| 87 | (code - start + offset) |
| 88 | |
| 89 | #define MOTH_BEGIN_INSTR(instr) \ |
| 90 | { \ |
| 91 | INSTR_##instr(MOTH_DECODE_WITH_BASE) \ |
| 92 | QDebug d = qDebug(); \ |
| 93 | d.noquote(); \ |
| 94 | d.nospace(); \ |
| 95 | if (static_cast<int>(Instr::Type::instr) >= 0x100) \ |
| 96 | --base_ptr; \ |
| 97 | d << alignedLineNumber(line) << alignedNumber(codeOffset).constData() << ": " \ |
| 98 | << rawBytes(base_ptr, int(code - base_ptr)) << #instr << " "; |
| 99 | |
| 100 | #define MOTH_END_INSTR(instr) \ |
| 101 | continue; \ |
| 102 | } |
| 103 | |
| 104 | QT_BEGIN_NAMESPACE |
| 105 | namespace QV4 { |
| 106 | namespace Moth { |
| 107 | |
| 108 | const int InstrInfo::argumentCount[] = { |
| 109 | FOR_EACH_MOTH_INSTR_ALL(MOTH_COLLECT_NARGS) |
| 110 | }; |
| 111 | |
| 112 | QString dumpRegister(int reg, int nFormals) |
| 113 | { |
| 114 | Q_STATIC_ASSERT(offsetof(CallData, function) == 0); |
| 115 | Q_STATIC_ASSERT(offsetof(CallData, context) == sizeof(StaticValue)); |
| 116 | Q_STATIC_ASSERT(offsetof(CallData, accumulator) == 2*sizeof(StaticValue)); |
| 117 | Q_STATIC_ASSERT(offsetof(CallData, thisObject) == 3*sizeof(StaticValue)); |
| 118 | if (reg == CallData::Function) |
| 119 | return QStringLiteral("(function)" ); |
| 120 | else if (reg == CallData::Context) |
| 121 | return QStringLiteral("(context)" ); |
| 122 | else if (reg == CallData::Accumulator) |
| 123 | return QStringLiteral("(accumulator)" ); |
| 124 | else if (reg == CallData::NewTarget) |
| 125 | return QStringLiteral("(new.target)" ); |
| 126 | else if (reg == CallData::This) |
| 127 | return QStringLiteral("(this)" ); |
| 128 | else if (reg == CallData::Argc) |
| 129 | return QStringLiteral("(argc)" ); |
| 130 | reg -= CallData::HeaderSize(); |
| 131 | if (reg < nFormals) |
| 132 | return QStringLiteral("a%1" ).arg(a: reg); |
| 133 | reg -= nFormals; |
| 134 | return QStringLiteral("r%1" ).arg(a: reg); |
| 135 | |
| 136 | } |
| 137 | |
| 138 | QString dumpArguments(int argc, int argv, int nFormals) |
| 139 | { |
| 140 | if (!argc) |
| 141 | return QStringLiteral("()" ); |
| 142 | return QStringLiteral("(" ) + dumpRegister(reg: argv, nFormals) + QStringLiteral(", " ) + QString::number(argc) + QStringLiteral(")" ); |
| 143 | } |
| 144 | |
| 145 | void dumpBytecode(const char *code, int len, int nLocals, int nFormals, int /*startLine*/, const QVector<CompiledData::CodeOffsetToLine> &lineNumberMapping) |
| 146 | { |
| 147 | MOTH_JUMP_TABLE; |
| 148 | |
| 149 | auto findLine = [](const CompiledData::CodeOffsetToLine &entry, uint offset) { |
| 150 | return entry.codeOffset < offset; |
| 151 | }; |
| 152 | |
| 153 | int lastLine = -1; |
| 154 | const char *start = code; |
| 155 | const char *end = code + len; |
| 156 | while (code < end) { |
| 157 | const CompiledData::CodeOffsetToLine *codeToLine = std::lower_bound(first: lineNumberMapping.constBegin(), last: lineNumberMapping.constEnd(), val: static_cast<uint>(code - start) + 1, comp: findLine) - 1; |
| 158 | int line = int(codeToLine->line); |
| 159 | if (line != lastLine) |
| 160 | lastLine = line; |
| 161 | else |
| 162 | line = -1; |
| 163 | |
| 164 | int codeOffset = int(code - start); |
| 165 | |
| 166 | MOTH_DISPATCH() |
| 167 | |
| 168 | MOTH_BEGIN_INSTR(LoadReg) |
| 169 | d << dumpRegister(reg, nFormals); |
| 170 | MOTH_END_INSTR(LoadReg) |
| 171 | |
| 172 | MOTH_BEGIN_INSTR(StoreReg) |
| 173 | d << dumpRegister(reg, nFormals); |
| 174 | MOTH_END_INSTR(StoreReg) |
| 175 | |
| 176 | MOTH_BEGIN_INSTR(MoveReg) |
| 177 | d << dumpRegister(reg: destReg, nFormals) << ", " << dumpRegister(reg: srcReg, nFormals); |
| 178 | MOTH_END_INSTR(MoveReg) |
| 179 | |
| 180 | MOTH_BEGIN_INSTR(LoadImport) |
| 181 | d << "i" << index; |
| 182 | MOTH_END_INSTR(LoadImport) |
| 183 | |
| 184 | MOTH_BEGIN_INSTR(LoadConst) |
| 185 | d << "C" << index; |
| 186 | MOTH_END_INSTR(LoadConst) |
| 187 | |
| 188 | MOTH_BEGIN_INSTR(LoadNull) |
| 189 | MOTH_END_INSTR(LoadNull) |
| 190 | |
| 191 | MOTH_BEGIN_INSTR(LoadZero) |
| 192 | MOTH_END_INSTR(LoadZero) |
| 193 | |
| 194 | MOTH_BEGIN_INSTR(LoadTrue) |
| 195 | MOTH_END_INSTR(LoadTrue) |
| 196 | |
| 197 | MOTH_BEGIN_INSTR(LoadFalse) |
| 198 | MOTH_END_INSTR(LoadFalse) |
| 199 | |
| 200 | MOTH_BEGIN_INSTR(LoadUndefined) |
| 201 | MOTH_END_INSTR(LoadUndefined) |
| 202 | |
| 203 | MOTH_BEGIN_INSTR(LoadInt) |
| 204 | d << value; |
| 205 | MOTH_END_INSTR(LoadInt) |
| 206 | |
| 207 | MOTH_BEGIN_INSTR(MoveConst) |
| 208 | d << dumpRegister(reg: destTemp, nFormals) << ", C" << constIndex; |
| 209 | MOTH_END_INSTR(MoveConst) |
| 210 | |
| 211 | MOTH_BEGIN_INSTR(LoadLocal) |
| 212 | if (index < nLocals) |
| 213 | d << "l" << index; |
| 214 | else |
| 215 | d << "a" << (index - nLocals); |
| 216 | MOTH_END_INSTR(LoadLocal) |
| 217 | |
| 218 | MOTH_BEGIN_INSTR(StoreLocal) |
| 219 | if (index < nLocals) |
| 220 | d << "l" << index; |
| 221 | else |
| 222 | d << "a" << (index - nLocals); |
| 223 | MOTH_END_INSTR(StoreLocal) |
| 224 | |
| 225 | MOTH_BEGIN_INSTR(LoadScopedLocal) |
| 226 | if (index < nLocals) |
| 227 | d << "l" << index << "@" << scope; |
| 228 | else |
| 229 | d << "a" << (index - nLocals) << "@" << scope; |
| 230 | MOTH_END_INSTR(LoadScopedLocal) |
| 231 | |
| 232 | MOTH_BEGIN_INSTR(StoreScopedLocal) |
| 233 | if (index < nLocals) |
| 234 | d << ", " << "l" << index << "@" << scope; |
| 235 | else |
| 236 | d << ", " << "a" << (index - nLocals) << "@" << scope; |
| 237 | MOTH_END_INSTR(StoreScopedLocal) |
| 238 | |
| 239 | MOTH_BEGIN_INSTR(LoadRuntimeString) |
| 240 | d << stringId; |
| 241 | MOTH_END_INSTR(LoadRuntimeString) |
| 242 | |
| 243 | MOTH_BEGIN_INSTR(MoveRegExp) |
| 244 | d << dumpRegister(reg: destReg, nFormals) << ", " <<regExpId; |
| 245 | MOTH_END_INSTR(MoveRegExp) |
| 246 | |
| 247 | MOTH_BEGIN_INSTR(LoadClosure) |
| 248 | d << value; |
| 249 | MOTH_END_INSTR(LoadClosure) |
| 250 | |
| 251 | MOTH_BEGIN_INSTR(LoadName) |
| 252 | d << name; |
| 253 | MOTH_END_INSTR(LoadName) |
| 254 | |
| 255 | MOTH_BEGIN_INSTR(LoadGlobalLookup) |
| 256 | d << index; |
| 257 | MOTH_END_INSTR(LoadGlobalLookup) |
| 258 | |
| 259 | MOTH_BEGIN_INSTR(LoadQmlContextPropertyLookup) |
| 260 | d << index; |
| 261 | MOTH_END_INSTR(LoadQmlContextPropertyLookup) |
| 262 | |
| 263 | MOTH_BEGIN_INSTR(StoreNameSloppy) |
| 264 | d << name; |
| 265 | MOTH_END_INSTR(StoreNameSloppy) |
| 266 | |
| 267 | MOTH_BEGIN_INSTR(StoreNameStrict) |
| 268 | d << name; |
| 269 | MOTH_END_INSTR(StoreNameStrict) |
| 270 | |
| 271 | MOTH_BEGIN_INSTR(LoadElement) |
| 272 | d << dumpRegister(reg: base, nFormals) << "[acc]" ; |
| 273 | MOTH_END_INSTR(LoadElement) |
| 274 | |
| 275 | MOTH_BEGIN_INSTR(StoreElement) |
| 276 | d << dumpRegister(reg: base, nFormals) << "[" << dumpRegister(reg: index, nFormals) << "]" ; |
| 277 | MOTH_END_INSTR(StoreElement) |
| 278 | |
| 279 | MOTH_BEGIN_INSTR(LoadProperty) |
| 280 | d << "acc[" << name << "]" ; |
| 281 | MOTH_END_INSTR(LoadProperty) |
| 282 | |
| 283 | MOTH_BEGIN_INSTR(GetLookup) |
| 284 | d << "acc(" << index << ")" ; |
| 285 | MOTH_END_INSTR(GetLookup) |
| 286 | |
| 287 | MOTH_BEGIN_INSTR(StoreProperty) |
| 288 | d << dumpRegister(reg: base, nFormals) << "[" << name<< "]" ; |
| 289 | MOTH_END_INSTR(StoreProperty) |
| 290 | |
| 291 | MOTH_BEGIN_INSTR(SetLookup) |
| 292 | d << dumpRegister(reg: base, nFormals) << "(" << index << ")" ; |
| 293 | MOTH_END_INSTR(SetLookup) |
| 294 | |
| 295 | MOTH_BEGIN_INSTR(LoadSuperProperty) |
| 296 | d << dumpRegister(reg: property, nFormals); |
| 297 | MOTH_END_INSTR(LoadSuperProperty) |
| 298 | |
| 299 | MOTH_BEGIN_INSTR(StoreSuperProperty) |
| 300 | d << dumpRegister(reg: property, nFormals); |
| 301 | MOTH_END_INSTR(StoreSuperProperty) |
| 302 | |
| 303 | MOTH_BEGIN_INSTR(Yield) |
| 304 | MOTH_END_INSTR(Yield) |
| 305 | |
| 306 | MOTH_BEGIN_INSTR(YieldStar) |
| 307 | MOTH_END_INSTR(YieldStar) |
| 308 | |
| 309 | MOTH_BEGIN_INSTR(Resume) |
| 310 | d << ABSOLUTE_OFFSET(); |
| 311 | MOTH_END_INSTR(Resume) |
| 312 | |
| 313 | MOTH_BEGIN_INSTR(CallValue) |
| 314 | d << dumpRegister(reg: name, nFormals) << dumpArguments(argc, argv, nFormals); |
| 315 | MOTH_END_INSTR(CallValue) |
| 316 | |
| 317 | MOTH_BEGIN_INSTR(CallWithReceiver) |
| 318 | d << dumpRegister(reg: name, nFormals) << dumpRegister(reg: thisObject, nFormals) |
| 319 | << dumpArguments(argc, argv, nFormals); |
| 320 | MOTH_END_INSTR(CallWithReceiver) |
| 321 | |
| 322 | MOTH_BEGIN_INSTR(CallProperty) |
| 323 | d << dumpRegister(reg: base, nFormals) << "." << name << dumpArguments(argc, argv, nFormals) |
| 324 | ; |
| 325 | MOTH_END_INSTR(CallProperty) |
| 326 | |
| 327 | MOTH_BEGIN_INSTR(CallPropertyLookup) |
| 328 | d << dumpRegister(reg: base, nFormals) << "." << lookupIndex |
| 329 | << dumpArguments(argc, argv, nFormals); |
| 330 | MOTH_END_INSTR(CallPropertyLookup) |
| 331 | |
| 332 | MOTH_BEGIN_INSTR(CallElement) |
| 333 | d << dumpRegister(reg: base, nFormals) << "[" << dumpRegister(reg: index, nFormals) << "]" |
| 334 | << dumpArguments(argc, argv, nFormals); |
| 335 | MOTH_END_INSTR(CallElement) |
| 336 | |
| 337 | MOTH_BEGIN_INSTR(CallName) |
| 338 | d << name << dumpArguments(argc, argv, nFormals); |
| 339 | MOTH_END_INSTR(CallName) |
| 340 | |
| 341 | MOTH_BEGIN_INSTR(CallPossiblyDirectEval) |
| 342 | d << dumpArguments(argc, argv, nFormals); |
| 343 | MOTH_END_INSTR(CallPossiblyDirectEval) |
| 344 | |
| 345 | MOTH_BEGIN_INSTR(CallGlobalLookup) |
| 346 | d << index << dumpArguments(argc, argv, nFormals); |
| 347 | MOTH_END_INSTR(CallGlobalLookup) |
| 348 | |
| 349 | MOTH_BEGIN_INSTR(CallQmlContextPropertyLookup) |
| 350 | d << index << dumpArguments(argc, argv, nFormals); |
| 351 | MOTH_END_INSTR(CallQmlContextPropertyLookup) |
| 352 | |
| 353 | MOTH_BEGIN_INSTR(CallWithSpread) |
| 354 | d << "new " << dumpRegister(reg: func, nFormals) << dumpRegister(reg: thisObject, nFormals) |
| 355 | << dumpArguments(argc, argv, nFormals); |
| 356 | MOTH_END_INSTR(CallWithSpread) |
| 357 | |
| 358 | MOTH_BEGIN_INSTR(Construct) |
| 359 | d << "new " << dumpRegister(reg: func, nFormals) << dumpArguments(argc, argv, nFormals); |
| 360 | MOTH_END_INSTR(Construct) |
| 361 | |
| 362 | MOTH_BEGIN_INSTR(ConstructWithSpread) |
| 363 | d << "new " << dumpRegister(reg: func, nFormals) << dumpArguments(argc, argv, nFormals); |
| 364 | MOTH_END_INSTR(ConstructWithSpread) |
| 365 | |
| 366 | MOTH_BEGIN_INSTR(SetUnwindHandler) |
| 367 | if (offset) |
| 368 | d << ABSOLUTE_OFFSET(); |
| 369 | else |
| 370 | d << "<null>" ; |
| 371 | MOTH_END_INSTR(SetUnwindHandler) |
| 372 | |
| 373 | MOTH_BEGIN_INSTR(UnwindDispatch) |
| 374 | MOTH_END_INSTR(UnwindDispatch) |
| 375 | |
| 376 | MOTH_BEGIN_INSTR(UnwindToLabel) |
| 377 | d << "(" << level << ") " << ABSOLUTE_OFFSET(); |
| 378 | MOTH_END_INSTR(UnwindToLabel) |
| 379 | |
| 380 | MOTH_BEGIN_INSTR(DeadTemporalZoneCheck) |
| 381 | d << name; |
| 382 | MOTH_END_INSTR(DeadTemporalZoneCheck) |
| 383 | |
| 384 | MOTH_BEGIN_INSTR(ThrowException) |
| 385 | MOTH_END_INSTR(ThrowException) |
| 386 | |
| 387 | MOTH_BEGIN_INSTR(GetException) |
| 388 | MOTH_END_INSTR(HasException) |
| 389 | |
| 390 | MOTH_BEGIN_INSTR(SetException) |
| 391 | MOTH_END_INSTR(SetExceptionFlag) |
| 392 | |
| 393 | MOTH_BEGIN_INSTR(CreateCallContext) |
| 394 | MOTH_END_INSTR(CreateCallContext) |
| 395 | |
| 396 | MOTH_BEGIN_INSTR(PushCatchContext) |
| 397 | d << index << ", " << name; |
| 398 | MOTH_END_INSTR(PushCatchContext) |
| 399 | |
| 400 | MOTH_BEGIN_INSTR(PushWithContext) |
| 401 | MOTH_END_INSTR(PushWithContext) |
| 402 | |
| 403 | MOTH_BEGIN_INSTR(PushBlockContext) |
| 404 | d << index; |
| 405 | MOTH_END_INSTR(PushBlockContext) |
| 406 | |
| 407 | MOTH_BEGIN_INSTR(CloneBlockContext) |
| 408 | MOTH_END_INSTR(CloneBlockContext) |
| 409 | |
| 410 | MOTH_BEGIN_INSTR(PushScriptContext) |
| 411 | d << index; |
| 412 | MOTH_END_INSTR(PushScriptContext) |
| 413 | |
| 414 | MOTH_BEGIN_INSTR(PopScriptContext) |
| 415 | MOTH_END_INSTR(PopScriptContext) |
| 416 | |
| 417 | MOTH_BEGIN_INSTR(PopContext) |
| 418 | MOTH_END_INSTR(PopContext) |
| 419 | |
| 420 | MOTH_BEGIN_INSTR(GetIterator) |
| 421 | d << iterator; |
| 422 | MOTH_END_INSTR(GetIterator) |
| 423 | |
| 424 | MOTH_BEGIN_INSTR(IteratorNext) |
| 425 | d << dumpRegister(reg: value, nFormals) << ", " << dumpRegister(reg: done, nFormals); |
| 426 | MOTH_END_INSTR(IteratorNext) |
| 427 | |
| 428 | MOTH_BEGIN_INSTR(IteratorNextForYieldStar) |
| 429 | d << dumpRegister(reg: iterator, nFormals) << ", " << dumpRegister(reg: object, nFormals); |
| 430 | MOTH_END_INSTR(IteratorNextForYieldStar) |
| 431 | |
| 432 | MOTH_BEGIN_INSTR(IteratorClose) |
| 433 | d << dumpRegister(reg: done, nFormals); |
| 434 | MOTH_END_INSTR(IteratorClose) |
| 435 | |
| 436 | MOTH_BEGIN_INSTR(DestructureRestElement) |
| 437 | MOTH_END_INSTR(DestructureRestElement) |
| 438 | |
| 439 | MOTH_BEGIN_INSTR(DeleteProperty) |
| 440 | d << dumpRegister(reg: base, nFormals) << "[" << dumpRegister(reg: index, nFormals) << "]" ; |
| 441 | MOTH_END_INSTR(DeleteProperty) |
| 442 | |
| 443 | MOTH_BEGIN_INSTR(DeleteName) |
| 444 | d << name; |
| 445 | MOTH_END_INSTR(DeleteName) |
| 446 | |
| 447 | MOTH_BEGIN_INSTR(TypeofName) |
| 448 | d << name; |
| 449 | MOTH_END_INSTR(TypeofName) |
| 450 | |
| 451 | MOTH_BEGIN_INSTR(TypeofValue) |
| 452 | MOTH_END_INSTR(TypeofValue) |
| 453 | |
| 454 | MOTH_BEGIN_INSTR(DeclareVar) |
| 455 | d << isDeletable << ", " << varName; |
| 456 | MOTH_END_INSTR(DeclareVar) |
| 457 | |
| 458 | MOTH_BEGIN_INSTR(DefineArray) |
| 459 | d << dumpRegister(reg: args, nFormals) << ", " << argc; |
| 460 | MOTH_END_INSTR(DefineArray) |
| 461 | |
| 462 | MOTH_BEGIN_INSTR(DefineObjectLiteral) |
| 463 | d << internalClassId |
| 464 | << ", " << argc |
| 465 | << ", " << dumpRegister(reg: args, nFormals); |
| 466 | MOTH_END_INSTR(DefineObjectLiteral) |
| 467 | |
| 468 | MOTH_BEGIN_INSTR(CreateClass) |
| 469 | d << classIndex |
| 470 | << ", " << dumpRegister(reg: heritage, nFormals) |
| 471 | << ", " << dumpRegister(reg: computedNames, nFormals); |
| 472 | MOTH_END_INSTR(CreateClass) |
| 473 | |
| 474 | MOTH_BEGIN_INSTR(CreateMappedArgumentsObject) |
| 475 | MOTH_END_INSTR(CreateMappedArgumentsObject) |
| 476 | |
| 477 | MOTH_BEGIN_INSTR(CreateUnmappedArgumentsObject) |
| 478 | MOTH_END_INSTR(CreateUnmappedArgumentsObject) |
| 479 | |
| 480 | MOTH_BEGIN_INSTR(CreateRestParameter) |
| 481 | d << argIndex; |
| 482 | MOTH_END_INSTR(CreateRestParameter) |
| 483 | |
| 484 | MOTH_BEGIN_INSTR(ConvertThisToObject) |
| 485 | MOTH_END_INSTR(ConvertThisToObject) |
| 486 | |
| 487 | MOTH_BEGIN_INSTR(LoadSuperConstructor) |
| 488 | MOTH_END_INSTR(LoadSuperConstructor) |
| 489 | |
| 490 | MOTH_BEGIN_INSTR(ToObject) |
| 491 | MOTH_END_INSTR(ToObject) |
| 492 | |
| 493 | MOTH_BEGIN_INSTR(Jump) |
| 494 | d << ABSOLUTE_OFFSET(); |
| 495 | MOTH_END_INSTR(Jump) |
| 496 | |
| 497 | MOTH_BEGIN_INSTR(JumpTrue) |
| 498 | d << ABSOLUTE_OFFSET(); |
| 499 | MOTH_END_INSTR(JumpTrue) |
| 500 | |
| 501 | MOTH_BEGIN_INSTR(JumpFalse) |
| 502 | d << ABSOLUTE_OFFSET(); |
| 503 | MOTH_END_INSTR(JumpFalse) |
| 504 | |
| 505 | MOTH_BEGIN_INSTR(JumpNotUndefined) |
| 506 | d << ABSOLUTE_OFFSET(); |
| 507 | MOTH_END_INSTR(JumpNotUndefined) |
| 508 | |
| 509 | MOTH_BEGIN_INSTR(JumpNoException) |
| 510 | d << ABSOLUTE_OFFSET(); |
| 511 | MOTH_END_INSTR(JumpNoException) |
| 512 | |
| 513 | MOTH_BEGIN_INSTR(CheckException) |
| 514 | MOTH_END_INSTR(CheckException) |
| 515 | |
| 516 | MOTH_BEGIN_INSTR(CmpEqNull) |
| 517 | MOTH_END_INSTR(CmpEqNull) |
| 518 | |
| 519 | MOTH_BEGIN_INSTR(CmpNeNull) |
| 520 | MOTH_END_INSTR(CmpNeNull) |
| 521 | |
| 522 | MOTH_BEGIN_INSTR(CmpEqInt) |
| 523 | d << lhs; |
| 524 | MOTH_END_INSTR(CmpEq) |
| 525 | |
| 526 | MOTH_BEGIN_INSTR(CmpNeInt) |
| 527 | d << lhs; |
| 528 | MOTH_END_INSTR(CmpNeInt) |
| 529 | |
| 530 | MOTH_BEGIN_INSTR(CmpEq) |
| 531 | d << dumpRegister(reg: lhs, nFormals); |
| 532 | MOTH_END_INSTR(CmpEq) |
| 533 | |
| 534 | MOTH_BEGIN_INSTR(CmpNe) |
| 535 | d << dumpRegister(reg: lhs, nFormals); |
| 536 | MOTH_END_INSTR(CmpNe) |
| 537 | |
| 538 | MOTH_BEGIN_INSTR(CmpGt) |
| 539 | d << dumpRegister(reg: lhs, nFormals); |
| 540 | MOTH_END_INSTR(CmpGt) |
| 541 | |
| 542 | MOTH_BEGIN_INSTR(CmpGe) |
| 543 | d << dumpRegister(reg: lhs, nFormals); |
| 544 | MOTH_END_INSTR(CmpGe) |
| 545 | |
| 546 | MOTH_BEGIN_INSTR(CmpLt) |
| 547 | d << dumpRegister(reg: lhs, nFormals); |
| 548 | MOTH_END_INSTR(CmpLt) |
| 549 | |
| 550 | MOTH_BEGIN_INSTR(CmpLe) |
| 551 | d << dumpRegister(reg: lhs, nFormals); |
| 552 | MOTH_END_INSTR(CmpLe) |
| 553 | |
| 554 | MOTH_BEGIN_INSTR(CmpStrictEqual) |
| 555 | d << dumpRegister(reg: lhs, nFormals); |
| 556 | MOTH_END_INSTR(CmpStrictEqual) |
| 557 | |
| 558 | MOTH_BEGIN_INSTR(CmpStrictNotEqual) |
| 559 | d << dumpRegister(reg: lhs, nFormals); |
| 560 | MOTH_END_INSTR(CmpStrictNotEqual) |
| 561 | |
| 562 | MOTH_BEGIN_INSTR(UNot) |
| 563 | MOTH_END_INSTR(UNot) |
| 564 | |
| 565 | MOTH_BEGIN_INSTR(UPlus) |
| 566 | MOTH_END_INSTR(UPlus) |
| 567 | |
| 568 | MOTH_BEGIN_INSTR(UMinus) |
| 569 | MOTH_END_INSTR(UMinus) |
| 570 | |
| 571 | MOTH_BEGIN_INSTR(UCompl) |
| 572 | MOTH_END_INSTR(UCompl) |
| 573 | |
| 574 | MOTH_BEGIN_INSTR(Increment) |
| 575 | MOTH_END_INSTR(Increment) |
| 576 | |
| 577 | MOTH_BEGIN_INSTR(Decrement) |
| 578 | MOTH_END_INSTR(Decrement) |
| 579 | |
| 580 | MOTH_BEGIN_INSTR(Add) |
| 581 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 582 | MOTH_END_INSTR(Add) |
| 583 | |
| 584 | MOTH_BEGIN_INSTR(BitAnd) |
| 585 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 586 | MOTH_END_INSTR(BitAnd) |
| 587 | |
| 588 | MOTH_BEGIN_INSTR(BitOr) |
| 589 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 590 | MOTH_END_INSTR(BitOr) |
| 591 | |
| 592 | MOTH_BEGIN_INSTR(BitXor) |
| 593 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 594 | MOTH_END_INSTR(BitXor) |
| 595 | |
| 596 | MOTH_BEGIN_INSTR(UShr) |
| 597 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 598 | MOTH_END_INSTR(UShr) |
| 599 | |
| 600 | MOTH_BEGIN_INSTR(Shr) |
| 601 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 602 | MOTH_END_INSTR(Shr) |
| 603 | |
| 604 | MOTH_BEGIN_INSTR(Shl) |
| 605 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 606 | MOTH_END_INSTR(Shl) |
| 607 | |
| 608 | MOTH_BEGIN_INSTR(BitAndConst) |
| 609 | d << "acc, " << rhs; |
| 610 | MOTH_END_INSTR(BitAndConst) |
| 611 | |
| 612 | MOTH_BEGIN_INSTR(BitOrConst) |
| 613 | d << "acc, " << rhs; |
| 614 | MOTH_END_INSTR(BitOr) |
| 615 | |
| 616 | MOTH_BEGIN_INSTR(BitXorConst) |
| 617 | d << "acc, " << rhs; |
| 618 | MOTH_END_INSTR(BitXor) |
| 619 | |
| 620 | MOTH_BEGIN_INSTR(UShrConst) |
| 621 | d << "acc, " << rhs; |
| 622 | MOTH_END_INSTR(UShrConst) |
| 623 | |
| 624 | MOTH_BEGIN_INSTR(ShrConst) |
| 625 | d << "acc, " << rhs; |
| 626 | MOTH_END_INSTR(ShrConst) |
| 627 | |
| 628 | MOTH_BEGIN_INSTR(ShlConst) |
| 629 | d << "acc, " << rhs; |
| 630 | MOTH_END_INSTR(ShlConst) |
| 631 | |
| 632 | MOTH_BEGIN_INSTR(Exp) |
| 633 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 634 | MOTH_END_INSTR(Exp) |
| 635 | |
| 636 | MOTH_BEGIN_INSTR(Mul) |
| 637 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 638 | MOTH_END_INSTR(Mul) |
| 639 | |
| 640 | MOTH_BEGIN_INSTR(Div) |
| 641 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 642 | MOTH_END_INSTR(Div) |
| 643 | |
| 644 | MOTH_BEGIN_INSTR(Mod) |
| 645 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 646 | MOTH_END_INSTR(Mod) |
| 647 | |
| 648 | MOTH_BEGIN_INSTR(Sub) |
| 649 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 650 | MOTH_END_INSTR(Sub) |
| 651 | |
| 652 | MOTH_BEGIN_INSTR(CmpIn) |
| 653 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 654 | MOTH_END_INSTR(CmpIn) |
| 655 | |
| 656 | MOTH_BEGIN_INSTR(CmpInstanceOf) |
| 657 | d << dumpRegister(reg: lhs, nFormals) << ", acc" ; |
| 658 | MOTH_END_INSTR(CmpInstanceOf) |
| 659 | |
| 660 | MOTH_BEGIN_INSTR(Ret) |
| 661 | MOTH_END_INSTR(Ret) |
| 662 | |
| 663 | MOTH_BEGIN_INSTR(Debug) |
| 664 | MOTH_END_INSTR(Debug) |
| 665 | |
| 666 | MOTH_BEGIN_INSTR(InitializeBlockDeadTemporalZone) |
| 667 | d << dumpRegister(reg: firstReg, nFormals) << ", " << count; |
| 668 | MOTH_END_INSTR(InitializeBlockDeadTemporalZone) |
| 669 | |
| 670 | MOTH_BEGIN_INSTR(ThrowOnNullOrUndefined) |
| 671 | MOTH_END_INSTR(ThrowOnNullOrUndefined) |
| 672 | |
| 673 | MOTH_BEGIN_INSTR(GetTemplateObject) |
| 674 | d << index; |
| 675 | MOTH_END_INSTR(GetTemplateObject) |
| 676 | |
| 677 | MOTH_BEGIN_INSTR(TailCall) |
| 678 | d << dumpRegister(reg: func, nFormals) << dumpRegister(reg: thisObject, nFormals) << dumpArguments(argc, argv, nFormals); |
| 679 | MOTH_END_INSTR(TailCall) |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | } |
| 684 | } |
| 685 | QT_END_NAMESPACE |
| 686 | |