Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jit/qv4assembler.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | namespace QV4 { | - | ||||||||||||
10 | namespace JIT { | - | ||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | - | |||||||||||||
14 | const QV4::Value::ValueTypeInternal IntegerTag = QV4::Value::ValueTypeInternal::Integer; | - | ||||||||||||
15 | - | |||||||||||||
16 | static ReturnedValue toNumberHelper(ReturnedValue v) | - | ||||||||||||
17 | { | - | ||||||||||||
18 | return never executed: Encode(Value::fromReturnedValue(v).toNumber());return Encode(Value::fromReturnedValue(v).toNumber()); never executed: return Encode(Value::fromReturnedValue(v).toNumber()); | 0 | ||||||||||||
19 | } | - | ||||||||||||
20 | - | |||||||||||||
21 | static ReturnedValue toInt32Helper(ReturnedValue v) | - | ||||||||||||
22 | { | - | ||||||||||||
23 | return executed 512 times by 1 test: Encode(Value::fromReturnedValue(v).toInt32());return Encode(Value::fromReturnedValue(v).toInt32()); Executed by:
executed 512 times by 1 test: return Encode(Value::fromReturnedValue(v).toInt32()); Executed by:
| 512 | ||||||||||||
24 | } | - | ||||||||||||
25 | - | |||||||||||||
26 | - | |||||||||||||
27 | - | |||||||||||||
28 | - | |||||||||||||
29 | struct PlatformAssembler_X86_64_SysV : JSC::MacroAssembler<JSC::MacroAssemblerX86_64> | - | ||||||||||||
30 | { | - | ||||||||||||
31 | static const RegisterID NoRegister = RegisterID(-1); | - | ||||||||||||
32 | - | |||||||||||||
33 | static const RegisterID ReturnValueRegister = RegisterID::eax; | - | ||||||||||||
34 | static const RegisterID ReturnValueRegisterValue = ReturnValueRegister; | - | ||||||||||||
35 | static const RegisterID AccumulatorRegister = RegisterID::eax; | - | ||||||||||||
36 | static const RegisterID AccumulatorRegisterValue = AccumulatorRegister; | - | ||||||||||||
37 | static const RegisterID ScratchRegister = RegisterID::r10; | - | ||||||||||||
38 | static const RegisterID ScratchRegister2 = RegisterID::r9; | - | ||||||||||||
39 | static const RegisterID JSStackFrameRegister = RegisterID::r12; | - | ||||||||||||
40 | static const RegisterID CppStackFrameRegister = RegisterID::r13; | - | ||||||||||||
41 | static const RegisterID EngineRegister = RegisterID::r14; | - | ||||||||||||
42 | static const RegisterID StackPointerRegister = RegisterID::esp; | - | ||||||||||||
43 | static const RegisterID FramePointerRegister = RegisterID::ebp; | - | ||||||||||||
44 | static const FPRegisterID FPScratchRegister = FPRegisterID::xmm1; | - | ||||||||||||
45 | - | |||||||||||||
46 | static const RegisterID Arg0Reg = RegisterID::edi; | - | ||||||||||||
47 | static const RegisterID Arg1Reg = RegisterID::esi; | - | ||||||||||||
48 | static const RegisterID Arg2Reg = RegisterID::edx; | - | ||||||||||||
49 | static const RegisterID Arg3Reg = RegisterID::ecx; | - | ||||||||||||
50 | static const RegisterID Arg4Reg = RegisterID::r8; | - | ||||||||||||
51 | static const RegisterID Arg5Reg = RegisterID::r9; | - | ||||||||||||
52 | static const RegisterID Arg6Reg = NoRegister; | - | ||||||||||||
53 | static const RegisterID Arg7Reg = NoRegister; | - | ||||||||||||
54 | static const int ArgInRegCount = 6; | - | ||||||||||||
55 | - | |||||||||||||
56 | void popValue() | - | ||||||||||||
57 | { | - | ||||||||||||
58 | addPtr(TrustedImmPtr(sizeof(ReturnedValue)), StackPointerRegister); | - | ||||||||||||
59 | } never executed: end of block | 0 | ||||||||||||
60 | - | |||||||||||||
61 | void generatePlatformFunctionEntry() | - | ||||||||||||
62 | { | - | ||||||||||||
63 | push(RegisterID::ebp); | - | ||||||||||||
64 | move(RegisterID::esp, RegisterID::ebp); | - | ||||||||||||
65 | move(TrustedImmPtr(nullptr), AccumulatorRegister); push(AccumulatorRegister); | - | ||||||||||||
66 | push(JSStackFrameRegister); | - | ||||||||||||
67 | push(CppStackFrameRegister); | - | ||||||||||||
68 | push(EngineRegister); | - | ||||||||||||
69 | move(Arg0Reg, CppStackFrameRegister); | - | ||||||||||||
70 | move(Arg1Reg, EngineRegister); | - | ||||||||||||
71 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
72 | - | |||||||||||||
73 | void generatePlatformFunctionExit() | - | ||||||||||||
74 | { | - | ||||||||||||
75 | pop(EngineRegister); | - | ||||||||||||
76 | pop(CppStackFrameRegister); | - | ||||||||||||
77 | pop(JSStackFrameRegister); | - | ||||||||||||
78 | pop(); | - | ||||||||||||
79 | pop(RegisterID::ebp); | - | ||||||||||||
80 | ret(); | - | ||||||||||||
81 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
82 | - | |||||||||||||
83 | void callAbsolute(const void *funcPtr) | - | ||||||||||||
84 | { | - | ||||||||||||
85 | move(TrustedImmPtr(funcPtr), ScratchRegister); | - | ||||||||||||
86 | call(ScratchRegister); | - | ||||||||||||
87 | } executed 83222 times by 64 tests: end of block Executed by:
| 83222 | ||||||||||||
88 | - | |||||||||||||
89 | void pushAligned(RegisterID reg) | - | ||||||||||||
90 | { | - | ||||||||||||
91 | subPtr(TrustedImm32(PointerSize), StackPointerRegister); | - | ||||||||||||
92 | push(reg); | - | ||||||||||||
93 | } executed 98 times by 10 tests: end of block Executed by:
| 98 | ||||||||||||
94 | - | |||||||||||||
95 | void popAligned(RegisterID reg) | - | ||||||||||||
96 | { | - | ||||||||||||
97 | pop(reg); | - | ||||||||||||
98 | addPtr(TrustedImm32(PointerSize), StackPointerRegister); | - | ||||||||||||
99 | } executed 28 times by 1 test: end of block Executed by:
| 28 | ||||||||||||
100 | }; | - | ||||||||||||
101 | - | |||||||||||||
102 | typedef PlatformAssembler_X86_64_SysV PlatformAssemblerBase; | - | ||||||||||||
103 | struct PlatformAssemblerCommon : PlatformAssemblerBase | - | ||||||||||||
104 | { | - | ||||||||||||
105 | const Value* constantTable; | - | ||||||||||||
106 | struct JumpTarget { JSC::MacroAssemblerBase::Jump jump; int offset; }; | - | ||||||||||||
107 | std::vector<JumpTarget> patches; | - | ||||||||||||
108 | struct ExceptionHanlderTarget { JSC::MacroAssemblerBase::DataLabelPtr label; int offset; }; | - | ||||||||||||
109 | std::vector<ExceptionHanlderTarget> ehTargets; | - | ||||||||||||
110 | QHash<int, JSC::MacroAssemblerBase::Label> labelsByOffset; | - | ||||||||||||
111 | QHash<const void *, const char *> functions; | - | ||||||||||||
112 | std::vector<Jump> catchyJumps; | - | ||||||||||||
113 | Label functionExit; | - | ||||||||||||
114 | - | |||||||||||||
115 | Address exceptionHandlerAddress() const | - | ||||||||||||
116 | { | - | ||||||||||||
117 | return executed 13338 times by 64 tests: Address(FramePointerRegister, -1 * PointerSize);return Address(FramePointerRegister, -1 * PointerSize); Executed by:
executed 13338 times by 64 tests: return Address(FramePointerRegister, -1 * PointerSize); Executed by:
| 13338 | ||||||||||||
118 | } | - | ||||||||||||
119 | - | |||||||||||||
120 | Address contextAddress() const | - | ||||||||||||
121 | { | - | ||||||||||||
122 | return executed 50 times by 7 tests: Address(JSStackFrameRegister, return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
123 | __builtin_offsetof ( executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
124 | CallData executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
125 | , executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
126 | context executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
127 | ) executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
128 | ); executed 50 times by 7 tests: return Address(JSStackFrameRegister, __builtin_offsetof ( CallData , context ) ); Executed by:
| 50 | ||||||||||||
129 | } | - | ||||||||||||
130 | - | |||||||||||||
131 | RegisterID registerForArg(int arg) const | - | ||||||||||||
132 | { | - | ||||||||||||
133 | ((arg >= 0) ? static_cast<void>(0) : qt_assert("arg >= 0", __FILE__, 530)); | - | ||||||||||||
134 | ((arg < ArgInRegCount) ? static_cast<void>(0) : qt_assert("arg < ArgInRegCount", __FILE__, 531)); | - | ||||||||||||
135 | switch (arg) { | - | ||||||||||||
136 | case executed 83222 times by 64 tests: 0:case 0: Executed by:
executed 83222 times by 64 tests: returncase 0: Executed by:
executed 83222 times by 64 tests: Arg0Reg;return Arg0Reg; Executed by:
executed 83222 times by 64 tests: return Arg0Reg; Executed by:
| 83222 | ||||||||||||
137 | case executed 52300 times by 64 tests: 1:case 1: Executed by:
executed 52300 times by 64 tests: returncase 1: Executed by:
executed 52300 times by 64 tests: Arg1Reg;return Arg1Reg; Executed by:
executed 52300 times by 64 tests: return Arg1Reg; Executed by:
| 52300 | ||||||||||||
138 | case executed 33090 times by 61 tests: 2:case 2: Executed by:
executed 33090 times by 61 tests: returncase 2: Executed by:
executed 33090 times by 61 tests: Arg2Reg;return Arg2Reg; Executed by:
executed 33090 times by 61 tests: return Arg2Reg; Executed by:
| 33090 | ||||||||||||
139 | case executed 10966 times by 54 tests: 3:case 3: Executed by:
executed 10966 times by 54 tests: returncase 3: Executed by:
executed 10966 times by 54 tests: Arg3Reg;return Arg3Reg; Executed by:
executed 10966 times by 54 tests: return Arg3Reg; Executed by:
| 10966 | ||||||||||||
140 | case executed 4376 times by 34 tests: 4:case 4: Executed by:
executed 4376 times by 34 tests: returncase 4: Executed by:
executed 4376 times by 34 tests: Arg4Reg;return Arg4Reg; Executed by:
executed 4376 times by 34 tests: return Arg4Reg; Executed by:
| 4376 | ||||||||||||
141 | case never executed: 5:case 5: never executed: returncase 5: never executed: Arg5Reg;return Arg5Reg; never executed: return Arg5Reg; | 0 | ||||||||||||
142 | case never executed: 6:case 6: never executed: returncase 6: never executed: Arg6Reg;return Arg6Reg; never executed: return Arg6Reg; | 0 | ||||||||||||
143 | case never executed: 7:case 7: never executed: returncase 7: never executed: Arg7Reg;return Arg7Reg; never executed: return Arg7Reg; | 0 | ||||||||||||
144 | default never executed: :default: never executed: default: | 0 | ||||||||||||
145 | QMessageLogger(__FILE__, 542, __PRETTY_FUNCTION__).warning("Unimplemented code."); | - | ||||||||||||
146 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 543)); __builtin_unreachable(); } while (false); | - | ||||||||||||
147 | } never executed: end of block | 0 | ||||||||||||
148 | } | - | ||||||||||||
149 | - | |||||||||||||
150 | void callRuntime(const char *functionName, const void *funcPtr) | - | ||||||||||||
151 | { | - | ||||||||||||
152 | functions.insert(funcPtr, functionName); | - | ||||||||||||
153 | callAbsolute(funcPtr); | - | ||||||||||||
154 | } executed 83222 times by 64 tests: end of block Executed by:
| 83222 | ||||||||||||
155 | - | |||||||||||||
156 | Address loadFunctionPtr(RegisterID target) | - | ||||||||||||
157 | { | - | ||||||||||||
158 | Address addr(CppStackFrameRegister, | - | ||||||||||||
159 | __builtin_offsetof ( | - | ||||||||||||
160 | CppStackFrame | - | ||||||||||||
161 | , | - | ||||||||||||
162 | v4Function | - | ||||||||||||
163 | ) | - | ||||||||||||
164 | ); | - | ||||||||||||
165 | loadPtr(addr, target); | - | ||||||||||||
166 | return executed 4388 times by 40 tests: Address(target);return Address(target); Executed by:
executed 4388 times by 40 tests: return Address(target); Executed by:
| 4388 | ||||||||||||
167 | } | - | ||||||||||||
168 | - | |||||||||||||
169 | Address loadCompilationUnitPtr(RegisterID target) | - | ||||||||||||
170 | { | - | ||||||||||||
171 | Address addr = loadFunctionPtr(target); | - | ||||||||||||
172 | addr.offset = | - | ||||||||||||
173 | __builtin_offsetof ( | - | ||||||||||||
174 | QV4::Function | - | ||||||||||||
175 | , | - | ||||||||||||
176 | compilationUnit | - | ||||||||||||
177 | ) | - | ||||||||||||
178 | ; | - | ||||||||||||
179 | loadPtr(addr, target); | - | ||||||||||||
180 | return executed 4348 times by 39 tests: Address(target);return Address(target); Executed by:
executed 4348 times by 39 tests: return Address(target); Executed by:
| 4348 | ||||||||||||
181 | } | - | ||||||||||||
182 | - | |||||||||||||
183 | Address loadConstAddress(int constIndex, RegisterID baseReg = ScratchRegister) | - | ||||||||||||
184 | { | - | ||||||||||||
185 | Address addr = loadCompilationUnitPtr(baseReg); | - | ||||||||||||
186 | addr.offset = | - | ||||||||||||
187 | __builtin_offsetof ( | - | ||||||||||||
188 | QV4::CompiledData::CompilationUnitBase | - | ||||||||||||
189 | , | - | ||||||||||||
190 | constants | - | ||||||||||||
191 | ) | - | ||||||||||||
192 | ; | - | ||||||||||||
193 | loadPtr(addr, baseReg); | - | ||||||||||||
194 | addr.offset = constIndex * int(sizeof(QV4::Value)); | - | ||||||||||||
195 | return executed 1062 times by 20 tests: addr;return addr; Executed by:
executed 1062 times by 20 tests: return addr; Executed by:
| 1062 | ||||||||||||
196 | } | - | ||||||||||||
197 | - | |||||||||||||
198 | Address loadStringAddress(int stringId) | - | ||||||||||||
199 | { | - | ||||||||||||
200 | Address addr = loadCompilationUnitPtr(ScratchRegister); | - | ||||||||||||
201 | addr.offset = | - | ||||||||||||
202 | __builtin_offsetof ( | - | ||||||||||||
203 | QV4::CompiledData::CompilationUnitBase | - | ||||||||||||
204 | , | - | ||||||||||||
205 | runtimeStrings | - | ||||||||||||
206 | ) | - | ||||||||||||
207 | ; | - | ||||||||||||
208 | loadPtr(addr, ScratchRegister); | - | ||||||||||||
209 | return executed 3286 times by 31 tests: Address(ScratchRegister, stringId * PointerSize);return Address(ScratchRegister, stringId * PointerSize); Executed by:
executed 3286 times by 31 tests: return Address(ScratchRegister, stringId * PointerSize); Executed by:
| 3286 | ||||||||||||
210 | } | - | ||||||||||||
211 | - | |||||||||||||
212 | void passAsArg(RegisterID src, int arg) | - | ||||||||||||
213 | { | - | ||||||||||||
214 | move(src, registerForArg(arg)); | - | ||||||||||||
215 | } executed 614 times by 15 tests: end of block Executed by:
| 614 | ||||||||||||
216 | - | |||||||||||||
217 | void generateCatchTrampoline(std::function<void()> loadUndefined) | - | ||||||||||||
218 | { | - | ||||||||||||
219 | for (Jump j : catchyJumps) | - | ||||||||||||
220 | j.link(this); executed 52704 times by 63 tests: j.link(this); Executed by:
| 52704 | ||||||||||||
221 | - | |||||||||||||
222 | loadPtr(exceptionHandlerAddress(), ScratchRegister); | - | ||||||||||||
223 | Jump exitFunction = branchPtr(Equal, ScratchRegister, TrustedImmPtr(0)); | - | ||||||||||||
224 | jump(ScratchRegister); | - | ||||||||||||
225 | exitFunction.link(this); | - | ||||||||||||
226 | loadUndefined(); | - | ||||||||||||
227 | - | |||||||||||||
228 | if (functionExit.isSet()
| 0-13188 | ||||||||||||
229 | jump(functionExit); executed 13188 times by 64 tests: jump(functionExit); Executed by:
| 13188 | ||||||||||||
230 | else | - | ||||||||||||
231 | generateFunctionExit(); never executed: generateFunctionExit(); | 0 | ||||||||||||
232 | } | - | ||||||||||||
233 | - | |||||||||||||
234 | void addCatchyJump(Jump j) | - | ||||||||||||
235 | { | - | ||||||||||||
236 | ((j.isSet()) ? static_cast<void>(0) : qt_assert("j.isSet()", __FILE__, 609)); | - | ||||||||||||
237 | catchyJumps.push_back(j); | - | ||||||||||||
238 | } executed 52704 times by 63 tests: end of block Executed by:
| 52704 | ||||||||||||
239 | - | |||||||||||||
240 | void generateFunctionEntry() | - | ||||||||||||
241 | { | - | ||||||||||||
242 | generatePlatformFunctionEntry(); | - | ||||||||||||
243 | loadPtr(Address(CppStackFrameRegister, | - | ||||||||||||
244 | __builtin_offsetof ( | - | ||||||||||||
245 | CppStackFrame | - | ||||||||||||
246 | , | - | ||||||||||||
247 | jsFrame | - | ||||||||||||
248 | ) | - | ||||||||||||
249 | ), JSStackFrameRegister); | - | ||||||||||||
250 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
251 | - | |||||||||||||
252 | void generateFunctionExit() | - | ||||||||||||
253 | { | - | ||||||||||||
254 | if (functionExit.isSet()
| 216-13188 | ||||||||||||
255 | jump(functionExit); | - | ||||||||||||
256 | return; executed 216 times by 8 tests: return; Executed by:
| 216 | ||||||||||||
257 | } | - | ||||||||||||
258 | - | |||||||||||||
259 | functionExit = label(); | - | ||||||||||||
260 | generatePlatformFunctionExit(); | - | ||||||||||||
261 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
262 | }; | - | ||||||||||||
263 | - | |||||||||||||
264 | - | |||||||||||||
265 | struct PlatformAssembler64 : PlatformAssemblerCommon | - | ||||||||||||
266 | { | - | ||||||||||||
267 | void callRuntime(const char *functionName, const void *funcPtr, | - | ||||||||||||
268 | Assembler::CallResultDestination dest) | - | ||||||||||||
269 | { | - | ||||||||||||
270 | PlatformAssemblerCommon::callRuntime(functionName, funcPtr); | - | ||||||||||||
271 | if (dest == Assembler::ResultInAccumulator
| 1936-76834 | ||||||||||||
272 | saveReturnValueInAccumulator(); executed 76834 times by 64 tests: saveReturnValueInAccumulator(); Executed by:
| 76834 | ||||||||||||
273 | } executed 78770 times by 64 tests: end of block Executed by:
| 78770 | ||||||||||||
274 | - | |||||||||||||
275 | void saveReturnValueInAccumulator() | - | ||||||||||||
276 | { | - | ||||||||||||
277 | move(ReturnValueRegister, AccumulatorRegister); | - | ||||||||||||
278 | } executed 77464 times by 64 tests: end of block Executed by:
| 77464 | ||||||||||||
279 | - | |||||||||||||
280 | void loadUndefined(RegisterID dest = AccumulatorRegister) | - | ||||||||||||
281 | { | - | ||||||||||||
282 | move(TrustedImm64(0), dest); | - | ||||||||||||
283 | } executed 13216 times by 64 tests: end of block Executed by:
| 13216 | ||||||||||||
284 | - | |||||||||||||
285 | void copyConst(int constIndex, Address dest) | - | ||||||||||||
286 | { | - | ||||||||||||
287 | - | |||||||||||||
288 | if (constantTable[constIndex].isUndefined()
| 28-936 | ||||||||||||
289 | loadUndefined(ScratchRegister); | - | ||||||||||||
290 | } executed 28 times by 1 test: else {end of block Executed by:
| 28 | ||||||||||||
291 | load64(loadConstAddress(constIndex, ScratchRegister), ScratchRegister); | - | ||||||||||||
292 | } executed 936 times by 18 tests: end of block Executed by:
| 936 | ||||||||||||
293 | store64(ScratchRegister, dest); | - | ||||||||||||
294 | } executed 964 times by 18 tests: end of block Executed by:
| 964 | ||||||||||||
295 | - | |||||||||||||
296 | void copyReg(Address src, Address dst) | - | ||||||||||||
297 | { | - | ||||||||||||
298 | load64(src, ScratchRegister); | - | ||||||||||||
299 | store64(ScratchRegister, dst); | - | ||||||||||||
300 | } never executed: end of block | 0 | ||||||||||||
301 | - | |||||||||||||
302 | void loadPointerFromValue(Address addr, RegisterID dest = AccumulatorRegister) | - | ||||||||||||
303 | { | - | ||||||||||||
304 | load64(addr, dest); | - | ||||||||||||
305 | } executed 610 times by 11 tests: end of block Executed by:
| 610 | ||||||||||||
306 | - | |||||||||||||
307 | void loadAccumulator(Address addr) | - | ||||||||||||
308 | { | - | ||||||||||||
309 | load64(addr, AccumulatorRegister); | - | ||||||||||||
310 | } executed 6676 times by 43 tests: end of block Executed by:
| 6676 | ||||||||||||
311 | - | |||||||||||||
312 | void storeAccumulator(Address addr) | - | ||||||||||||
313 | { | - | ||||||||||||
314 | store64(AccumulatorRegister, addr); | - | ||||||||||||
315 | } executed 79570 times by 64 tests: end of block Executed by:
| 79570 | ||||||||||||
316 | - | |||||||||||||
317 | void moveReg(Address sourceRegAddress, Address destRegAddress) | - | ||||||||||||
318 | { | - | ||||||||||||
319 | load64(sourceRegAddress, ScratchRegister); | - | ||||||||||||
320 | store64(ScratchRegister, destRegAddress); | - | ||||||||||||
321 | } executed 3186 times by 19 tests: end of block Executed by:
| 3186 | ||||||||||||
322 | - | |||||||||||||
323 | void loadString(int stringId) | - | ||||||||||||
324 | { | - | ||||||||||||
325 | loadAccumulator(loadStringAddress(stringId)); | - | ||||||||||||
326 | } executed 3286 times by 31 tests: end of block Executed by:
| 3286 | ||||||||||||
327 | - | |||||||||||||
328 | void loadValue(ReturnedValue value) | - | ||||||||||||
329 | { | - | ||||||||||||
330 | move(TrustedImm64(value), AccumulatorRegister); | - | ||||||||||||
331 | } executed 4828 times by 45 tests: end of block Executed by:
| 4828 | ||||||||||||
332 | - | |||||||||||||
333 | void storeHeapObject(RegisterID source, Address addr) | - | ||||||||||||
334 | { | - | ||||||||||||
335 | store64(source, addr); | - | ||||||||||||
336 | } executed 154 times by 9 tests: end of block Executed by:
| 154 | ||||||||||||
337 | - | |||||||||||||
338 | void generateCatchTrampoline() | - | ||||||||||||
339 | { | - | ||||||||||||
340 | PlatformAssemblerCommon::generateCatchTrampoline([this](){loadUndefined();} executed 13188 times by 64 tests: );end of block Executed by:
| 13188 | ||||||||||||
341 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
342 | - | |||||||||||||
343 | void jumpNotUndefined(int offset) | - | ||||||||||||
344 | { | - | ||||||||||||
345 | auto jump = branch64(NotEqual, AccumulatorRegister, TrustedImm64(0)); | - | ||||||||||||
346 | patches.push_back({ jump, offset }); | - | ||||||||||||
347 | } never executed: end of block | 0 | ||||||||||||
348 | - | |||||||||||||
349 | Jump jumpEmpty() | - | ||||||||||||
350 | { | - | ||||||||||||
351 | return never executed: branch64(Equal, AccumulatorRegister, TrustedImm64(Primitive::emptyValue().asReturnedValue()));return branch64(Equal, AccumulatorRegister, TrustedImm64(Primitive::emptyValue().asReturnedValue())); never executed: return branch64(Equal, AccumulatorRegister, TrustedImm64(Primitive::emptyValue().asReturnedValue())); | 0 | ||||||||||||
352 | } | - | ||||||||||||
353 | - | |||||||||||||
354 | void toBoolean(std::function<void(RegisterID)> continuation) | - | ||||||||||||
355 | { | - | ||||||||||||
356 | urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerConvertible_Shift), ScratchRegister); | - | ||||||||||||
357 | auto needsConversion = branch32(NotEqual, TrustedImm32(1), ScratchRegister); | - | ||||||||||||
358 | continuation(AccumulatorRegister); | - | ||||||||||||
359 | Jump done = jump(); | - | ||||||||||||
360 | - | |||||||||||||
361 | - | |||||||||||||
362 | needsConversion.link(this); | - | ||||||||||||
363 | push(AccumulatorRegister); | - | ||||||||||||
364 | move(AccumulatorRegister, registerForArg(0)); | - | ||||||||||||
365 | PlatformAssemblerCommon::callRuntime("Value::toBooleanImpl", reinterpret_cast<void *>(&Value::toBooleanImpl)); | - | ||||||||||||
366 | and32(TrustedImm32(1), ReturnValueRegister, ScratchRegister); | - | ||||||||||||
367 | pop(AccumulatorRegister); | - | ||||||||||||
368 | continuation(ScratchRegister); | - | ||||||||||||
369 | - | |||||||||||||
370 | done.link(this); | - | ||||||||||||
371 | } executed 3808 times by 38 tests: end of block Executed by:
| 3808 | ||||||||||||
372 | - | |||||||||||||
373 | void toNumber() | - | ||||||||||||
374 | { | - | ||||||||||||
375 | urshift64(AccumulatorRegister, TrustedImm32(Value::QuickType_Shift), ScratchRegister); | - | ||||||||||||
376 | auto isNumber = branch32(GreaterThanOrEqual, ScratchRegister, TrustedImm32(Value::QT_Int)); | - | ||||||||||||
377 | - | |||||||||||||
378 | move(AccumulatorRegister, registerForArg(0)); | - | ||||||||||||
379 | PlatformAssemblerCommon::callRuntime("toNumberHelper", reinterpret_cast<void *>(&toNumberHelper)); | - | ||||||||||||
380 | saveReturnValueInAccumulator(); | - | ||||||||||||
381 | - | |||||||||||||
382 | isNumber.link(this); | - | ||||||||||||
383 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
384 | - | |||||||||||||
385 | void toInt32LhsAcc(Address lhs, RegisterID lhsTarget) | - | ||||||||||||
386 | { | - | ||||||||||||
387 | load64(lhs, lhsTarget); | - | ||||||||||||
388 | urshift64(lhsTarget, TrustedImm32(Value::QuickType_Shift), ScratchRegister2); | - | ||||||||||||
389 | auto lhsIsInt = branch32(Equal, TrustedImm32(Value::QT_Int), ScratchRegister2); | - | ||||||||||||
390 | - | |||||||||||||
391 | pushAligned(AccumulatorRegister); | - | ||||||||||||
392 | move(lhsTarget, registerForArg(0)); | - | ||||||||||||
393 | PlatformAssemblerCommon::callRuntime("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper)); | - | ||||||||||||
394 | move(ReturnValueRegister, lhsTarget); | - | ||||||||||||
395 | popAligned(AccumulatorRegister); | - | ||||||||||||
396 | - | |||||||||||||
397 | lhsIsInt.link(this); | - | ||||||||||||
398 | urshift64(AccumulatorRegister, TrustedImm32(Value::QuickType_Shift), ScratchRegister2); | - | ||||||||||||
399 | auto isInt = branch32(Equal, TrustedImm32(Value::QT_Int), ScratchRegister2); | - | ||||||||||||
400 | - | |||||||||||||
401 | pushAligned(lhsTarget); | - | ||||||||||||
402 | move(AccumulatorRegister, registerForArg(0)); | - | ||||||||||||
403 | PlatformAssemblerCommon::callRuntime("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper)); | - | ||||||||||||
404 | saveReturnValueInAccumulator(); | - | ||||||||||||
405 | popAligned(lhsTarget); | - | ||||||||||||
406 | - | |||||||||||||
407 | isInt.link(this); | - | ||||||||||||
408 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||
409 | - | |||||||||||||
410 | void toInt32() | - | ||||||||||||
411 | { | - | ||||||||||||
412 | urshift64(AccumulatorRegister, TrustedImm32(Value::QuickType_Shift), ScratchRegister2); | - | ||||||||||||
413 | auto isInt = branch32(Equal, TrustedImm32(Value::QT_Int), ScratchRegister2); | - | ||||||||||||
414 | - | |||||||||||||
415 | move(AccumulatorRegister, registerForArg(0)); | - | ||||||||||||
416 | callRuntime("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper), | - | ||||||||||||
417 | Assembler::ResultInAccumulator); | - | ||||||||||||
418 | - | |||||||||||||
419 | isInt.link(this); | - | ||||||||||||
420 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||
421 | - | |||||||||||||
422 | void regToInt32(Address srcReg, RegisterID targetReg) | - | ||||||||||||
423 | { | - | ||||||||||||
424 | load64(srcReg, targetReg); | - | ||||||||||||
425 | urshift64(targetReg, TrustedImm32(Value::QuickType_Shift), ScratchRegister2); | - | ||||||||||||
426 | auto isInt = branch32(Equal, TrustedImm32(Value::QT_Int), ScratchRegister2); | - | ||||||||||||
427 | - | |||||||||||||
428 | pushAligned(AccumulatorRegister); | - | ||||||||||||
429 | move(targetReg, registerForArg(0)); | - | ||||||||||||
430 | PlatformAssemblerCommon::callRuntime("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper)); | - | ||||||||||||
431 | move(ReturnValueRegister, targetReg); | - | ||||||||||||
432 | popAligned(AccumulatorRegister); | - | ||||||||||||
433 | - | |||||||||||||
434 | isInt.link(this); | - | ||||||||||||
435 | } never executed: end of block | 0 | ||||||||||||
436 | - | |||||||||||||
437 | void isNullOrUndefined() | - | ||||||||||||
438 | { | - | ||||||||||||
439 | move(AccumulatorRegister, ScratchRegister); | - | ||||||||||||
440 | compare64(Equal, ScratchRegister, TrustedImm32(0), AccumulatorRegister); | - | ||||||||||||
441 | Jump isUndef = branch32(NotEqual, TrustedImm32(0), AccumulatorRegister); | - | ||||||||||||
442 | - | |||||||||||||
443 | - | |||||||||||||
444 | rshift64(TrustedImm32(32), ScratchRegister); | - | ||||||||||||
445 | compare32(Equal, ScratchRegister, TrustedImm32(int(QV4::Value::ValueTypeInternal::Null)), | - | ||||||||||||
446 | AccumulatorRegister); | - | ||||||||||||
447 | - | |||||||||||||
448 | isUndef.link(this); | - | ||||||||||||
449 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
450 | - | |||||||||||||
451 | Jump isIntOrBool() | - | ||||||||||||
452 | { | - | ||||||||||||
453 | urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerOrBool_Shift), ScratchRegister); | - | ||||||||||||
454 | return executed 70 times by 10 tests: branch32(Equal, TrustedImm32(3), ScratchRegister);return branch32(Equal, TrustedImm32(3), ScratchRegister); Executed by:
executed 70 times by 10 tests: return branch32(Equal, TrustedImm32(3), ScratchRegister); Executed by:
| 70 | ||||||||||||
455 | } | - | ||||||||||||
456 | - | |||||||||||||
457 | void setAccumulatorTag(QV4::Value::ValueTypeInternal tag, RegisterID sourceReg = NoRegister) | - | ||||||||||||
458 | { | - | ||||||||||||
459 | if (sourceReg == NoRegister
| 4326-4924 | ||||||||||||
460 | or64(TrustedImm64(int64_t(tag) << 32), AccumulatorRegister); executed 4924 times by 34 tests: or64(TrustedImm64(int64_t(tag) << 32), AccumulatorRegister); Executed by:
| 4924 | ||||||||||||
461 | else | - | ||||||||||||
462 | or64(TrustedImm64(int64_t(tag) << 32), sourceReg, AccumulatorRegister); executed 4326 times by 39 tests: or64(TrustedImm64(int64_t(tag) << 32), sourceReg, AccumulatorRegister); Executed by:
| 4326 | ||||||||||||
463 | } | - | ||||||||||||
464 | - | |||||||||||||
465 | void encodeDoubleIntoAccumulator(FPRegisterID src) | - | ||||||||||||
466 | { | - | ||||||||||||
467 | moveDoubleTo64(src, AccumulatorRegister); | - | ||||||||||||
468 | move(TrustedImm64(Value::NaNEncodeMask), ScratchRegister); | - | ||||||||||||
469 | xor64(ScratchRegister, AccumulatorRegister); | - | ||||||||||||
470 | } never executed: end of block | 0 | ||||||||||||
471 | - | |||||||||||||
472 | void pushValueAligned(ReturnedValue v) | - | ||||||||||||
473 | { | - | ||||||||||||
474 | loadValue(v); | - | ||||||||||||
475 | pushAligned(AccumulatorRegister); | - | ||||||||||||
476 | } executed 70 times by 10 tests: end of block Executed by:
| 70 | ||||||||||||
477 | - | |||||||||||||
478 | void popValueAligned() | - | ||||||||||||
479 | { | - | ||||||||||||
480 | addPtr(TrustedImm32(2 * PointerSize), StackPointerRegister); | - | ||||||||||||
481 | } executed 70 times by 10 tests: end of block Executed by:
| 70 | ||||||||||||
482 | - | |||||||||||||
483 | Jump binopBothIntPath(Address lhsAddr, std::function<Jump(void)> fastPath) | - | ||||||||||||
484 | { | - | ||||||||||||
485 | urshift64(AccumulatorRegister, TrustedImm32(32), ScratchRegister); | - | ||||||||||||
486 | Jump accNotInt = branch32(NotEqual, TrustedImm32(int(IntegerTag)), ScratchRegister); | - | ||||||||||||
487 | load64(lhsAddr, ScratchRegister); | - | ||||||||||||
488 | urshift64(ScratchRegister, TrustedImm32(32), ScratchRegister2); | - | ||||||||||||
489 | Jump lhsNotInt = branch32(NotEqual, TrustedImm32(int(IntegerTag)), ScratchRegister2); | - | ||||||||||||
490 | - | |||||||||||||
491 | - | |||||||||||||
492 | Jump failure = fastPath(); | - | ||||||||||||
493 | Jump done = jump(); | - | ||||||||||||
494 | - | |||||||||||||
495 | - | |||||||||||||
496 | if (failure.isSet()
| 2256-3712 | ||||||||||||
497 | failure.link(this); executed 3712 times by 35 tests: failure.link(this); Executed by:
| 3712 | ||||||||||||
498 | accNotInt.link(this); | - | ||||||||||||
499 | lhsNotInt.link(this); | - | ||||||||||||
500 | - | |||||||||||||
501 | return executed 5968 times by 47 tests: done;return done; Executed by:
executed 5968 times by 47 tests: return done; Executed by:
| 5968 | ||||||||||||
502 | } | - | ||||||||||||
503 | - | |||||||||||||
504 | Jump unopIntPath(std::function<Jump(void)> fastPath) | - | ||||||||||||
505 | { | - | ||||||||||||
506 | urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerConvertible_Shift), ScratchRegister); | - | ||||||||||||
507 | Jump accNotIntConvertible = branch32(NotEqual, TrustedImm32(1), ScratchRegister); | - | ||||||||||||
508 | - | |||||||||||||
509 | - | |||||||||||||
510 | Jump failure = fastPath(); | - | ||||||||||||
511 | Jump done = jump(); | - | ||||||||||||
512 | - | |||||||||||||
513 | - | |||||||||||||
514 | if (failure.isSet()
| 0-614 | ||||||||||||
515 | failure.link(this); executed 614 times by 15 tests: failure.link(this); Executed by:
| 614 | ||||||||||||
516 | accNotIntConvertible.link(this); | - | ||||||||||||
517 | - | |||||||||||||
518 | return executed 614 times by 15 tests: done;return done; Executed by:
executed 614 times by 15 tests: return done; Executed by:
| 614 | ||||||||||||
519 | } | - | ||||||||||||
520 | - | |||||||||||||
521 | void callWithAccumulatorByValueAsFirstArgument(std::function<void()> doCall) | - | ||||||||||||
522 | { | - | ||||||||||||
523 | passAsArg(AccumulatorRegister, 0); | - | ||||||||||||
524 | doCall(); | - | ||||||||||||
525 | } executed 614 times by 15 tests: end of block Executed by:
| 614 | ||||||||||||
526 | }; | - | ||||||||||||
527 | - | |||||||||||||
528 | typedef PlatformAssembler64 PlatformAssembler; | - | ||||||||||||
529 | typedef PlatformAssembler::TrustedImmPtr TrustedImmPtr; | - | ||||||||||||
530 | typedef PlatformAssembler::TrustedImm32 TrustedImm32; | - | ||||||||||||
531 | typedef PlatformAssembler::TrustedImm64 TrustedImm64; | - | ||||||||||||
532 | typedef PlatformAssembler::Address Address; | - | ||||||||||||
533 | typedef PlatformAssembler::RegisterID RegisterID; | - | ||||||||||||
534 | typedef PlatformAssembler::FPRegisterID FPRegisterID; | - | ||||||||||||
535 | - | |||||||||||||
536 | - | |||||||||||||
537 | - | |||||||||||||
538 | static Address regAddr(int reg) | - | ||||||||||||
539 | { | - | ||||||||||||
540 | return executed 71850 times by 64 tests: Address(PlatformAssembler::JSStackFrameRegister, reg * int(sizeof(QV4::Value)));return Address(PlatformAssembler::JSStackFrameRegister, reg * int(sizeof(QV4::Value))); Executed by:
executed 71850 times by 64 tests: return Address(PlatformAssembler::JSStackFrameRegister, reg * int(sizeof(QV4::Value))); Executed by:
| 71850 | ||||||||||||
541 | } | - | ||||||||||||
542 | - | |||||||||||||
543 | Assembler::Assembler(const Value *constantTable) | - | ||||||||||||
544 | : d(new PlatformAssembler) | - | ||||||||||||
545 | { | - | ||||||||||||
546 | reinterpret_cast<PlatformAssembler *>(this->d)->constantTable = constantTable; | - | ||||||||||||
547 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
548 | - | |||||||||||||
549 | Assembler::~Assembler() | - | ||||||||||||
550 | { | - | ||||||||||||
551 | delete reinterpret_cast<PlatformAssembler *>(this->d); | - | ||||||||||||
552 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
553 | - | |||||||||||||
554 | void Assembler::generatePrologue() | - | ||||||||||||
555 | { | - | ||||||||||||
556 | reinterpret_cast<PlatformAssembler *>(this->d)->generateFunctionEntry(); | - | ||||||||||||
557 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
558 | - | |||||||||||||
559 | void Assembler::generateEpilogue() | - | ||||||||||||
560 | { | - | ||||||||||||
561 | reinterpret_cast<PlatformAssembler *>(this->d)->generateCatchTrampoline(); | - | ||||||||||||
562 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
563 | - | |||||||||||||
564 | namespace { | - | ||||||||||||
565 | class QIODevicePrintStream: public FilePrintStream | - | ||||||||||||
566 | { | - | ||||||||||||
567 | QIODevicePrintStream(const QIODevicePrintStream &) = delete; QIODevicePrintStream &operator=(const QIODevicePrintStream &) = delete; | - | ||||||||||||
568 | - | |||||||||||||
569 | public: | - | ||||||||||||
570 | explicit QIODevicePrintStream(QIODevice *dest) | - | ||||||||||||
571 | : FilePrintStream(nullptr) | - | ||||||||||||
572 | , dest(dest) | - | ||||||||||||
573 | , buf(4096, '0') | - | ||||||||||||
574 | { | - | ||||||||||||
575 | ((dest) ? static_cast<void>(0) : qt_assert("dest", __FILE__, 1323)); | - | ||||||||||||
576 | } never executed: end of block | 0 | ||||||||||||
577 | - | |||||||||||||
578 | ~QIODevicePrintStream() | - | ||||||||||||
579 | {} | - | ||||||||||||
580 | - | |||||||||||||
581 | void vprintf(const char* format, va_list argList) __attribute__((__format__(printf, 2, 0))) | - | ||||||||||||
582 | { | - | ||||||||||||
583 | const int written = qvsnprintf(buf.data(), buf.size(), format, argList); | - | ||||||||||||
584 | if (written > 0
| 0 | ||||||||||||
585 | dest->write(buf.constData(), written); never executed: dest->write(buf.constData(), written); | 0 | ||||||||||||
586 | memset(buf.data(), 0, qMin(written, buf.size())); | - | ||||||||||||
587 | } never executed: end of block | 0 | ||||||||||||
588 | - | |||||||||||||
589 | void flush() | - | ||||||||||||
590 | {} | - | ||||||||||||
591 | - | |||||||||||||
592 | private: | - | ||||||||||||
593 | QIODevice *dest; | - | ||||||||||||
594 | QByteArray buf; | - | ||||||||||||
595 | }; | - | ||||||||||||
596 | } | - | ||||||||||||
597 | - | |||||||||||||
598 | static void printDisassembledOutputWithCalls(QByteArray processedOutput, | - | ||||||||||||
599 | const QHash<const void*, const char*>& functions) | - | ||||||||||||
600 | { | - | ||||||||||||
601 | for (QHash<const void*, const char*>::ConstIterator it = functions.begin(), end = functions.end(); | - | ||||||||||||
602 | it != end
| 0 | ||||||||||||
603 | const QByteArray ptrString = "0x" + QByteArray::number(quintptr(it.key()), 16); | - | ||||||||||||
604 | int idx = 0; | - | ||||||||||||
605 | while (idx >= 0
| 0 | ||||||||||||
606 | idx = processedOutput.indexOf(ptrString, idx); | - | ||||||||||||
607 | if (idx < 0
| 0 | ||||||||||||
608 | break; never executed: break; | 0 | ||||||||||||
609 | idx = processedOutput.indexOf('\n', idx); | - | ||||||||||||
610 | if (idx < 0
| 0 | ||||||||||||
611 | break; never executed: break; | 0 | ||||||||||||
612 | processedOutput = processedOutput.insert(idx, ([]() -> QByteArray { enum { Size = sizeof(" ; ") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, " ; " }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return never executed: ba;return ba; never executed: }()) + it.value());return ba; | 0 | ||||||||||||
613 | } never executed: end of block | 0 | ||||||||||||
614 | } never executed: end of block | 0 | ||||||||||||
615 | - | |||||||||||||
616 | QMessageLogger(__FILE__, 1364, __PRETTY_FUNCTION__).debug("%s", processedOutput.constData()); | - | ||||||||||||
617 | } never executed: end of block | 0 | ||||||||||||
618 | - | |||||||||||||
619 | static QByteArray functionName(Function *function) | - | ||||||||||||
620 | { | - | ||||||||||||
621 | QByteArray name = function->name()->toQString().toUtf8(); | - | ||||||||||||
622 | if (name.isEmpty()
| 0-4 | ||||||||||||
623 | name = QByteArray::number(reinterpret_cast<quintptr>(function), 16); | - | ||||||||||||
624 | name.prepend("QV4::Function(0x"); | - | ||||||||||||
625 | name.append(')'); | - | ||||||||||||
626 | } never executed: end of block | 0 | ||||||||||||
627 | return executed 4 times by 1 test: name;return name; Executed by:
executed 4 times by 1 test: return name; Executed by:
| 4 | ||||||||||||
628 | } | - | ||||||||||||
629 | - | |||||||||||||
630 | void Assembler::link(Function *function) | - | ||||||||||||
631 | { | - | ||||||||||||
632 | for (const auto &jumpTarget : reinterpret_cast<PlatformAssembler *>(this->d)->patches) | - | ||||||||||||
633 | jumpTarget.jump.linkTo(reinterpret_cast<PlatformAssembler *>(this->d)->labelsByOffset[jumpTarget.offset], reinterpret_cast<PlatformAssembler *>(this->d)); executed 9470 times by 38 tests: jumpTarget.jump.linkTo(reinterpret_cast<PlatformAssembler *>(this->d)->labelsByOffset[jumpTarget.offset], reinterpret_cast<PlatformAssembler *>(this->d)); Executed by:
| 9470 | ||||||||||||
634 | - | |||||||||||||
635 | JSC::JSGlobalData dummy(function->internalClass->engine->executableAllocator); | - | ||||||||||||
636 | JSC::LinkBuffer<PlatformAssembler::MacroAssembler> linkBuffer(dummy, reinterpret_cast<PlatformAssembler *>(this->d), nullptr); | - | ||||||||||||
637 | - | |||||||||||||
638 | for (const auto &ehTarget : reinterpret_cast<PlatformAssembler *>(this->d)->ehTargets) { | - | ||||||||||||
639 | auto targetLabel = reinterpret_cast<PlatformAssembler *>(this->d)->labelsByOffset.value(ehTarget.offset); | - | ||||||||||||
640 | linkBuffer.patch(ehTarget.label, linkBuffer.locationOf(targetLabel)); | - | ||||||||||||
641 | } executed 100 times by 7 tests: end of block Executed by:
| 100 | ||||||||||||
642 | - | |||||||||||||
643 | JSC::MacroAssemblerCodeRef codeRef; | - | ||||||||||||
644 | - | |||||||||||||
645 | static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_ASM"); | - | ||||||||||||
646 | if (showCode
| 0-13188 | ||||||||||||
647 | QBuffer buf; | - | ||||||||||||
648 | buf.open(QIODevice::WriteOnly); | - | ||||||||||||
649 | WTF::setDataFile(new QIODevicePrintStream(&buf)); | - | ||||||||||||
650 | - | |||||||||||||
651 | QByteArray name = functionName(function); | - | ||||||||||||
652 | codeRef = linkBuffer.finalizeCodeWithDisassembly("%s", name.data()); | - | ||||||||||||
653 | - | |||||||||||||
654 | WTF::setDataFile( | - | ||||||||||||
655 | stderr | - | ||||||||||||
656 | ); | - | ||||||||||||
657 | printDisassembledOutputWithCalls(buf.data(), reinterpret_cast<PlatformAssembler *>(this->d)->functions); | - | ||||||||||||
658 | } never executed: else {end of block | 0 | ||||||||||||
659 | codeRef = linkBuffer.finalizeCodeWithoutDisassembly(); | - | ||||||||||||
660 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
661 | - | |||||||||||||
662 | function->codeRef = new JSC::MacroAssemblerCodeRef(codeRef); | - | ||||||||||||
663 | function->jittedCode = reinterpret_cast<Function::JittedCode>(function->codeRef->code().executableAddress()); | - | ||||||||||||
664 | - | |||||||||||||
665 | - | |||||||||||||
666 | - | |||||||||||||
667 | - | |||||||||||||
668 | - | |||||||||||||
669 | - | |||||||||||||
670 | - | |||||||||||||
671 | static bool doProfile = !qEnvironmentVariableIsEmpty("QV4_PROFILE_WRITE_PERF_MAP"); | - | ||||||||||||
672 | if (__builtin_expect(!!(doProfile), false)
| 4-13184 | ||||||||||||
673 | static QFile perfMapFile(QString::fromLatin1("/tmp/perf-%1.map") | - | ||||||||||||
674 | .arg(QCoreApplication::applicationPid())); | - | ||||||||||||
675 | static const bool isOpen = perfMapFile.open(QIODevice::WriteOnly); | - | ||||||||||||
676 | if (!isOpen
| 0-4 | ||||||||||||
677 | QMessageLogger(__FILE__, 1423, __PRETTY_FUNCTION__).warning("QV4::JIT::Assembler: Cannot write perf map file."); | - | ||||||||||||
678 | doProfile = false; | - | ||||||||||||
679 | } never executed: else {end of block | 0 | ||||||||||||
680 | perfMapFile.write(QByteArray::number(reinterpret_cast<quintptr>( | - | ||||||||||||
681 | codeRef.code().executableAddress()), 16)); | - | ||||||||||||
682 | perfMapFile.putChar(' '); | - | ||||||||||||
683 | perfMapFile.write(QByteArray::number(static_cast<qsizetype>(codeRef.size()), 16)); | - | ||||||||||||
684 | perfMapFile.putChar(' '); | - | ||||||||||||
685 | perfMapFile.write(functionName(function)); | - | ||||||||||||
686 | perfMapFile.putChar('\n'); | - | ||||||||||||
687 | perfMapFile.flush(); | - | ||||||||||||
688 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||
689 | } | - | ||||||||||||
690 | } executed 13188 times by 64 tests: end of block Executed by:
| 13188 | ||||||||||||
691 | - | |||||||||||||
692 | void Assembler::addLabel(int offset) | - | ||||||||||||
693 | { | - | ||||||||||||
694 | reinterpret_cast<PlatformAssembler *>(this->d)->labelsByOffset[offset] = reinterpret_cast<PlatformAssembler *>(this->d)->label(); | - | ||||||||||||
695 | } executed 5472 times by 38 tests: end of block Executed by:
| 5472 | ||||||||||||
696 | - | |||||||||||||
697 | void Assembler::loadConst(int constIndex) | - | ||||||||||||
698 | { | - | ||||||||||||
699 | - | |||||||||||||
700 | if (reinterpret_cast<
| 0-126 | ||||||||||||
701 | reinterpret_cast<PlatformAssembler *>(this->d)->loadUndefined(); | - | ||||||||||||
702 | } never executed: else {end of block | 0 | ||||||||||||
703 | reinterpret_cast<PlatformAssembler *>(this->d)->loadAccumulator(reinterpret_cast<PlatformAssembler *>(this->d)->loadConstAddress(constIndex)); | - | ||||||||||||
704 | } executed 126 times by 7 tests: end of block Executed by:
| 126 | ||||||||||||
705 | } | - | ||||||||||||
706 | - | |||||||||||||
707 | void Assembler::copyConst(int constIndex, int destReg) | - | ||||||||||||
708 | { | - | ||||||||||||
709 | reinterpret_cast<PlatformAssembler *>(this->d)->copyConst(constIndex, regAddr(destReg)); | - | ||||||||||||
710 | } executed 964 times by 18 tests: end of block Executed by:
| 964 | ||||||||||||
711 | - | |||||||||||||
712 | void Assembler::loadReg(int reg) | - | ||||||||||||
713 | { | - | ||||||||||||
714 | reinterpret_cast<PlatformAssembler *>(this->d)->loadAccumulator(regAddr(reg)); | - | ||||||||||||
715 | } executed 2654 times by 31 tests: end of block Executed by:
| 2654 | ||||||||||||
716 | - | |||||||||||||
717 | void JIT::Assembler::moveReg(int sourceReg, int destReg) | - | ||||||||||||
718 | { | - | ||||||||||||
719 | reinterpret_cast<PlatformAssembler *>(this->d)->moveReg(regAddr(sourceReg), regAddr(destReg)); | - | ||||||||||||
720 | } executed 3186 times by 19 tests: end of block Executed by:
| 3186 | ||||||||||||
721 | - | |||||||||||||
722 | void Assembler::storeReg(int reg) | - | ||||||||||||
723 | { | - | ||||||||||||
724 | reinterpret_cast<PlatformAssembler *>(this->d)->storeAccumulator(regAddr(reg)); | - | ||||||||||||
725 | } executed 54864 times by 63 tests: end of block Executed by:
| 54864 | ||||||||||||
726 | - | |||||||||||||
727 | void Assembler::loadLocal(int index, int level) | - | ||||||||||||
728 | { | - | ||||||||||||
729 | Heap::CallContext ctx; | - | ||||||||||||
730 | (void)ctx; | - | ||||||||||||
731 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPointerFromValue(regAddr(CallData::Context), PlatformAssembler::ScratchRegister); | - | ||||||||||||
732 | while (level
| 40-406 | ||||||||||||
733 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPtr(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset), PlatformAssembler::ScratchRegister); | - | ||||||||||||
734 | --level; | - | ||||||||||||
735 | } executed 40 times by 3 tests: end of block Executed by:
| 40 | ||||||||||||
736 | reinterpret_cast<PlatformAssembler *>(this->d)->loadAccumulator(Address(PlatformAssembler::ScratchRegister, ctx.locals.offset + | - | ||||||||||||
737 | __builtin_offsetof ( | - | ||||||||||||
738 | ValueArray<0> | - | ||||||||||||
739 | , | - | ||||||||||||
740 | values | - | ||||||||||||
741 | ) | - | ||||||||||||
742 | + sizeof(Value)*index)); | - | ||||||||||||
743 | } executed 406 times by 8 tests: end of block Executed by:
| 406 | ||||||||||||
744 | - | |||||||||||||
745 | void Assembler::storeLocal(int index, int level) | - | ||||||||||||
746 | { | - | ||||||||||||
747 | Heap::CallContext ctx; | - | ||||||||||||
748 | (void)ctx; | - | ||||||||||||
749 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPtr(regAddr(CallData::Context), PlatformAssembler::ScratchRegister); | - | ||||||||||||
750 | while (level
| 0-46 | ||||||||||||
751 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPtr(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset), PlatformAssembler::ScratchRegister); | - | ||||||||||||
752 | --level; | - | ||||||||||||
753 | } never executed: end of block | 0 | ||||||||||||
754 | reinterpret_cast<PlatformAssembler *>(this->d)->storeAccumulator(Address(PlatformAssembler::ScratchRegister, ctx.locals.offset + | - | ||||||||||||
755 | __builtin_offsetof ( | - | ||||||||||||
756 | ValueArray<0> | - | ||||||||||||
757 | , | - | ||||||||||||
758 | values | - | ||||||||||||
759 | ) | - | ||||||||||||
760 | + sizeof(Value)*index)); | - | ||||||||||||
761 | } executed 46 times by 4 tests: end of block Executed by:
| 46 | ||||||||||||
762 | - | |||||||||||||
763 | void Assembler::loadString(int stringId) | - | ||||||||||||
764 | { | - | ||||||||||||
765 | reinterpret_cast<PlatformAssembler *>(this->d)->loadString(stringId); | - | ||||||||||||
766 | } executed 3286 times by 31 tests: end of block Executed by:
| 3286 | ||||||||||||
767 | - | |||||||||||||
768 | void Assembler::loadValue(ReturnedValue value) | - | ||||||||||||
769 | { | - | ||||||||||||
770 | reinterpret_cast<PlatformAssembler *>(this->d)->loadValue(value); | - | ||||||||||||
771 | } executed 4758 times by 44 tests: end of block Executed by:
| 4758 | ||||||||||||
772 | - | |||||||||||||
773 | void JIT::Assembler::storeHeapObject(int reg) | - | ||||||||||||
774 | { | - | ||||||||||||
775 | reinterpret_cast<PlatformAssembler *>(this->d)->storeHeapObject(PlatformAssembler::ReturnValueRegisterValue, regAddr(reg)); | - | ||||||||||||
776 | } executed 154 times by 9 tests: end of block Executed by:
| 154 | ||||||||||||
777 | - | |||||||||||||
778 | void Assembler::toNumber() | - | ||||||||||||
779 | { | - | ||||||||||||
780 | reinterpret_cast<PlatformAssembler *>(this->d)->toNumber(); | - | ||||||||||||
781 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
782 | - | |||||||||||||
783 | void Assembler::uminus() | - | ||||||||||||
784 | { | - | ||||||||||||
785 | saveAccumulatorInFrame(); | - | ||||||||||||
786 | prepareCallWithArgCount(1); | - | ||||||||||||
787 | passAccumulatorAsArg(0); | - | ||||||||||||
788 | callRuntime("Runtime::method_uMinus", reinterpret_cast<void *>(&Runtime::method_uMinus), ResultInAccumulator); | - | ||||||||||||
789 | checkException(); | - | ||||||||||||
790 | } executed 26 times by 3 tests: end of block Executed by:
| 26 | ||||||||||||
791 | - | |||||||||||||
792 | void Assembler::ucompl() | - | ||||||||||||
793 | { | - | ||||||||||||
794 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
795 | reinterpret_cast<PlatformAssembler *>(this->d)->xor32(TrustedImm32(-1), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
796 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
797 | } never executed: end of block | 0 | ||||||||||||
798 | - | |||||||||||||
799 | static ReturnedValue incHelper(const Value v) | - | ||||||||||||
800 | { | - | ||||||||||||
801 | double d; | - | ||||||||||||
802 | if (__builtin_expect(!!(v.isDouble()), true)
| 0 | ||||||||||||
803 | d = v.doubleValue(); never executed: d = v.doubleValue(); | 0 | ||||||||||||
804 | else | - | ||||||||||||
805 | d = v.toNumberImpl(); never executed: d = v.toNumberImpl(); | 0 | ||||||||||||
806 | return never executed: Encode(d + 1.);return Encode(d + 1.); never executed: return Encode(d + 1.); | 0 | ||||||||||||
807 | } | - | ||||||||||||
808 | - | |||||||||||||
809 | void Assembler::inc() | - | ||||||||||||
810 | { | - | ||||||||||||
811 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->unopIntPath([this](){ | - | ||||||||||||
812 | auto overflowed = reinterpret_cast<PlatformAssembler *>(this->d)->branchAdd32(PlatformAssembler::Overflow, | - | ||||||||||||
813 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
814 | TrustedImm32(1), | - | ||||||||||||
815 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
816 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag, PlatformAssembler::ScratchRegister); | - | ||||||||||||
817 | return executed 326 times by 13 tests: overflowed;return overflowed; Executed by:
executed 326 times by 13 tests: return overflowed; Executed by:
| 326 | ||||||||||||
818 | }); | - | ||||||||||||
819 | - | |||||||||||||
820 | - | |||||||||||||
821 | reinterpret_cast<PlatformAssembler *>(this->d)->callWithAccumulatorByValueAsFirstArgument([this]() { | - | ||||||||||||
822 | reinterpret_cast<PlatformAssembler *>(this->d)->PlatformAssemblerCommon::callRuntime("incHelper", reinterpret_cast<void *>(&incHelper)); | - | ||||||||||||
823 | reinterpret_cast<PlatformAssembler *>(this->d)->saveReturnValueInAccumulator(); | - | ||||||||||||
824 | } executed 326 times by 13 tests: );end of block Executed by:
| 326 | ||||||||||||
825 | checkException(); | - | ||||||||||||
826 | - | |||||||||||||
827 | - | |||||||||||||
828 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
829 | } executed 326 times by 13 tests: end of block Executed by:
| 326 | ||||||||||||
830 | - | |||||||||||||
831 | static ReturnedValue decHelper(const Value v) | - | ||||||||||||
832 | { | - | ||||||||||||
833 | double d; | - | ||||||||||||
834 | if (__builtin_expect(!!(v.isDouble()), true)
| 44-464 | ||||||||||||
835 | d = v.doubleValue(); executed 44 times by 2 tests: d = v.doubleValue(); Executed by:
| 44 | ||||||||||||
836 | else | - | ||||||||||||
837 | d = v.toNumberImpl(); executed 464 times by 1 test: d = v.toNumberImpl(); Executed by:
| 464 | ||||||||||||
838 | return executed 508 times by 2 tests: Encode(d - 1.);return Encode(d - 1.); Executed by:
executed 508 times by 2 tests: return Encode(d - 1.); Executed by:
| 508 | ||||||||||||
839 | } | - | ||||||||||||
840 | - | |||||||||||||
841 | void Assembler::dec() | - | ||||||||||||
842 | { | - | ||||||||||||
843 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->unopIntPath([this](){ | - | ||||||||||||
844 | auto overflowed = reinterpret_cast<PlatformAssembler *>(this->d)->branchSub32(PlatformAssembler::Overflow, | - | ||||||||||||
845 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
846 | TrustedImm32(1), | - | ||||||||||||
847 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
848 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag, PlatformAssembler::ScratchRegister); | - | ||||||||||||
849 | return executed 288 times by 6 tests: overflowed;return overflowed; Executed by:
executed 288 times by 6 tests: return overflowed; Executed by:
| 288 | ||||||||||||
850 | }); | - | ||||||||||||
851 | - | |||||||||||||
852 | - | |||||||||||||
853 | reinterpret_cast<PlatformAssembler *>(this->d)->callWithAccumulatorByValueAsFirstArgument([this]() { | - | ||||||||||||
854 | reinterpret_cast<PlatformAssembler *>(this->d)->PlatformAssemblerCommon::callRuntime("decHelper", reinterpret_cast<void *>(&decHelper)); | - | ||||||||||||
855 | reinterpret_cast<PlatformAssembler *>(this->d)->saveReturnValueInAccumulator(); | - | ||||||||||||
856 | } executed 288 times by 6 tests: );end of block Executed by:
| 288 | ||||||||||||
857 | checkException(); | - | ||||||||||||
858 | - | |||||||||||||
859 | - | |||||||||||||
860 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
861 | } executed 288 times by 6 tests: end of block Executed by:
| 288 | ||||||||||||
862 | - | |||||||||||||
863 | void Assembler::unot() | - | ||||||||||||
864 | { | - | ||||||||||||
865 | reinterpret_cast<PlatformAssembler *>(this->d)->toBoolean([this](PlatformAssembler::RegisterID resultReg){ | - | ||||||||||||
866 | reinterpret_cast<PlatformAssembler *>(this->d)->compare32(PlatformAssembler::Equal, resultReg, | - | ||||||||||||
867 | TrustedImm32(0), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
868 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
869 | } executed 268 times by 10 tests: );end of block Executed by:
| 268 | ||||||||||||
870 | } executed 134 times by 10 tests: end of block Executed by:
| 134 | ||||||||||||
871 | - | |||||||||||||
872 | void Assembler::add(int lhs) | - | ||||||||||||
873 | { | - | ||||||||||||
874 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->binopBothIntPath(regAddr(lhs), [this](){ | - | ||||||||||||
875 | auto overflowed = reinterpret_cast<PlatformAssembler *>(this->d)->branchAdd32(PlatformAssembler::Overflow, | - | ||||||||||||
876 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
877 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
878 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag, | - | ||||||||||||
879 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
880 | return executed 2130 times by 29 tests: overflowed;return overflowed; Executed by:
executed 2130 times by 29 tests: return overflowed; Executed by:
| 2130 | ||||||||||||
881 | }); | - | ||||||||||||
882 | - | |||||||||||||
883 | - | |||||||||||||
884 | saveAccumulatorInFrame(); | - | ||||||||||||
885 | prepareCallWithArgCount(3); | - | ||||||||||||
886 | passAccumulatorAsArg(2); | - | ||||||||||||
887 | passRegAsArg(lhs, 1); | - | ||||||||||||
888 | passEngineAsArg(0); | - | ||||||||||||
889 | callRuntime("Runtime::method_add", reinterpret_cast<void *>(&Runtime::method_add), ResultInAccumulator); | - | ||||||||||||
890 | checkException(); | - | ||||||||||||
891 | - | |||||||||||||
892 | - | |||||||||||||
893 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
894 | } executed 2130 times by 29 tests: end of block Executed by:
| 2130 | ||||||||||||
895 | - | |||||||||||||
896 | void Assembler::bitAnd(int lhs) | - | ||||||||||||
897 | { | - | ||||||||||||
898 | PlatformAssembler::Address lhsAddr = regAddr(lhs); | - | ||||||||||||
899 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32LhsAcc(lhsAddr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
900 | reinterpret_cast<PlatformAssembler *>(this->d)->and32(PlatformAssembler::ScratchRegister, PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
901 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
902 | } never executed: end of block | 0 | ||||||||||||
903 | - | |||||||||||||
904 | void Assembler::bitOr(int lhs) | - | ||||||||||||
905 | { | - | ||||||||||||
906 | PlatformAssembler::Address lhsAddr = regAddr(lhs); | - | ||||||||||||
907 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32LhsAcc(lhsAddr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
908 | reinterpret_cast<PlatformAssembler *>(this->d)->or32(PlatformAssembler::ScratchRegister, PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
909 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
910 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||
911 | - | |||||||||||||
912 | void Assembler::bitXor(int lhs) | - | ||||||||||||
913 | { | - | ||||||||||||
914 | PlatformAssembler::Address lhsAddr = regAddr(lhs); | - | ||||||||||||
915 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32LhsAcc(lhsAddr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
916 | reinterpret_cast<PlatformAssembler *>(this->d)->xor32(PlatformAssembler::ScratchRegister, PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
917 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
918 | } never executed: end of block | 0 | ||||||||||||
919 | - | |||||||||||||
920 | void Assembler::ushr(int lhs) | - | ||||||||||||
921 | { | - | ||||||||||||
922 | PlatformAssembler::Address lhsAddr = regAddr(lhs); | - | ||||||||||||
923 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32LhsAcc(lhsAddr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
924 | reinterpret_cast<PlatformAssembler *>(this->d)->and32(TrustedImm32(0x1f), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
925 | reinterpret_cast<PlatformAssembler *>(this->d)->urshift32(PlatformAssembler::AccumulatorRegisterValue, PlatformAssembler::ScratchRegister); | - | ||||||||||||
926 | reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::ScratchRegister, PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
927 | auto doubleEncode = reinterpret_cast<PlatformAssembler *>(this->d)->branch32(PlatformAssembler::LessThan, | - | ||||||||||||
928 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
929 | TrustedImm32(0)); | - | ||||||||||||
930 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
931 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->jump(); | - | ||||||||||||
932 | - | |||||||||||||
933 | doubleEncode.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
934 | reinterpret_cast<PlatformAssembler *>(this->d)->convertUInt32ToDouble(PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
935 | PlatformAssembler::FPScratchRegister, | - | ||||||||||||
936 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
937 | reinterpret_cast<PlatformAssembler *>(this->d)->encodeDoubleIntoAccumulator(PlatformAssembler::FPScratchRegister); | - | ||||||||||||
938 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
939 | } never executed: end of block | 0 | ||||||||||||
940 | - | |||||||||||||
941 | void Assembler::shr(int lhs) | - | ||||||||||||
942 | { | - | ||||||||||||
943 | PlatformAssembler::Address lhsAddr = regAddr(lhs); | - | ||||||||||||
944 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32LhsAcc(lhsAddr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
945 | reinterpret_cast<PlatformAssembler *>(this->d)->and32(TrustedImm32(0x1f), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
946 | reinterpret_cast<PlatformAssembler *>(this->d)->rshift32(PlatformAssembler::AccumulatorRegisterValue, PlatformAssembler::ScratchRegister); | - | ||||||||||||
947 | reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::ScratchRegister, PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
948 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
949 | } never executed: end of block | 0 | ||||||||||||
950 | - | |||||||||||||
951 | void Assembler::shl(int lhs) | - | ||||||||||||
952 | { | - | ||||||||||||
953 | PlatformAssembler::Address lhsAddr = regAddr(lhs); | - | ||||||||||||
954 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32LhsAcc(lhsAddr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
955 | reinterpret_cast<PlatformAssembler *>(this->d)->and32(TrustedImm32(0x1f), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
956 | reinterpret_cast<PlatformAssembler *>(this->d)->lshift32(PlatformAssembler::AccumulatorRegisterValue, PlatformAssembler::ScratchRegister); | - | ||||||||||||
957 | reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::ScratchRegister, PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
958 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
959 | } never executed: end of block | 0 | ||||||||||||
960 | - | |||||||||||||
961 | void Assembler::bitAndConst(int rhs) | - | ||||||||||||
962 | { | - | ||||||||||||
963 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
964 | reinterpret_cast<PlatformAssembler *>(this->d)->and32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
965 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
966 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||
967 | - | |||||||||||||
968 | void Assembler::bitOrConst(int rhs) | - | ||||||||||||
969 | { | - | ||||||||||||
970 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
971 | reinterpret_cast<PlatformAssembler *>(this->d)->or32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
972 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
973 | } never executed: end of block | 0 | ||||||||||||
974 | - | |||||||||||||
975 | void Assembler::bitXorConst(int rhs) | - | ||||||||||||
976 | { | - | ||||||||||||
977 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
978 | reinterpret_cast<PlatformAssembler *>(this->d)->xor32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
979 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
980 | } never executed: end of block | 0 | ||||||||||||
981 | - | |||||||||||||
982 | void Assembler::ushrConst(int rhs) | - | ||||||||||||
983 | { | - | ||||||||||||
984 | rhs &= 0x1f; | - | ||||||||||||
985 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
986 | if (rhs
| 0 | ||||||||||||
987 | - | |||||||||||||
988 | reinterpret_cast<PlatformAssembler *>(this->d)->urshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
989 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
990 | } never executed: else {end of block | 0 | ||||||||||||
991 | - | |||||||||||||
992 | auto doubleEncode = reinterpret_cast<PlatformAssembler *>(this->d)->branch32(PlatformAssembler::LessThan, | - | ||||||||||||
993 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
994 | TrustedImm32(0)); | - | ||||||||||||
995 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
996 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->jump(); | - | ||||||||||||
997 | - | |||||||||||||
998 | doubleEncode.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
999 | reinterpret_cast<PlatformAssembler *>(this->d)->convertUInt32ToDouble(PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
1000 | PlatformAssembler::FPScratchRegister, | - | ||||||||||||
1001 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1002 | reinterpret_cast<PlatformAssembler *>(this->d)->encodeDoubleIntoAccumulator(PlatformAssembler::FPScratchRegister); | - | ||||||||||||
1003 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1004 | } never executed: end of block | 0 | ||||||||||||
1005 | } | - | ||||||||||||
1006 | - | |||||||||||||
1007 | void Assembler::shrConst(int rhs) | - | ||||||||||||
1008 | { | - | ||||||||||||
1009 | rhs &= 0x1f; | - | ||||||||||||
1010 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
1011 | if (rhs
| 0 | ||||||||||||
1012 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->rshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue);reinterpret_cast<PlatformAssembler *>(this->d)->rshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->rshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); | 0 | ||||||||||||
1013 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
1014 | } never executed: end of block | 0 | ||||||||||||
1015 | - | |||||||||||||
1016 | void Assembler::shlConst(int rhs) | - | ||||||||||||
1017 | { | - | ||||||||||||
1018 | rhs &= 0x1f; | - | ||||||||||||
1019 | reinterpret_cast<PlatformAssembler *>(this->d)->toInt32(); | - | ||||||||||||
1020 | if (rhs
| 0 | ||||||||||||
1021 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->lshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue);reinterpret_cast<PlatformAssembler *>(this->d)->lshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->lshift32(TrustedImm32(rhs), PlatformAssembler::AccumulatorRegisterValue); | 0 | ||||||||||||
1022 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag); | - | ||||||||||||
1023 | } never executed: end of block | 0 | ||||||||||||
1024 | - | |||||||||||||
1025 | void Assembler::mul(int lhs) | - | ||||||||||||
1026 | { | - | ||||||||||||
1027 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->binopBothIntPath(regAddr(lhs), [this](){ | - | ||||||||||||
1028 | auto overflowed = reinterpret_cast<PlatformAssembler *>(this->d)->branchMul32(PlatformAssembler::Overflow, | - | ||||||||||||
1029 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
1030 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1031 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag, | - | ||||||||||||
1032 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1033 | return executed 896 times by 13 tests: overflowed;return overflowed; Executed by:
executed 896 times by 13 tests: return overflowed; Executed by:
| 896 | ||||||||||||
1034 | }); | - | ||||||||||||
1035 | - | |||||||||||||
1036 | - | |||||||||||||
1037 | saveAccumulatorInFrame(); | - | ||||||||||||
1038 | prepareCallWithArgCount(2); | - | ||||||||||||
1039 | passAccumulatorAsArg(1); | - | ||||||||||||
1040 | passRegAsArg(lhs, 0); | - | ||||||||||||
1041 | callRuntime("Runtime::method_mul", reinterpret_cast<void *>(&Runtime::method_mul), ResultInAccumulator); | - | ||||||||||||
1042 | checkException(); | - | ||||||||||||
1043 | - | |||||||||||||
1044 | - | |||||||||||||
1045 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1046 | } executed 896 times by 13 tests: end of block Executed by:
| 896 | ||||||||||||
1047 | - | |||||||||||||
1048 | void Assembler::div(int lhs) | - | ||||||||||||
1049 | { | - | ||||||||||||
1050 | saveAccumulatorInFrame(); | - | ||||||||||||
1051 | prepareCallWithArgCount(2); | - | ||||||||||||
1052 | passAccumulatorAsArg(1); | - | ||||||||||||
1053 | passRegAsArg(lhs, 0); | - | ||||||||||||
1054 | callRuntime("Runtime::method_div", reinterpret_cast<void *>(&Runtime::method_div), ResultInAccumulator); | - | ||||||||||||
1055 | checkException(); | - | ||||||||||||
1056 | } executed 468 times by 12 tests: end of block Executed by:
| 468 | ||||||||||||
1057 | - | |||||||||||||
1058 | void Assembler::mod(int lhs) | - | ||||||||||||
1059 | { | - | ||||||||||||
1060 | saveAccumulatorInFrame(); | - | ||||||||||||
1061 | prepareCallWithArgCount(2); | - | ||||||||||||
1062 | passAccumulatorAsArg(1); | - | ||||||||||||
1063 | passRegAsArg(lhs, 0); | - | ||||||||||||
1064 | callRuntime("Runtime::method_mod", reinterpret_cast<void *>(&Runtime::method_mod), ResultInAccumulator); | - | ||||||||||||
1065 | checkException(); | - | ||||||||||||
1066 | } executed 46 times by 5 tests: end of block Executed by:
| 46 | ||||||||||||
1067 | - | |||||||||||||
1068 | void Assembler::sub(int lhs) | - | ||||||||||||
1069 | { | - | ||||||||||||
1070 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->binopBothIntPath(regAddr(lhs), [this](){ | - | ||||||||||||
1071 | auto overflowed = reinterpret_cast<PlatformAssembler *>(this->d)->branchSub32(PlatformAssembler::Overflow, | - | ||||||||||||
1072 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
1073 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1074 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(IntegerTag, | - | ||||||||||||
1075 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1076 | return executed 686 times by 20 tests: overflowed;return overflowed; Executed by:
executed 686 times by 20 tests: return overflowed; Executed by:
| 686 | ||||||||||||
1077 | }); | - | ||||||||||||
1078 | - | |||||||||||||
1079 | - | |||||||||||||
1080 | saveAccumulatorInFrame(); | - | ||||||||||||
1081 | prepareCallWithArgCount(2); | - | ||||||||||||
1082 | passAccumulatorAsArg(1); | - | ||||||||||||
1083 | passRegAsArg(lhs, 0); | - | ||||||||||||
1084 | callRuntime("Runtime::method_sub", reinterpret_cast<void *>(&Runtime::method_sub), ResultInAccumulator); | - | ||||||||||||
1085 | checkException(); | - | ||||||||||||
1086 | - | |||||||||||||
1087 | - | |||||||||||||
1088 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1089 | } executed 686 times by 20 tests: end of block Executed by:
| 686 | ||||||||||||
1090 | - | |||||||||||||
1091 | void Assembler::cmpeqNull() | - | ||||||||||||
1092 | { | - | ||||||||||||
1093 | reinterpret_cast<PlatformAssembler *>(this->d)->isNullOrUndefined(); | - | ||||||||||||
1094 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1095 | } never executed: end of block | 0 | ||||||||||||
1096 | - | |||||||||||||
1097 | void Assembler::cmpneNull() | - | ||||||||||||
1098 | { | - | ||||||||||||
1099 | reinterpret_cast<PlatformAssembler *>(this->d)->isNullOrUndefined(); | - | ||||||||||||
1100 | reinterpret_cast<PlatformAssembler *>(this->d)->xor32(TrustedImm32(1), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
1101 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1102 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
1103 | - | |||||||||||||
1104 | void Assembler::cmpeqInt(int lhs) | - | ||||||||||||
1105 | { | - | ||||||||||||
1106 | auto isIntOrBool = reinterpret_cast<PlatformAssembler *>(this->d)->isIntOrBool(); | - | ||||||||||||
1107 | saveAccumulatorInFrame(); | - | ||||||||||||
1108 | reinterpret_cast<PlatformAssembler *>(this->d)->pushValueAligned(Encode(lhs)); | - | ||||||||||||
1109 | if (PlatformAssembler::ArgInRegCount < 2
| 0-40 | ||||||||||||
1110 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->push(PlatformAssembler::StackPointerRegister);reinterpret_cast<PlatformAssembler *>(this->d)->push(PlatformAssembler::StackPointerRegister); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->push(PlatformAssembler::StackPointerRegister); | 0 | ||||||||||||
1111 | else | - | ||||||||||||
1112 | reinterpret_cast< executed 40 times by 8 tests: PlatformAssembler *>(this->d)->move(PlatformAssembler::StackPointerRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(1));reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::StackPointerRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(1)); Executed by:
executed 40 times by 8 tests: reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::StackPointerRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(1)); Executed by:
| 40 | ||||||||||||
1113 | passAccumulatorAsArg_internal(0, true); | - | ||||||||||||
1114 | reinterpret_cast<PlatformAssembler *>(this->d)->callRuntime("Runtime::method_equal", (void*)Runtime::method_equal, ResultInAccumulator); | - | ||||||||||||
1115 | if (PlatformAssembler::ArgInRegCount < 2
| 0-40 | ||||||||||||
1116 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister);reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister); | 0 | ||||||||||||
1117 | reinterpret_cast<PlatformAssembler *>(this->d)->popValueAligned(); | - | ||||||||||||
1118 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->jump(); | - | ||||||||||||
1119 | isIntOrBool.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1120 | reinterpret_cast<PlatformAssembler *>(this->d)->compare32(PlatformAssembler::Equal, PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
1121 | TrustedImm32(lhs), | - | ||||||||||||
1122 | PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
1123 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1124 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1125 | } executed 40 times by 8 tests: end of block Executed by:
| 40 | ||||||||||||
1126 | - | |||||||||||||
1127 | void Assembler::cmpneInt(int lhs) | - | ||||||||||||
1128 | { | - | ||||||||||||
1129 | auto isIntOrBool = reinterpret_cast<PlatformAssembler *>(this->d)->isIntOrBool(); | - | ||||||||||||
1130 | saveAccumulatorInFrame(); | - | ||||||||||||
1131 | reinterpret_cast<PlatformAssembler *>(this->d)->pushValueAligned(Encode(lhs)); | - | ||||||||||||
1132 | if (PlatformAssembler::ArgInRegCount < 2
| 0-30 | ||||||||||||
1133 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->push(PlatformAssembler::StackPointerRegister);reinterpret_cast<PlatformAssembler *>(this->d)->push(PlatformAssembler::StackPointerRegister); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->push(PlatformAssembler::StackPointerRegister); | 0 | ||||||||||||
1134 | else | - | ||||||||||||
1135 | reinterpret_cast< executed 30 times by 3 tests: PlatformAssembler *>(this->d)->move(PlatformAssembler::StackPointerRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(1));reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::StackPointerRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(1)); Executed by:
executed 30 times by 3 tests: reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::StackPointerRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(1)); Executed by:
| 30 | ||||||||||||
1136 | passAccumulatorAsArg_internal(0, true); | - | ||||||||||||
1137 | reinterpret_cast<PlatformAssembler *>(this->d)->callRuntime("Runtime::method_notEqual", (void*)Runtime::method_notEqual, ResultInAccumulator); | - | ||||||||||||
1138 | if (PlatformAssembler::ArgInRegCount < 2
| 0-30 | ||||||||||||
1139 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister);reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister); | 0 | ||||||||||||
1140 | reinterpret_cast<PlatformAssembler *>(this->d)->popValueAligned(); | - | ||||||||||||
1141 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->jump(); | - | ||||||||||||
1142 | isIntOrBool.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1143 | reinterpret_cast<PlatformAssembler *>(this->d)->compare32(PlatformAssembler::NotEqual, PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
1144 | TrustedImm32(lhs), | - | ||||||||||||
1145 | PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
1146 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1147 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1148 | } executed 30 times by 3 tests: end of block Executed by:
| 30 | ||||||||||||
1149 | - | |||||||||||||
1150 | void Assembler::cmp(int cond, CmpFunc function, const char *functionName, int lhs) | - | ||||||||||||
1151 | { | - | ||||||||||||
1152 | auto c = static_cast<PlatformAssembler::RelationalCondition>(cond); | - | ||||||||||||
1153 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->binopBothIntPath(regAddr(lhs), [this, c](){ | - | ||||||||||||
1154 | reinterpret_cast<PlatformAssembler *>(this->d)->compare32(c, PlatformAssembler::ScratchRegister, | - | ||||||||||||
1155 | PlatformAssembler::AccumulatorRegisterValue, | - | ||||||||||||
1156 | PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
1157 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1158 | return executed 2256 times by 32 tests: PlatformAssembler::Jump();return PlatformAssembler::Jump(); Executed by:
executed 2256 times by 32 tests: return PlatformAssembler::Jump(); Executed by:
| 2256 | ||||||||||||
1159 | }); | - | ||||||||||||
1160 | - | |||||||||||||
1161 | - | |||||||||||||
1162 | saveAccumulatorInFrame(); | - | ||||||||||||
1163 | prepareCallWithArgCount(2); | - | ||||||||||||
1164 | passAccumulatorAsArg(1); | - | ||||||||||||
1165 | passRegAsArg(lhs, 0); | - | ||||||||||||
1166 | - | |||||||||||||
1167 | callRuntime(functionName, reinterpret_cast<void*>(function), ResultInAccumulator); | - | ||||||||||||
1168 | checkException(); | - | ||||||||||||
1169 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1170 | - | |||||||||||||
1171 | - | |||||||||||||
1172 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1173 | } executed 2256 times by 32 tests: end of block Executed by:
| 2256 | ||||||||||||
1174 | - | |||||||||||||
1175 | void Assembler::cmpeq(int lhs) | - | ||||||||||||
1176 | { | - | ||||||||||||
1177 | cmp(PlatformAssembler::Equal, &Runtime::method_compareEqual, | - | ||||||||||||
1178 | "Runtime::method_compareEqual", lhs); | - | ||||||||||||
1179 | } executed 1042 times by 16 tests: end of block Executed by:
| 1042 | ||||||||||||
1180 | - | |||||||||||||
1181 | void Assembler::cmpne(int lhs) | - | ||||||||||||
1182 | { | - | ||||||||||||
1183 | cmp(PlatformAssembler::NotEqual, &Runtime::method_compareNotEqual, | - | ||||||||||||
1184 | "Runtime::method_compareNotEqual", lhs); | - | ||||||||||||
1185 | } executed 86 times by 7 tests: end of block Executed by:
| 86 | ||||||||||||
1186 | - | |||||||||||||
1187 | void Assembler::cmpgt(int lhs) | - | ||||||||||||
1188 | { | - | ||||||||||||
1189 | cmp(PlatformAssembler::GreaterThan, &Runtime::method_compareGreaterThan, | - | ||||||||||||
1190 | "Runtime::method_compareGreaterThan", lhs); | - | ||||||||||||
1191 | } executed 74 times by 10 tests: end of block Executed by:
| 74 | ||||||||||||
1192 | - | |||||||||||||
1193 | void Assembler::cmpge(int lhs) | - | ||||||||||||
1194 | { | - | ||||||||||||
1195 | cmp(PlatformAssembler::GreaterThanOrEqual, &Runtime::method_compareGreaterEqual, | - | ||||||||||||
1196 | "Runtime::method_compareGreaterEqual", lhs); | - | ||||||||||||
1197 | } executed 12 times by 3 tests: end of block Executed by:
| 12 | ||||||||||||
1198 | - | |||||||||||||
1199 | void Assembler::cmplt(int lhs) | - | ||||||||||||
1200 | { | - | ||||||||||||
1201 | cmp(PlatformAssembler::LessThan, &Runtime::method_compareLessThan, | - | ||||||||||||
1202 | "Runtime::method_compareLessThan", lhs); | - | ||||||||||||
1203 | } executed 336 times by 15 tests: end of block Executed by:
| 336 | ||||||||||||
1204 | - | |||||||||||||
1205 | void Assembler::cmple(int lhs) | - | ||||||||||||
1206 | { | - | ||||||||||||
1207 | cmp(PlatformAssembler::LessThanOrEqual, &Runtime::method_compareLessEqual, | - | ||||||||||||
1208 | "Runtime::method_compareLessEqual", lhs); | - | ||||||||||||
1209 | } executed 72 times by 5 tests: end of block Executed by:
| 72 | ||||||||||||
1210 | - | |||||||||||||
1211 | void Assembler::cmpStrictEqual(int lhs) | - | ||||||||||||
1212 | { | - | ||||||||||||
1213 | cmp(PlatformAssembler::Equal, &RuntimeHelpers::strictEqual, | - | ||||||||||||
1214 | "RuntimeHelpers::strictEqual", lhs); | - | ||||||||||||
1215 | } executed 586 times by 11 tests: end of block Executed by:
| 586 | ||||||||||||
1216 | - | |||||||||||||
1217 | void Assembler::cmpStrictNotEqual(int lhs) | - | ||||||||||||
1218 | { | - | ||||||||||||
1219 | cmp(PlatformAssembler::Equal, &RuntimeHelpers::strictEqual, | - | ||||||||||||
1220 | "RuntimeHelpers::strictEqual", lhs); | - | ||||||||||||
1221 | reinterpret_cast<PlatformAssembler *>(this->d)->xor32(TrustedImm32(1), PlatformAssembler::AccumulatorRegisterValue); | - | ||||||||||||
1222 | reinterpret_cast<PlatformAssembler *>(this->d)->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean); | - | ||||||||||||
1223 | } executed 48 times by 6 tests: end of block Executed by:
| 48 | ||||||||||||
1224 | - | |||||||||||||
1225 | void Assembler::jump(int offset) | - | ||||||||||||
1226 | { | - | ||||||||||||
1227 | reinterpret_cast<PlatformAssembler *>(this->d)->patches.push_back({ reinterpret_cast<PlatformAssembler *>(this->d)->jump(), offset }); | - | ||||||||||||
1228 | } executed 2072 times by 31 tests: end of block Executed by:
| 2072 | ||||||||||||
1229 | - | |||||||||||||
1230 | void Assembler::jumpTrue(int offset) | - | ||||||||||||
1231 | { | - | ||||||||||||
1232 | reinterpret_cast<PlatformAssembler *>(this->d)->toBoolean([this, offset](PlatformAssembler::RegisterID resultReg) { | - | ||||||||||||
1233 | auto jump = reinterpret_cast<PlatformAssembler *>(this->d)->branch32(PlatformAssembler::NotEqual, TrustedImm32(0), resultReg); | - | ||||||||||||
1234 | reinterpret_cast<PlatformAssembler *>(this->d)->patches.push_back({ jump, offset }); | - | ||||||||||||
1235 | } executed 496 times by 9 tests: );end of block Executed by:
| 496 | ||||||||||||
1236 | } executed 248 times by 9 tests: end of block Executed by:
| 248 | ||||||||||||
1237 | - | |||||||||||||
1238 | void Assembler::jumpFalse(int offset) | - | ||||||||||||
1239 | { | - | ||||||||||||
1240 | reinterpret_cast<PlatformAssembler *>(this->d)->toBoolean([this, offset](PlatformAssembler::RegisterID resultReg) { | - | ||||||||||||
1241 | auto jump = reinterpret_cast<PlatformAssembler *>(this->d)->branch32(PlatformAssembler::Equal, TrustedImm32(0), resultReg); | - | ||||||||||||
1242 | reinterpret_cast<PlatformAssembler *>(this->d)->patches.push_back({ jump, offset }); | - | ||||||||||||
1243 | } executed 6852 times by 37 tests: );end of block Executed by:
| 6852 | ||||||||||||
1244 | } executed 3426 times by 37 tests: end of block Executed by:
| 3426 | ||||||||||||
1245 | - | |||||||||||||
1246 | void Assembler::jumpNoException(int offset) | - | ||||||||||||
1247 | { | - | ||||||||||||
1248 | auto jump = reinterpret_cast<PlatformAssembler *>(this->d)->branch32( | - | ||||||||||||
1249 | PlatformAssembler::Equal, | - | ||||||||||||
1250 | PlatformAssembler::Address(PlatformAssembler::EngineRegister, | - | ||||||||||||
1251 | - | |||||||||||||
1252 | __builtin_offsetof ( | - | ||||||||||||
1253 | EngineBase | - | ||||||||||||
1254 | , | - | ||||||||||||
1255 | hasException | - | ||||||||||||
1256 | ) | - | ||||||||||||
1257 | ), | - | ||||||||||||
1258 | TrustedImm32(0)); | - | ||||||||||||
1259 | reinterpret_cast<PlatformAssembler *>(this->d)->patches.push_back({ jump, offset }); | - | ||||||||||||
1260 | } executed 50 times by 7 tests: end of block Executed by:
| 50 | ||||||||||||
1261 | - | |||||||||||||
1262 | void Assembler::jumpNotUndefined(int offset) | - | ||||||||||||
1263 | { | - | ||||||||||||
1264 | reinterpret_cast<PlatformAssembler *>(this->d)->jumpNotUndefined(offset); | - | ||||||||||||
1265 | } never executed: end of block | 0 | ||||||||||||
1266 | - | |||||||||||||
1267 | void Assembler::prepareCallWithArgCount(int argc) | - | ||||||||||||
1268 | { | - | ||||||||||||
1269 | - | |||||||||||||
1270 | ((remainingArgcForCall == NoCall) ? static_cast<void>(0) : qt_assert("remainingArgcForCall == NoCall", __FILE__, 1998)); | - | ||||||||||||
1271 | remainingArgcForCall = argc; | - | ||||||||||||
1272 | - | |||||||||||||
1273 | - | |||||||||||||
1274 | if (argc > PlatformAssembler::ArgInRegCount
| 0-78696 | ||||||||||||
1275 | argcOnStackForCall = int(WTF::roundUpToMultipleOf(16, size_t(argc - PlatformAssembler::ArgInRegCount) * PlatformAssembler::PointerSize)); | - | ||||||||||||
1276 | reinterpret_cast<PlatformAssembler *>(this->d)->subPtr(TrustedImm32(argcOnStackForCall), PlatformAssembler::StackPointerRegister); | - | ||||||||||||
1277 | } never executed: end of block | 0 | ||||||||||||
1278 | } executed 78696 times by 64 tests: end of block Executed by:
| 78696 | ||||||||||||
1279 | - | |||||||||||||
1280 | void Assembler::storeInstructionPointer(int instructionOffset) | - | ||||||||||||
1281 | { | - | ||||||||||||
1282 | PlatformAssembler::Address addr(PlatformAssembler::CppStackFrameRegister, | - | ||||||||||||
1283 | - | |||||||||||||
1284 | __builtin_offsetof ( | - | ||||||||||||
1285 | QV4::CppStackFrame | - | ||||||||||||
1286 | , | - | ||||||||||||
1287 | instructionPointer | - | ||||||||||||
1288 | ) | - | ||||||||||||
1289 | ); | - | ||||||||||||
1290 | reinterpret_cast<PlatformAssembler *>(this->d)->store32(TrustedImm32(instructionOffset), addr); | - | ||||||||||||
1291 | } executed 44894 times by 62 tests: end of block Executed by:
| 44894 | ||||||||||||
1292 | - | |||||||||||||
1293 | Address argStackAddress(int arg) | - | ||||||||||||
1294 | { | - | ||||||||||||
1295 | int offset = arg - PlatformAssembler::ArgInRegCount; | - | ||||||||||||
1296 | ((offset >= 0) ? static_cast<void>(0) : qt_assert("offset >= 0", __FILE__, 2018)); | - | ||||||||||||
1297 | return never executed: Address(PlatformAssembler::StackPointerRegister, offset * PlatformAssembler::PointerSize);return Address(PlatformAssembler::StackPointerRegister, offset * PlatformAssembler::PointerSize); never executed: return Address(PlatformAssembler::StackPointerRegister, offset * PlatformAssembler::PointerSize); | 0 | ||||||||||||
1298 | } | - | ||||||||||||
1299 | - | |||||||||||||
1300 | void Assembler::passAccumulatorAsArg(int arg) | - | ||||||||||||
1301 | { | - | ||||||||||||
1302 | - | |||||||||||||
1303 | ((arg < remainingArgcForCall) ? static_cast<void>(0) : qt_assert("arg < remainingArgcForCall", __FILE__, 2025)); | - | ||||||||||||
1304 | --remainingArgcForCall; | - | ||||||||||||
1305 | - | |||||||||||||
1306 | - | |||||||||||||
1307 | passAccumulatorAsArg_internal(arg, false); | - | ||||||||||||
1308 | } executed 24336 times by 58 tests: end of block Executed by:
| 24336 | ||||||||||||
1309 | - | |||||||||||||
1310 | void Assembler::passAccumulatorAsArg_internal(int arg, bool push) | - | ||||||||||||
1311 | { | - | ||||||||||||
1312 | if (arg < PlatformAssembler::ArgInRegCount
| 0-24406 | ||||||||||||
1313 | reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32( | - | ||||||||||||
1314 | __builtin_offsetof ( | - | ||||||||||||
1315 | CallData | - | ||||||||||||
1316 | , | - | ||||||||||||
1317 | accumulator | - | ||||||||||||
1318 | ) | - | ||||||||||||
1319 | ), | - | ||||||||||||
1320 | PlatformAssembler::JSStackFrameRegister, | - | ||||||||||||
1321 | reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(arg)); | - | ||||||||||||
1322 | } executed 24406 times by 58 tests: else {end of block Executed by:
| 24406 | ||||||||||||
1323 | reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32( | - | ||||||||||||
1324 | __builtin_offsetof ( | - | ||||||||||||
1325 | CallData | - | ||||||||||||
1326 | , | - | ||||||||||||
1327 | accumulator | - | ||||||||||||
1328 | ) | - | ||||||||||||
1329 | ), | - | ||||||||||||
1330 | PlatformAssembler::JSStackFrameRegister, | - | ||||||||||||
1331 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1332 | if (push
| 0 | ||||||||||||
1333 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->push(PlatformAssembler::ScratchRegister);reinterpret_cast<PlatformAssembler *>(this->d)->push(PlatformAssembler::ScratchRegister); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->push(PlatformAssembler::ScratchRegister); | 0 | ||||||||||||
1334 | else | - | ||||||||||||
1335 | reinterpret_cast< never executed: PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::ScratchRegister,reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::ScratchRegister, argStackAddress(arg)); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::ScratchRegister, argStackAddress(arg)); | 0 | ||||||||||||
1336 | argStackAddress(arg)); never executed: reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::ScratchRegister, argStackAddress(arg)); | 0 | ||||||||||||
1337 | } | - | ||||||||||||
1338 | } | - | ||||||||||||
1339 | - | |||||||||||||
1340 | void Assembler::passFunctionAsArg(int arg) | - | ||||||||||||
1341 | { | - | ||||||||||||
1342 | - | |||||||||||||
1343 | ((arg < remainingArgcForCall) ? static_cast<void>(0) : qt_assert("arg < remainingArgcForCall", __FILE__, 2053)); | - | ||||||||||||
1344 | --remainingArgcForCall; | - | ||||||||||||
1345 | - | |||||||||||||
1346 | - | |||||||||||||
1347 | if (arg < PlatformAssembler::ArgInRegCount
| 0-40 | ||||||||||||
1348 | reinterpret_cast<PlatformAssembler *>(this->d)->loadFunctionPtr(reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(arg)); | - | ||||||||||||
1349 | } executed 40 times by 3 tests: else {end of block Executed by:
| 40 | ||||||||||||
1350 | reinterpret_cast<PlatformAssembler *>(this->d)->loadFunctionPtr(PlatformAssembler::ScratchRegister); | - | ||||||||||||
1351 | reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::ScratchRegister, | - | ||||||||||||
1352 | argStackAddress(arg)); | - | ||||||||||||
1353 | } never executed: end of block | 0 | ||||||||||||
1354 | } | - | ||||||||||||
1355 | - | |||||||||||||
1356 | void Assembler::passEngineAsArg(int arg) | - | ||||||||||||
1357 | { | - | ||||||||||||
1358 | - | |||||||||||||
1359 | ((arg < remainingArgcForCall) ? static_cast<void>(0) : qt_assert("arg < remainingArgcForCall", __FILE__, 2069)); | - | ||||||||||||
1360 | --remainingArgcForCall; | - | ||||||||||||
1361 | - | |||||||||||||
1362 | - | |||||||||||||
1363 | if (arg < PlatformAssembler::ArgInRegCount
| 0-74114 | ||||||||||||
1364 | reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::EngineRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(arg)); | - | ||||||||||||
1365 | } executed 74114 times by 63 tests: else {end of block Executed by:
| 74114 | ||||||||||||
1366 | reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::EngineRegister, argStackAddress(arg)); | - | ||||||||||||
1367 | } never executed: end of block | 0 | ||||||||||||
1368 | } | - | ||||||||||||
1369 | - | |||||||||||||
1370 | void Assembler::passRegAsArg(int reg, int arg) | - | ||||||||||||
1371 | { | - | ||||||||||||
1372 | - | |||||||||||||
1373 | ((arg < remainingArgcForCall) ? static_cast<void>(0) : qt_assert("arg < remainingArgcForCall", __FILE__, 2083)); | - | ||||||||||||
1374 | --remainingArgcForCall; | - | ||||||||||||
1375 | - | |||||||||||||
1376 | - | |||||||||||||
1377 | if (arg < PlatformAssembler::ArgInRegCount
| 0-27120 | ||||||||||||
1378 | reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(reg * int(sizeof(QV4::Value))), | - | ||||||||||||
1379 | PlatformAssembler::JSStackFrameRegister, | - | ||||||||||||
1380 | reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(arg)); | - | ||||||||||||
1381 | } executed 27120 times by 59 tests: else {end of block Executed by:
| 27120 | ||||||||||||
1382 | reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(reg * int(sizeof(QV4::Value))), | - | ||||||||||||
1383 | PlatformAssembler::JSStackFrameRegister, | - | ||||||||||||
1384 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1385 | reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(PlatformAssembler::ScratchRegister, | - | ||||||||||||
1386 | argStackAddress(arg)); | - | ||||||||||||
1387 | } never executed: end of block | 0 | ||||||||||||
1388 | } | - | ||||||||||||
1389 | - | |||||||||||||
1390 | void JIT::Assembler::passCppFrameAsArg(int arg) | - | ||||||||||||
1391 | { | - | ||||||||||||
1392 | - | |||||||||||||
1393 | ((arg < remainingArgcForCall) ? static_cast<void>(0) : qt_assert("arg < remainingArgcForCall", __FILE__, 2103)); | - | ||||||||||||
1394 | --remainingArgcForCall; | - | ||||||||||||
1395 | - | |||||||||||||
1396 | - | |||||||||||||
1397 | if (arg < PlatformAssembler::ArgInRegCount
| 0-154 | ||||||||||||
1398 | reinterpret_cast<PlatformAssembler *>(this->d)->move(PlatformAssembler::CppStackFrameRegister, reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(arg)); | - | ||||||||||||
1399 | } executed 154 times by 9 tests: else {end of block Executed by:
| 154 | ||||||||||||
1400 | reinterpret_cast<PlatformAssembler *>(this->d)->store32(PlatformAssembler::CppStackFrameRegister, argStackAddress(arg)); | - | ||||||||||||
1401 | } never executed: end of block | 0 | ||||||||||||
1402 | } | - | ||||||||||||
1403 | - | |||||||||||||
1404 | void Assembler::passInt32AsArg(int value, int arg) | - | ||||||||||||
1405 | { | - | ||||||||||||
1406 | - | |||||||||||||
1407 | ((arg < remainingArgcForCall) ? static_cast<void>(0) : qt_assert("arg < remainingArgcForCall", __FILE__, 2117)); | - | ||||||||||||
1408 | --remainingArgcForCall; | - | ||||||||||||
1409 | - | |||||||||||||
1410 | - | |||||||||||||
1411 | if (arg < PlatformAssembler::ArgInRegCount
| 0-53594 | ||||||||||||
1412 | reinterpret_cast<PlatformAssembler *>(this->d)->move(TrustedImm32(value), reinterpret_cast<PlatformAssembler *>(this->d)->registerForArg(arg)); | - | ||||||||||||
1413 | } executed 53594 times by 63 tests: else {end of block Executed by:
| 53594 | ||||||||||||
1414 | reinterpret_cast<PlatformAssembler *>(this->d)->store32(TrustedImm32(value), argStackAddress(arg)); | - | ||||||||||||
1415 | } never executed: end of block | 0 | ||||||||||||
1416 | } | - | ||||||||||||
1417 | - | |||||||||||||
1418 | void Assembler::callRuntime(const char *functionName, const void *funcPtr, | - | ||||||||||||
1419 | Assembler::CallResultDestination dest) | - | ||||||||||||
1420 | { | - | ||||||||||||
1421 | - | |||||||||||||
1422 | ((remainingArgcForCall == 0) ? static_cast<void>(0) : qt_assert("remainingArgcForCall == 0", __FILE__, 2132)); | - | ||||||||||||
1423 | remainingArgcForCall = NoCall; | - | ||||||||||||
1424 | - | |||||||||||||
1425 | reinterpret_cast<PlatformAssembler *>(this->d)->callRuntime(functionName, funcPtr, dest); | - | ||||||||||||
1426 | if (argcOnStackForCall > 0
| 0-78696 | ||||||||||||
1427 | reinterpret_cast<PlatformAssembler *>(this->d)->addPtr(TrustedImm32(argcOnStackForCall), PlatformAssembler::StackPointerRegister); | - | ||||||||||||
1428 | argcOnStackForCall = 0; | - | ||||||||||||
1429 | } never executed: end of block | 0 | ||||||||||||
1430 | } executed 78696 times by 64 tests: end of block Executed by:
| 78696 | ||||||||||||
1431 | - | |||||||||||||
1432 | void Assembler::saveAccumulatorInFrame() | - | ||||||||||||
1433 | { | - | ||||||||||||
1434 | reinterpret_cast<PlatformAssembler *>(this->d)->storeAccumulator(PlatformAssembler::Address(PlatformAssembler::JSStackFrameRegister, | - | ||||||||||||
1435 | - | |||||||||||||
1436 | __builtin_offsetof ( | - | ||||||||||||
1437 | CallData | - | ||||||||||||
1438 | , | - | ||||||||||||
1439 | accumulator | - | ||||||||||||
1440 | ) | - | ||||||||||||
1441 | )); | - | ||||||||||||
1442 | } executed 24406 times by 58 tests: end of block Executed by:
| 24406 | ||||||||||||
1443 | - | |||||||||||||
1444 | void Assembler::checkException() | - | ||||||||||||
1445 | { | - | ||||||||||||
1446 | reinterpret_cast<PlatformAssembler *>(this->d)->addCatchyJump( | - | ||||||||||||
1447 | reinterpret_cast<PlatformAssembler *>(this->d)->branch32( | - | ||||||||||||
1448 | PlatformAssembler::NotEqual, | - | ||||||||||||
1449 | PlatformAssembler::Address(PlatformAssembler::EngineRegister, | - | ||||||||||||
1450 | - | |||||||||||||
1451 | __builtin_offsetof ( | - | ||||||||||||
1452 | EngineBase | - | ||||||||||||
1453 | , | - | ||||||||||||
1454 | hasException | - | ||||||||||||
1455 | ) | - | ||||||||||||
1456 | ), | - | ||||||||||||
1457 | TrustedImm32(0))); | - | ||||||||||||
1458 | } executed 52604 times by 63 tests: end of block Executed by:
| 52604 | ||||||||||||
1459 | - | |||||||||||||
1460 | void Assembler::gotoCatchException() | - | ||||||||||||
1461 | { | - | ||||||||||||
1462 | reinterpret_cast<PlatformAssembler *>(this->d)->addCatchyJump(reinterpret_cast<PlatformAssembler *>(this->d)->jump()); | - | ||||||||||||
1463 | } executed 100 times by 8 tests: end of block Executed by:
| 100 | ||||||||||||
1464 | - | |||||||||||||
1465 | void Assembler::getException() | - | ||||||||||||
1466 | { | - | ||||||||||||
1467 | static_assert(bool(sizeof(QV4::EngineBase::hasException) == 1), "sizeof(QV4::EngineBase::hasException) == 1"); | - | ||||||||||||
1468 | - | |||||||||||||
1469 | Address hasExceptionAddr(PlatformAssembler::EngineRegister, | - | ||||||||||||
1470 | - | |||||||||||||
1471 | __builtin_offsetof ( | - | ||||||||||||
1472 | EngineBase | - | ||||||||||||
1473 | , | - | ||||||||||||
1474 | hasException | - | ||||||||||||
1475 | ) | - | ||||||||||||
1476 | ); | - | ||||||||||||
1477 | PlatformAssembler::Jump nope = reinterpret_cast<PlatformAssembler *>(this->d)->branch8(PlatformAssembler::Equal, | - | ||||||||||||
1478 | hasExceptionAddr, | - | ||||||||||||
1479 | TrustedImm32(0)); | - | ||||||||||||
1480 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPtr(Address(PlatformAssembler::EngineRegister, | - | ||||||||||||
1481 | - | |||||||||||||
1482 | __builtin_offsetof ( | - | ||||||||||||
1483 | EngineBase | - | ||||||||||||
1484 | , | - | ||||||||||||
1485 | exceptionValue | - | ||||||||||||
1486 | ) | - | ||||||||||||
1487 | ), | - | ||||||||||||
1488 | PlatformAssembler::ScratchRegister); | - | ||||||||||||
1489 | reinterpret_cast<PlatformAssembler *>(this->d)->loadAccumulator(Address(PlatformAssembler::ScratchRegister)); | - | ||||||||||||
1490 | reinterpret_cast<PlatformAssembler *>(this->d)->store8(TrustedImm32(0), hasExceptionAddr); | - | ||||||||||||
1491 | auto done = reinterpret_cast<PlatformAssembler *>(this->d)->jump(); | - | ||||||||||||
1492 | nope.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1493 | reinterpret_cast<PlatformAssembler *>(this->d)->loadValue(Primitive::emptyValue().asReturnedValue()); | - | ||||||||||||
1494 | - | |||||||||||||
1495 | done.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1496 | } never executed: end of block | 0 | ||||||||||||
1497 | - | |||||||||||||
1498 | void Assembler::setException() | - | ||||||||||||
1499 | { | - | ||||||||||||
1500 | auto noException = reinterpret_cast<PlatformAssembler *>(this->d)->jumpEmpty(); | - | ||||||||||||
1501 | Address addr(PlatformAssembler::EngineRegister, | - | ||||||||||||
1502 | __builtin_offsetof ( | - | ||||||||||||
1503 | EngineBase | - | ||||||||||||
1504 | , | - | ||||||||||||
1505 | exceptionValue | - | ||||||||||||
1506 | ) | - | ||||||||||||
1507 | ); | - | ||||||||||||
1508 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPtr(addr, PlatformAssembler::ScratchRegister); | - | ||||||||||||
1509 | reinterpret_cast<PlatformAssembler *>(this->d)->storeAccumulator(Address(PlatformAssembler::ScratchRegister)); | - | ||||||||||||
1510 | addr.offset = | - | ||||||||||||
1511 | __builtin_offsetof ( | - | ||||||||||||
1512 | EngineBase | - | ||||||||||||
1513 | , | - | ||||||||||||
1514 | hasException | - | ||||||||||||
1515 | ) | - | ||||||||||||
1516 | ; | - | ||||||||||||
1517 | static_assert(bool(sizeof(QV4::EngineBase::hasException) == 1), "sizeof(QV4::EngineBase::hasException) == 1"); | - | ||||||||||||
1518 | reinterpret_cast<PlatformAssembler *>(this->d)->store8(TrustedImm32(1), addr); | - | ||||||||||||
1519 | noException.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1520 | } never executed: end of block | 0 | ||||||||||||
1521 | - | |||||||||||||
1522 | void Assembler::setUnwindHandler(int offset) | - | ||||||||||||
1523 | { | - | ||||||||||||
1524 | auto l = reinterpret_cast<PlatformAssembler *>(this->d)->storePtrWithPatch(TrustedImmPtr(nullptr), reinterpret_cast<PlatformAssembler *>(this->d)->exceptionHandlerAddress()); | - | ||||||||||||
1525 | reinterpret_cast<PlatformAssembler *>(this->d)->ehTargets.push_back({ l, offset }); | - | ||||||||||||
1526 | } executed 92 times by 7 tests: end of block Executed by:
| 92 | ||||||||||||
1527 | - | |||||||||||||
1528 | - | |||||||||||||
1529 | void Assembler::clearUnwindHandler() | - | ||||||||||||
1530 | { | - | ||||||||||||
1531 | reinterpret_cast<PlatformAssembler *>(this->d)->storePtr(TrustedImmPtr(nullptr), reinterpret_cast<PlatformAssembler *>(this->d)->exceptionHandlerAddress()); | - | ||||||||||||
1532 | } executed 58 times by 7 tests: end of block Executed by:
| 58 | ||||||||||||
1533 | - | |||||||||||||
1534 | void JIT::Assembler::unwindDispatch() | - | ||||||||||||
1535 | { | - | ||||||||||||
1536 | checkException(); | - | ||||||||||||
1537 | reinterpret_cast<PlatformAssembler *>(this->d)->load32(Address(PlatformAssembler::CppStackFrameRegister, | - | ||||||||||||
1538 | __builtin_offsetof ( | - | ||||||||||||
1539 | CppStackFrame | - | ||||||||||||
1540 | , | - | ||||||||||||
1541 | unwindLevel | - | ||||||||||||
1542 | ) | - | ||||||||||||
1543 | ), PlatformAssembler::ScratchRegister); | - | ||||||||||||
1544 | auto noUnwind = reinterpret_cast<PlatformAssembler *>(this->d)->branch32(PlatformAssembler::Equal, PlatformAssembler::ScratchRegister, TrustedImm32(0)); | - | ||||||||||||
1545 | reinterpret_cast<PlatformAssembler *>(this->d)->sub32(TrustedImm32(1), PlatformAssembler::ScratchRegister); | - | ||||||||||||
1546 | reinterpret_cast<PlatformAssembler *>(this->d)->store32(PlatformAssembler::ScratchRegister, Address(PlatformAssembler::CppStackFrameRegister, | - | ||||||||||||
1547 | __builtin_offsetof ( | - | ||||||||||||
1548 | CppStackFrame | - | ||||||||||||
1549 | , | - | ||||||||||||
1550 | unwindLevel | - | ||||||||||||
1551 | ) | - | ||||||||||||
1552 | )); | - | ||||||||||||
1553 | auto jump = reinterpret_cast<PlatformAssembler *>(this->d)->branch32(PlatformAssembler::Equal, PlatformAssembler::ScratchRegister, TrustedImm32(0)); | - | ||||||||||||
1554 | gotoCatchException(); | - | ||||||||||||
1555 | jump.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1556 | - | |||||||||||||
1557 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPtr(Address(PlatformAssembler::CppStackFrameRegister, | - | ||||||||||||
1558 | __builtin_offsetof ( | - | ||||||||||||
1559 | CppStackFrame | - | ||||||||||||
1560 | , | - | ||||||||||||
1561 | unwindLabel | - | ||||||||||||
1562 | ) | - | ||||||||||||
1563 | ), PlatformAssembler::ScratchRegister); | - | ||||||||||||
1564 | reinterpret_cast<PlatformAssembler *>(this->d)->jump(PlatformAssembler::ScratchRegister); | - | ||||||||||||
1565 | - | |||||||||||||
1566 | noUnwind.link(reinterpret_cast<PlatformAssembler *>(this->d)); | - | ||||||||||||
1567 | } executed 50 times by 7 tests: end of block Executed by:
| 50 | ||||||||||||
1568 | - | |||||||||||||
1569 | void JIT::Assembler::unwindToLabel(int level, int offset) | - | ||||||||||||
1570 | { | - | ||||||||||||
1571 | auto l = reinterpret_cast<PlatformAssembler *>(this->d)->storePtrWithPatch(TrustedImmPtr(nullptr), Address(PlatformAssembler::CppStackFrameRegister, | - | ||||||||||||
1572 | __builtin_offsetof ( | - | ||||||||||||
1573 | CppStackFrame | - | ||||||||||||
1574 | , | - | ||||||||||||
1575 | unwindLabel | - | ||||||||||||
1576 | ) | - | ||||||||||||
1577 | )); | - | ||||||||||||
1578 | reinterpret_cast<PlatformAssembler *>(this->d)->ehTargets.push_back({ l, offset }); | - | ||||||||||||
1579 | reinterpret_cast<PlatformAssembler *>(this->d)->store32(TrustedImm32(level), Address(PlatformAssembler::CppStackFrameRegister, | - | ||||||||||||
1580 | __builtin_offsetof ( | - | ||||||||||||
1581 | CppStackFrame | - | ||||||||||||
1582 | , | - | ||||||||||||
1583 | unwindLevel | - | ||||||||||||
1584 | ) | - | ||||||||||||
1585 | )); | - | ||||||||||||
1586 | gotoCatchException(); | - | ||||||||||||
1587 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
1588 | - | |||||||||||||
1589 | void Assembler::pushCatchContext(int index, int name) | - | ||||||||||||
1590 | { | - | ||||||||||||
1591 | prepareCallWithArgCount(3); | - | ||||||||||||
1592 | passInt32AsArg(name, 2); | - | ||||||||||||
1593 | passInt32AsArg(index, 1); | - | ||||||||||||
1594 | passRegAsArg(CallData::Context, 0); | - | ||||||||||||
1595 | callRuntime("Runtime::method_createCatchContext", reinterpret_cast<void *>(&Runtime::method_createCatchContext), ResultInAccumulator); | - | ||||||||||||
1596 | reinterpret_cast<PlatformAssembler *>(this->d)->storeAccumulator(reinterpret_cast<PlatformAssembler *>(this->d)->contextAddress()); | - | ||||||||||||
1597 | } executed 50 times by 7 tests: end of block Executed by:
| 50 | ||||||||||||
1598 | - | |||||||||||||
1599 | void Assembler::popContext() | - | ||||||||||||
1600 | { | - | ||||||||||||
1601 | Heap::CallContext ctx; | - | ||||||||||||
1602 | (void)ctx; | - | ||||||||||||
1603 | reinterpret_cast<PlatformAssembler *>(this->d)->loadPointerFromValue(regAddr(CallData::Context), PlatformAssembler::ScratchRegister); | - | ||||||||||||
1604 | reinterpret_cast<PlatformAssembler *>(this->d)->loadAccumulator(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset)); | - | ||||||||||||
1605 | reinterpret_cast<PlatformAssembler *>(this->d)->storeAccumulator(regAddr(CallData::Context)); | - | ||||||||||||
1606 | } executed 204 times by 11 tests: end of block Executed by:
| 204 | ||||||||||||
1607 | - | |||||||||||||
1608 | void Assembler::ret() | - | ||||||||||||
1609 | { | - | ||||||||||||
1610 | reinterpret_cast<PlatformAssembler *>(this->d)->generateFunctionExit(); | - | ||||||||||||
1611 | } executed 13404 times by 64 tests: end of block Executed by:
| 13404 | ||||||||||||
1612 | - | |||||||||||||
1613 | } | - | ||||||||||||
1614 | } | - | ||||||||||||
1615 | - | |||||||||||||
1616 | - | |||||||||||||
Switch to Source code | Preprocessed file |