Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
5
#
include
"qv4instr_moth_p.h"
6
#
include
<
private
/
qv4compileddata_p
.
h
>
7
#
include
<
private
/
qv4calldata_p
.
h
>
8
9
#
include
<
QtCore
/
qdebug
.
h
>
10
11
using
namespace
QV4;
12
using
namespace
QV4
::
Moth
;
13
14
static
QByteArray
alignedNumber
(
int
n) {
15
QByteArray number = QByteArray::number(n);
16
return
number.prepend(8 - number.size(),
' '
);
17
}
18
19
static
QByteArray
alignedLineNumber
(
int
line) {
20
if
(line > 0)
21
return
alignedNumber(
static_cast
<
int
>(line));
22
return
QByteArray(
" "
);
23
}
24
25
static
QByteArray
rawBytes
(
const
char
*data,
int
n)
26
{
27
QByteArray ba;
28
while
(n) {
29
uint num = *
reinterpret_cast
<
const
uchar *>(data);
30
if
(num < 16)
31
ba +=
'0'
;
32
ba += QByteArray::number(num, 16) +
" "
;
33
++data;
34
--n;
35
}
36
while
(ba.size() < 25)
37
ba +=
' '
;
38
return
ba;
39
}
40
41
#
define
ABSOLUTE_OFFSET
(
)
42
(
code
+
beginOffset
-
start
+
offset
)
43
44
#
define
MOTH_BEGIN_INSTR
(
instr
)
45
{
46
INSTR_
##
instr
(
MOTH_DECODE_WITH_BASE
)
47
if
(
static_cast
<
int
>
(
Instr
::
Type
::
instr
)
>=
0x100
)
48
--
base_ptr
;
49
s
<<
alignedLineNumber
(
line
)
<<
alignedNumber
(
beginOffset
+
codeOffset
)
.
constData
(
)
<<
": "
50
<<
rawBytes
(
base_ptr
,
int
(
code
-
base_ptr
)
)
<<
#
instr
<<
" "
;
51
52
#
define
MOTH_END_INSTR
(
instr
)
53
s
<<
"\n"
;
54
continue
;
55
}
56
57
QT_BEGIN_NAMESPACE
58
namespace
QV4
{
59
namespace
Moth
{
60
61
QString
dumpRegister
(
int
reg,
int
nFormals)
62
{
63
Q_STATIC_ASSERT(offsetof(CallData, function) == 0);
64
Q_STATIC_ASSERT(offsetof(CallData, context) ==
sizeof
(StaticValue));
65
Q_STATIC_ASSERT(offsetof(CallData, accumulator) == 2*
sizeof
(StaticValue));
66
Q_STATIC_ASSERT(offsetof(CallData, thisObject) == 3*
sizeof
(StaticValue));
67
if
(reg == CallData::Function)
68
return
QStringLiteral(
"(function)"
);
69
else
if
(reg == CallData::Context)
70
return
QStringLiteral(
"(context)"
);
71
else
if
(reg == CallData::Accumulator)
72
return
QStringLiteral(
"(accumulator)"
);
73
else
if
(reg == CallData::NewTarget)
74
return
QStringLiteral(
"(new.target)"
);
75
else
if
(reg == CallData::This)
76
return
QStringLiteral(
"(this)"
);
77
else
if
(reg == CallData::Argc)
78
return
QStringLiteral(
"(argc)"
);
79
reg -= CallData::HeaderSize();
80
if
(reg < nFormals)
81
return
QStringLiteral(
"a%1"
).arg(reg);
82
reg -= nFormals;
83
return
QStringLiteral(
"r%1"
).arg(reg);
84
85
}
86
87
QString
dumpArguments
(
int
argc,
int
argv,
int
nFormals)
88
{
89
if
(!argc)
90
return
QStringLiteral(
"()"
);
91
return
QStringLiteral(
"("
) + dumpRegister(argv, nFormals) + QStringLiteral(
", "
) + QString::number(argc) + QStringLiteral(
")"
);
92
}
93
94
QString
dumpBytecode
(
95
const
char
*code,
int
len,
int
nLocals,
int
nFormals,
int
/*startLine*/
,
96
const
QList<CompiledData::CodeOffsetToLineAndStatement> &lineAndStatementNumberMapping)
97
{
98
return
dumpBytecode(code, len, nLocals, nFormals, 0, len - 1, lineAndStatementNumberMapping);
99
}
100
101
QT_WARNING_PUSH
102
QT_WARNING_DISABLE_LARGE_STACK_FRAME
// unclear how this can be shrunk...
103
QString
dumpBytecode
(
104
const
char
*
code
,
int
len
,
int
nLocals
,
int
nFormals
,
int
beginOffset
,
int
endOffset
,
105
const
QList
<
CompiledData
::
CodeOffsetToLineAndStatement
> &
lineAndStatementNumberMapping
)
106
{
107
Q_ASSERT
(
beginOffset
<=
endOffset
&& 0 <=
beginOffset
&&
endOffset
<=
len
);
108
109
MOTH_JUMP_TABLE
;
110
111
auto
findLine
= [](
const
CompiledData
::
CodeOffsetToLineAndStatement
&
entry
,
uint
offset
) {
112
return
entry
.
codeOffset
<
offset
;
113
};
114
115
QString
output
;
116
QTextStream
s
{ &
output
};
117
118
int
lastLine
= -1;
119
code
+=
beginOffset
;
120
const
char
*
start
=
code
;
121
const
char
*
end
=
code
+ (
endOffset
-
beginOffset
) + 1;
122
while
(
code
<
end
) {
123
const
auto
codeToLine
=
std
::
lower_bound
(
124
lineAndStatementNumberMapping
.
constBegin
(),
125
lineAndStatementNumberMapping
.
constEnd
(),
126
static_cast
<
uint
>(
code
-
start
+
beginOffset
) + 1,
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
s
<<
dumpRegister
(
reg
,
nFormals
);
139
MOTH_END_INSTR
(LoadReg)
140
141
MOTH_BEGIN_INSTR
(
StoreReg
)
142
s
<<
dumpRegister
(
reg
,
nFormals
);
143
MOTH_END_INSTR
(StoreReg)
144
145
MOTH_BEGIN_INSTR
(
MoveReg
)
146
s
<<
dumpRegister
(
srcReg
,
nFormals
) <<
", "
<<
dumpRegister
(
destReg
,
nFormals
);
147
MOTH_END_INSTR
(MoveReg)
148
149
MOTH_BEGIN_INSTR
(
LoadImport
)
150
s
<<
"i"
<<
index
;
151
MOTH_END_INSTR
(LoadImport)
152
153
MOTH_BEGIN_INSTR
(
LoadConst
)
154
s
<<
"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
s
<<
value
;
174
MOTH_END_INSTR
(LoadInt)
175
176
MOTH_BEGIN_INSTR
(
MoveConst
)
177
s
<<
"C"
<<
constIndex
<<
", "
<<
dumpRegister
(
destTemp
,
nFormals
);
178
MOTH_END_INSTR
(MoveConst)
179
180
MOTH_BEGIN_INSTR
(
LoadLocal
)
181
if
(
index
<
nLocals
)
182
s
<<
"l"
<<
index
;
183
else
184
s
<<
"a"
<< (
index
-
nLocals
);
185
MOTH_END_INSTR
(LoadLocal)
186
187
MOTH_BEGIN_INSTR
(
StoreLocal
)
188
if
(
index
<
nLocals
)
189
s
<<
"l"
<<
index
;
190
else
191
s
<<
"a"
<< (
index
-
nLocals
);
192
MOTH_END_INSTR
(StoreLocal)
193
194
MOTH_BEGIN_INSTR
(
LoadScopedLocal
)
195
if
(
index
<
nLocals
)
196
s
<<
"l"
<<
index
<<
"@"
<<
scope
;
197
else
198
s
<<
"a"
<< (
index
-
nLocals
) <<
"@"
<<
scope
;
199
MOTH_END_INSTR
(LoadScopedLocal)
200
201
MOTH_BEGIN_INSTR
(
StoreScopedLocal
)
202
if
(
index
<
nLocals
)
203
s
<<
", "
<<
"l"
<<
index
<<
"@"
<<
scope
;
204
else
205
s
<<
", "
<<
"a"
<< (
index
-
nLocals
) <<
"@"
<<
scope
;
206
MOTH_END_INSTR
(StoreScopedLocal)
207
208
MOTH_BEGIN_INSTR
(
LoadRuntimeString
)
209
s
<<
stringId
;
210
MOTH_END_INSTR
(LoadRuntimeString)
211
212
MOTH_BEGIN_INSTR
(
MoveRegExp
)
213
s
<<
regExpId
<<
", "
<<
dumpRegister
(
destReg
,
nFormals
);
214
MOTH_END_INSTR
(MoveRegExp)
215
216
MOTH_BEGIN_INSTR
(
LoadClosure
)
217
s
<<
value
;
218
MOTH_END_INSTR
(LoadClosure)
219
220
MOTH_BEGIN_INSTR
(
LoadName
)
221
s
<<
name
;
222
MOTH_END_INSTR
(LoadName)
223
224
MOTH_BEGIN_INSTR
(
LoadGlobalLookup
)
225
s
<<
index
;
226
MOTH_END_INSTR
(LoadGlobalLookup)
227
228
MOTH_BEGIN_INSTR
(
LoadQmlContextPropertyLookup
)
229
s
<<
index
;
230
MOTH_END_INSTR
(LoadQmlContextPropertyLookup)
231
232
MOTH_BEGIN_INSTR
(
StoreNameSloppy
)
233
s
<<
name
;
234
MOTH_END_INSTR
(StoreNameSloppy)
235
236
MOTH_BEGIN_INSTR
(
StoreNameStrict
)
237
s
<<
name
;
238
MOTH_END_INSTR
(StoreNameStrict)
239
240
MOTH_BEGIN_INSTR
(
LoadElement
)
241
s
<<
dumpRegister
(
base
,
nFormals
) <<
"[acc]"
;
242
MOTH_END_INSTR
(LoadElement)
243
244
MOTH_BEGIN_INSTR
(
StoreElement
)
245
s
<<
dumpRegister
(
base
,
nFormals
) <<
"["
<<
dumpRegister
(
index
,
nFormals
) <<
"]"
;
246
MOTH_END_INSTR
(StoreElement)
247
248
MOTH_BEGIN_INSTR
(
LoadProperty
)
249
s
<<
"acc["
<<
name
<<
"]"
;
250
MOTH_END_INSTR
(LoadProperty)
251
252
MOTH_BEGIN_INSTR
(
LoadOptionalProperty
)
253
s
<<
"acc["
<<
name
<<
"], jump("
<<
ABSOLUTE_OFFSET
() <<
")"
;
254
MOTH_END_INSTR
(LoadOptionalProperty)
255
256
MOTH_BEGIN_INSTR
(
GetLookup
)
257
s
<<
"acc("
<<
index
<<
")"
;
258
MOTH_END_INSTR
(GetLookup)
259
260
MOTH_BEGIN_INSTR
(
GetOptionalLookup
)
261
s
<<
"acc("
<<
index
<<
"), jump("
<<
ABSOLUTE_OFFSET
() <<
")"
;
262
MOTH_END_INSTR
(GetOptionalLookup)
263
264
MOTH_BEGIN_INSTR
(
StoreProperty
)
265
s
<<
dumpRegister
(
base
,
nFormals
) <<
"["
<<
name
<<
"]"
;
266
MOTH_END_INSTR
(StoreProperty)
267
268
MOTH_BEGIN_INSTR
(
SetLookup
)
269
s
<<
dumpRegister
(
base
,
nFormals
) <<
"("
<<
index
<<
")"
;
270
MOTH_END_INSTR
(SetLookup)
271
272
MOTH_BEGIN_INSTR
(
LoadSuperProperty
)
273
s
<<
dumpRegister
(
property
,
nFormals
);
274
MOTH_END_INSTR
(LoadSuperProperty)
275
276
MOTH_BEGIN_INSTR
(
StoreSuperProperty
)
277
s
<<
dumpRegister
(
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
s
<<
ABSOLUTE_OFFSET
();
288
MOTH_END_INSTR
(Resume)
289
290
MOTH_BEGIN_INSTR
(
CallValue
)
291
s
<<
dumpRegister
(
name
,
nFormals
) <<
dumpArguments
(
argc
,
argv
,
nFormals
);
292
MOTH_END_INSTR
(CallValue)
293
294
MOTH_BEGIN_INSTR
(
CallWithReceiver
)
295
s
<<
dumpRegister
(
name
,
nFormals
) <<
dumpRegister
(
thisObject
,
nFormals
)
296
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
297
MOTH_END_INSTR
(CallWithReceiver)
298
299
MOTH_BEGIN_INSTR
(
CallProperty
)
300
s
<<
dumpRegister
(
base
,
nFormals
) <<
"."
<<
name
<<
dumpArguments
(
argc
,
argv
,
nFormals
)
301
;
302
MOTH_END_INSTR
(CallProperty)
303
304
MOTH_BEGIN_INSTR
(
CallPropertyLookup
)
305
s
<<
dumpRegister
(
base
,
nFormals
) <<
"."
<<
lookupIndex
306
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
307
MOTH_END_INSTR
(CallPropertyLookup)
308
309
MOTH_BEGIN_INSTR
(
CallName
)
310
s
<<
name
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
311
MOTH_END_INSTR
(CallName)
312
313
MOTH_BEGIN_INSTR
(
CallPossiblyDirectEval
)
314
s
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
315
MOTH_END_INSTR
(CallPossiblyDirectEval)
316
317
MOTH_BEGIN_INSTR
(
CallGlobalLookup
)
318
s
<<
index
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
319
MOTH_END_INSTR
(CallGlobalLookup)
320
321
MOTH_BEGIN_INSTR
(
CallQmlContextPropertyLookup
)
322
s
<<
index
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
323
MOTH_END_INSTR
(CallQmlContextPropertyLookup)
324
325
MOTH_BEGIN_INSTR
(
CallWithSpread
)
326
s
<<
"new "
<<
dumpRegister
(
func
,
nFormals
) <<
dumpRegister
(
thisObject
,
nFormals
)
327
<<
dumpArguments
(
argc
,
argv
,
nFormals
);
328
MOTH_END_INSTR
(CallWithSpread)
329
330
MOTH_BEGIN_INSTR
(
Construct
)
331
s
<<
"new "
<<
dumpRegister
(
func
,
nFormals
) <<
dumpArguments
(
argc
,
argv
,
nFormals
);
332
MOTH_END_INSTR
(Construct)
333
334
MOTH_BEGIN_INSTR
(
ConstructWithSpread
)
335
s
<<
"new "
<<
dumpRegister
(
func
,
nFormals
) <<
dumpArguments
(
argc
,
argv
,
nFormals
);
336
MOTH_END_INSTR
(ConstructWithSpread)
337
338
MOTH_BEGIN_INSTR
(
SetUnwindHandler
)
339
if
(
offset
)
340
s
<<
ABSOLUTE_OFFSET
();
341
else
342
s
<<
"<null>"
;
343
MOTH_END_INSTR
(SetUnwindHandler)
344
345
MOTH_BEGIN_INSTR
(
UnwindDispatch
)
346
MOTH_END_INSTR
(UnwindDispatch)
347
348
MOTH_BEGIN_INSTR
(
UnwindToLabel
)
349
s
<<
"("
<<
level
<<
") "
<<
ABSOLUTE_OFFSET
();
350
MOTH_END_INSTR
(UnwindToLabel)
351
352
MOTH_BEGIN_INSTR
(
DeadTemporalZoneCheck
)
353
s
<<
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
s
<<
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
s
<<
index
;
377
MOTH_END_INSTR
(PushBlockContext)
378
379
MOTH_BEGIN_INSTR
(
CloneBlockContext
)
380
MOTH_END_INSTR
(CloneBlockContext)
381
382
MOTH_BEGIN_INSTR
(
PushScriptContext
)
383
s
<<
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
s
<<
iterator
;
394
MOTH_END_INSTR
(GetIterator)
395
396
MOTH_BEGIN_INSTR
(
IteratorNext
)
397
s
<<
dumpRegister
(
value
,
nFormals
) <<
", "
<<
ABSOLUTE_OFFSET
();
398
MOTH_END_INSTR
(IteratorNext)
399
400
MOTH_BEGIN_INSTR
(
IteratorNextForYieldStar
)
401
s
<<
dumpRegister
(
iterator
,
nFormals
) <<
", "
<<
dumpRegister
(
object
,
nFormals
)
402
<<
ABSOLUTE_OFFSET
();
403
MOTH_END_INSTR
(IteratorNextForYieldStar)
404
405
MOTH_BEGIN_INSTR
(
IteratorClose
)
406
MOTH_END_INSTR
(IteratorClose)
407
408
MOTH_BEGIN_INSTR
(
DestructureRestElement
)
409
MOTH_END_INSTR
(DestructureRestElement)
410
411
MOTH_BEGIN_INSTR
(
DeleteProperty
)
412
s
<<
dumpRegister
(
base
,
nFormals
) <<
"["
<<
dumpRegister
(
index
,
nFormals
) <<
"]"
;
413
MOTH_END_INSTR
(DeleteProperty)
414
415
MOTH_BEGIN_INSTR
(
DeleteName
)
416
s
<<
name
;
417
MOTH_END_INSTR
(DeleteName)
418
419
MOTH_BEGIN_INSTR
(
TypeofName
)
420
s
<<
name
;
421
MOTH_END_INSTR
(TypeofName)
422
423
MOTH_BEGIN_INSTR
(
TypeofValue
)
424
MOTH_END_INSTR
(TypeofValue)
425
426
MOTH_BEGIN_INSTR
(
DeclareVar
)
427
s
<<
isDeletable
<<
", "
<<
varName
;
428
MOTH_END_INSTR
(DeclareVar)
429
430
MOTH_BEGIN_INSTR
(
DefineArray
)
431
s
<<
dumpRegister
(
args
,
nFormals
) <<
", "
<<
argc
;
432
MOTH_END_INSTR
(DefineArray)
433
434
MOTH_BEGIN_INSTR
(
DefineObjectLiteral
)
435
s
<<
internalClassId
436
<<
", "
<<
argc
437
<<
", "
<<
dumpRegister
(
args
,
nFormals
);
438
MOTH_END_INSTR
(DefineObjectLiteral)
439
440
MOTH_BEGIN_INSTR
(
CreateClass
)
441
s
<<
classIndex
442
<<
", "
<<
dumpRegister
(
heritage
,
nFormals
)
443
<<
", "
<<
dumpRegister
(
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
s
<<
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
s
<<
ABSOLUTE_OFFSET
();
467
MOTH_END_INSTR
(Jump)
468
469
MOTH_BEGIN_INSTR
(
JumpTrue
)
470
s
<<
ABSOLUTE_OFFSET
();
471
MOTH_END_INSTR
(JumpTrue)
472
473
MOTH_BEGIN_INSTR
(
JumpFalse
)
474
s
<<
ABSOLUTE_OFFSET
();
475
MOTH_END_INSTR
(JumpFalse)
476
477
MOTH_BEGIN_INSTR
(
JumpNotUndefined
)
478
s
<<
ABSOLUTE_OFFSET
();
479
MOTH_END_INSTR
(JumpNotUndefined)
480
481
MOTH_BEGIN_INSTR
(
JumpNoException
)
482
s
<<
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
s
<<
lhs
;
496
MOTH_END_INSTR
(CmpEq)
497
498
MOTH_BEGIN_INSTR
(
CmpNeInt
)
499
s
<<
lhs
;
500
MOTH_END_INSTR
(CmpNeInt)
501
502
MOTH_BEGIN_INSTR
(
CmpEq
)
503
s
<<
dumpRegister
(
lhs
,
nFormals
);
504
MOTH_END_INSTR
(CmpEq)
505
506
MOTH_BEGIN_INSTR
(
CmpNe
)
507
s
<<
dumpRegister
(
lhs
,
nFormals
);
508
MOTH_END_INSTR
(CmpNe)
509
510
MOTH_BEGIN_INSTR
(
CmpGt
)
511
s
<<
dumpRegister
(
lhs
,
nFormals
);
512
MOTH_END_INSTR
(CmpGt)
513
514
MOTH_BEGIN_INSTR
(
CmpGe
)
515
s
<<
dumpRegister
(
lhs
,
nFormals
);
516
MOTH_END_INSTR
(CmpGe)
517
518
MOTH_BEGIN_INSTR
(
CmpLt
)
519
s
<<
dumpRegister
(
lhs
,
nFormals
);
520
MOTH_END_INSTR
(CmpLt)
521
522
MOTH_BEGIN_INSTR
(
CmpLe
)
523
s
<<
dumpRegister
(
lhs
,
nFormals
);
524
MOTH_END_INSTR
(CmpLe)
525
526
MOTH_BEGIN_INSTR
(
CmpStrictEqual
)
527
s
<<
dumpRegister
(
lhs
,
nFormals
);
528
MOTH_END_INSTR
(CmpStrictEqual)
529
530
MOTH_BEGIN_INSTR
(
CmpStrictNotEqual
)
531
s
<<
dumpRegister
(
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
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
554
MOTH_END_INSTR
(Add)
555
556
MOTH_BEGIN_INSTR
(
BitAnd
)
557
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
558
MOTH_END_INSTR
(BitAnd)
559
560
MOTH_BEGIN_INSTR
(
BitOr
)
561
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
562
MOTH_END_INSTR
(BitOr)
563
564
MOTH_BEGIN_INSTR
(
BitXor
)
565
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
566
MOTH_END_INSTR
(BitXor)
567
568
MOTH_BEGIN_INSTR
(
UShr
)
569
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
570
MOTH_END_INSTR
(UShr)
571
572
MOTH_BEGIN_INSTR
(
Shr
)
573
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
574
MOTH_END_INSTR
(Shr)
575
576
MOTH_BEGIN_INSTR
(
Shl
)
577
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
578
MOTH_END_INSTR
(Shl)
579
580
MOTH_BEGIN_INSTR
(
BitAndConst
)
581
s
<<
"acc, "
<<
rhs
;
582
MOTH_END_INSTR
(BitAndConst)
583
584
MOTH_BEGIN_INSTR
(
BitOrConst
)
585
s
<<
"acc, "
<<
rhs
;
586
MOTH_END_INSTR
(BitOr)
587
588
MOTH_BEGIN_INSTR
(
BitXorConst
)
589
s
<<
"acc, "
<<
rhs
;
590
MOTH_END_INSTR
(BitXor)
591
592
MOTH_BEGIN_INSTR
(
UShrConst
)
593
s
<<
"acc, "
<<
rhs
;
594
MOTH_END_INSTR
(UShrConst)
595
596
MOTH_BEGIN_INSTR
(
ShrConst
)
597
s
<<
"acc, "
<<
rhs
;
598
MOTH_END_INSTR
(ShrConst)
599
600
MOTH_BEGIN_INSTR
(
ShlConst
)
601
s
<<
"acc, "
<<
rhs
;
602
MOTH_END_INSTR
(ShlConst)
603
604
MOTH_BEGIN_INSTR
(
Exp
)
605
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
606
MOTH_END_INSTR
(Exp)
607
608
MOTH_BEGIN_INSTR
(
Mul
)
609
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
610
MOTH_END_INSTR
(Mul)
611
612
MOTH_BEGIN_INSTR
(
Div
)
613
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
614
MOTH_END_INSTR
(Div)
615
616
MOTH_BEGIN_INSTR
(
Mod
)
617
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
618
MOTH_END_INSTR
(Mod)
619
620
MOTH_BEGIN_INSTR
(
Sub
)
621
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
622
MOTH_END_INSTR
(Sub)
623
624
MOTH_BEGIN_INSTR
(
As
)
625
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
626
MOTH_END_INSTR
(Sub)
627
628
MOTH_BEGIN_INSTR
(
CmpIn
)
629
s
<<
dumpRegister
(
lhs
,
nFormals
) <<
", acc"
;
630
MOTH_END_INSTR
(CmpIn)
631
632
MOTH_BEGIN_INSTR
(
CmpInstanceOf
)
633
s
<<
dumpRegister
(
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
s
<<
dumpRegister
(
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
s
<<
index
;
651
MOTH_END_INSTR
(GetTemplateObject)
652
653
MOTH_BEGIN_INSTR
(
TailCall
)
654
s
<<
dumpRegister
(
func
,
nFormals
) <<
dumpRegister
(
thisObject
,
nFormals
) <<
dumpArguments
(
argc
,
argv
,
nFormals
);
655
MOTH_END_INSTR
(TailCall)
656
}
657
return
output
;
658
}
659
QT_WARNING_POP
// DISABLE_LARGE_STACK_FRAME
660
661
}
662
}
663
QT_END_NAMESPACE
QV4::Moth
Definition
qv4debuginstructions.cpp:10
QV4::Moth::dumpBytecode
QString dumpBytecode(const char *code, int len, int nLocals, int nFormals, int, const QList< CompiledData::CodeOffsetToLineAndStatement > &lineAndStatementNumberMapping)
Definition
qv4instr_moth.cpp:94
QV4::Moth::dumpRegister
QString dumpRegister(int reg, int nFormals)
Definition
qv4instr_moth.cpp:61
QV4::Moth::dumpArguments
QString dumpArguments(int argc, int argv, int nFormals)
Definition
qv4instr_moth.cpp:87
QV4
Definition
qjsvalue.h:24
ABSOLUTE_OFFSET
#define ABSOLUTE_OFFSET()
Definition
qv4instr_moth.cpp:41
rawBytes
static QByteArray rawBytes(const char *data, int n)
Definition
qv4instr_moth.cpp:25
alignedLineNumber
static QByteArray alignedLineNumber(int line)
Definition
qv4instr_moth.cpp:19
MOTH_BEGIN_INSTR
#define MOTH_BEGIN_INSTR(instr)
Definition
qv4instr_moth.cpp:44
MOTH_END_INSTR
#define MOTH_END_INSTR(instr)
Definition
qv4instr_moth.cpp:52
alignedNumber
static QByteArray alignedNumber(int n)
Definition
qv4instr_moth.cpp:14
MOTH_JUMP_TABLE
#define MOTH_JUMP_TABLE
Definition
qv4instr_moth_p.h:423
MOTH_DISPATCH
#define MOTH_DISPATCH()
Definition
qv4instr_moth_p.h:433
qtdeclarative
src
qml
compiler
qv4instr_moth.cpp
Generated on
for Qt by
1.18.0