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

source code of qtdeclarative/src/qml/compiler/qv4instr_moth.cpp