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