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