Make JetStream 2
[WebKit-https.git] / PerformanceTests / JetStream2 / RexBench / OfflineAssembler / LowLevelInterpreter64.js
1 /*
2  * DO NOT EDIT THIS FILE, it is autogenerated.
3  */
4 "use strict";
5
6 (function() {
7     let source = `# Copyright (C) 2011-2017 Apple Inc. All rights reserved.
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 # 1. Redistributions of source code must retain the above copyright
13 #    notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 #    notice, this list of conditions and the following disclaimer in the
16 #    documentation and/or other materials provided with the distribution.
17 #
18 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS \`\`AS IS''
19 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
22 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 # THE POSSIBILITY OF SUCH DAMAGE.
29
30
31 # Utilities.
32 macro jumpToInstruction()
33     jmp [PB, PC, 8]
34 end
35
36 macro dispatch(advance)
37     addp advance, PC
38     jumpToInstruction()
39 end
40
41 macro dispatchInt(advance)
42     addi advance, PC
43     jumpToInstruction()
44 end
45
46 macro dispatchIntIndirect(offset)
47     dispatchInt(offset * 8[PB, PC, 8])
48 end
49
50 macro dispatchAfterCall()
51     loadi ArgumentCount + TagOffset[cfr], PC
52     loadp CodeBlock[cfr], PB
53     loadp CodeBlock::m_instructions[PB], PB
54     loadisFromInstruction(1, t1)
55     storeq r0, [cfr, t1, 8]
56     valueProfile(r0, (CallOpCodeSize - 1), t3)
57     dispatch(CallOpCodeSize)
58 end
59
60 macro cCall2(function)
61     checkStackPointerAlignment(t4, 0xbad0c002)
62     if X86_64 or ARM64
63         call function
64     elsif X86_64_WIN
65         # Note: this implementation is only correct if the return type size is > 8 bytes.
66         # See macro cCall2Void for an implementation when the return type <= 8 bytes.
67         # On Win64, when the return type is larger than 8 bytes, we need to allocate space on the stack for the return value.
68         # On entry rcx (a0), should contain a pointer to this stack space. The other parameters are shifted to the right,
69         # rdx (a1) should contain the first argument, and r8 (a2) should contain the second argument.
70         # On return, rax contains a pointer to this stack value, and we then need to copy the 16 byte return value into rax (r0) and rdx (r1)
71         # since the return value is expected to be split between the two.
72         # See http://msdn.microsoft.com/en-us/library/7572ztz4.aspx
73         move a1, a2
74         move a0, a1
75         subp 48, sp
76         move sp, a0
77         addp 32, a0
78         call function
79         addp 48, sp
80         move 8[r0], r1
81         move [r0], r0
82     elsif C_LOOP
83         cloopCallSlowPath function, a0, a1
84     else
85         error
86     end
87 end
88
89 macro cCall2Void(function)
90     if C_LOOP
91         cloopCallSlowPathVoid function, a0, a1
92     elsif X86_64_WIN
93         # Note: we cannot use the cCall2 macro for Win64 in this case,
94         # as the Win64 cCall2 implemenation is only correct when the return type size is > 8 bytes.
95         # On Win64, rcx and rdx are used for passing the first two parameters.
96         # We also need to make room on the stack for all four parameter registers.
97         # See http://msdn.microsoft.com/en-us/library/ms235286.aspx
98         subp 32, sp 
99         call function
100         addp 32, sp 
101     else
102         cCall2(function)
103     end
104 end
105
106 # This barely works. arg3 and arg4 should probably be immediates.
107 macro cCall4(function)
108     checkStackPointerAlignment(t4, 0xbad0c004)
109     if X86_64 or ARM64
110         call function
111     elsif X86_64_WIN
112         # On Win64, rcx, rdx, r8, and r9 are used for passing the first four parameters.
113         # We also need to make room on the stack for all four parameter registers.
114         # See http://msdn.microsoft.com/en-us/library/ms235286.aspx
115         subp 64, sp
116         call function
117         addp 64, sp
118     else
119         error
120     end
121 end
122
123 macro doVMEntry(makeCall)
124     functionPrologue()
125     pushCalleeSaves()
126
127     const entry = a0
128     const vm = a1
129     const protoCallFrame = a2
130
131     vmEntryRecord(cfr, sp)
132
133     checkStackPointerAlignment(t4, 0xbad0dc01)
134
135     storep vm, VMEntryRecord::m_vm[sp]
136     loadp VM::topCallFrame[vm], t4
137     storep t4, VMEntryRecord::m_prevTopCallFrame[sp]
138     loadp VM::topVMEntryFrame[vm], t4
139     storep t4, VMEntryRecord::m_prevTopVMEntryFrame[sp]
140
141     loadi ProtoCallFrame::paddedArgCount[protoCallFrame], t4
142     addp CallFrameHeaderSlots, t4, t4
143     lshiftp 3, t4
144     subp sp, t4, t3
145     bqbeq sp, t3, .throwStackOverflow
146
147     # Ensure that we have enough additional stack capacity for the incoming args,
148     # and the frame for the JS code we're executing. We need to do this check
149     # before we start copying the args from the protoCallFrame below.
150     if C_LOOP
151         bpaeq t3, VM::m_cloopStackLimit[vm], .stackHeightOK
152     else
153         bpaeq t3, VM::m_softStackLimit[vm], .stackHeightOK
154     end
155
156     if C_LOOP
157         move entry, t4
158         move vm, t5
159         cloopCallSlowPath _llint_stack_check_at_vm_entry, vm, t3
160         bpeq t0, 0, .stackCheckFailed
161         move t4, entry
162         move t5, vm
163         jmp .stackHeightOK
164
165 .stackCheckFailed:
166         move t4, entry
167         move t5, vm
168     end
169
170 .throwStackOverflow:
171     move vm, a0
172     move protoCallFrame, a1
173     cCall2(_llint_throw_stack_overflow_error)
174
175     vmEntryRecord(cfr, t4)
176
177     loadp VMEntryRecord::m_vm[t4], vm
178     loadp VMEntryRecord::m_prevTopCallFrame[t4], extraTempReg
179     storep extraTempReg, VM::topCallFrame[vm]
180     loadp VMEntryRecord::m_prevTopVMEntryFrame[t4], extraTempReg
181     storep extraTempReg, VM::topVMEntryFrame[vm]
182
183     subp cfr, CalleeRegisterSaveSize, sp
184
185     popCalleeSaves()
186     functionEpilogue()
187     ret
188
189 .stackHeightOK:
190     move t3, sp
191     move 4, t3
192
193 .copyHeaderLoop:
194     # Copy the CodeBlock/Callee/ArgumentCount/|this| from protoCallFrame into the callee frame.
195     subi 1, t3
196     loadq [protoCallFrame, t3, 8], extraTempReg
197     storeq extraTempReg, CodeBlock[sp, t3, 8]
198     btinz t3, .copyHeaderLoop
199
200     loadi PayloadOffset + ProtoCallFrame::argCountAndCodeOriginValue[protoCallFrame], t4
201     subi 1, t4
202     loadi ProtoCallFrame::paddedArgCount[protoCallFrame], extraTempReg
203     subi 1, extraTempReg
204
205     bieq t4, extraTempReg, .copyArgs
206     move ValueUndefined, t3
207 .fillExtraArgsLoop:
208     subi 1, extraTempReg
209     storeq t3, ThisArgumentOffset + 8[sp, extraTempReg, 8]
210     bineq t4, extraTempReg, .fillExtraArgsLoop
211
212 .copyArgs:
213     loadp ProtoCallFrame::args[protoCallFrame], t3
214
215 .copyArgsLoop:
216     btiz t4, .copyArgsDone
217     subi 1, t4
218     loadq [t3, t4, 8], extraTempReg
219     storeq extraTempReg, ThisArgumentOffset + 8[sp, t4, 8]
220     jmp .copyArgsLoop
221
222 .copyArgsDone:
223     if ARM64
224         move sp, t4
225         storep t4, VM::topCallFrame[vm]
226     else
227         storep sp, VM::topCallFrame[vm]
228     end
229     storep cfr, VM::topVMEntryFrame[vm]
230
231     checkStackPointerAlignment(extraTempReg, 0xbad0dc02)
232
233     makeCall(entry, t3)
234
235     # We may have just made a call into a JS function, so we can't rely on sp
236     # for anything but the fact that our own locals (ie the VMEntryRecord) are
237     # not below it. It also still has to be aligned, though.
238     checkStackPointerAlignment(t2, 0xbad0dc03)
239
240     vmEntryRecord(cfr, t4)
241
242     loadp VMEntryRecord::m_vm[t4], vm
243     loadp VMEntryRecord::m_prevTopCallFrame[t4], t2
244     storep t2, VM::topCallFrame[vm]
245     loadp VMEntryRecord::m_prevTopVMEntryFrame[t4], t2
246     storep t2, VM::topVMEntryFrame[vm]
247
248     subp cfr, CalleeRegisterSaveSize, sp
249
250     popCalleeSaves()
251     functionEpilogue()
252
253     ret
254 end
255
256
257 macro makeJavaScriptCall(entry, temp)
258     addp 16, sp
259     if C_LOOP
260         cloopCallJSFunction entry
261     else
262         call entry
263     end
264     subp 16, sp
265 end
266
267
268 macro makeHostFunctionCall(entry, temp)
269     move entry, temp
270     storep cfr, [sp]
271     move sp, a0
272     if C_LOOP
273         storep lr, 8[sp]
274         cloopCallNative temp
275     elsif X86_64_WIN
276         # We need to allocate 32 bytes on the stack for the shadow space.
277         subp 32, sp
278         call temp
279         addp 32, sp
280     else
281         call temp
282     end
283 end
284
285
286 _handleUncaughtException:
287     loadp Callee[cfr], t3
288     andp MarkedBlockMask, t3
289     loadp MarkedBlock::m_vm[t3], t3
290     restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0)
291     loadp VM::callFrameForCatch[t3], cfr
292     storep 0, VM::callFrameForCatch[t3]
293
294     loadp CallerFrame[cfr], cfr
295     vmEntryRecord(cfr, t2)
296
297     loadp VMEntryRecord::m_vm[t2], t3
298     loadp VMEntryRecord::m_prevTopCallFrame[t2], extraTempReg
299     storep extraTempReg, VM::topCallFrame[t3]
300     loadp VMEntryRecord::m_prevTopVMEntryFrame[t2], extraTempReg
301     storep extraTempReg, VM::topVMEntryFrame[t3]
302
303     subp cfr, CalleeRegisterSaveSize, sp
304
305     popCalleeSaves()
306     functionEpilogue()
307     ret
308
309
310 macro prepareStateForCCall()
311     leap [PB, PC, 8], PC
312 end
313
314 macro restoreStateAfterCCall()
315     move r0, PC
316     subp PB, PC
317     rshiftp 3, PC
318 end
319
320 macro callSlowPath(slowPath)
321     prepareStateForCCall()
322     move cfr, a0
323     move PC, a1
324     cCall2(slowPath)
325     restoreStateAfterCCall()
326 end
327
328 macro traceOperand(fromWhere, operand)
329     prepareStateForCCall()
330     move fromWhere, a2
331     move operand, a3
332     move cfr, a0
333     move PC, a1
334     cCall4(_llint_trace_operand)
335     restoreStateAfterCCall()
336 end
337
338 macro traceValue(fromWhere, operand)
339     prepareStateForCCall()
340     move fromWhere, a2
341     move operand, a3
342     move cfr, a0
343     move PC, a1
344     cCall4(_llint_trace_value)
345     restoreStateAfterCCall()
346 end
347
348 # Call a slow path for call call opcodes.
349 macro callCallSlowPath(slowPath, action)
350     storei PC, ArgumentCount + TagOffset[cfr]
351     prepareStateForCCall()
352     move cfr, a0
353     move PC, a1
354     cCall2(slowPath)
355     action(r0, r1)
356 end
357
358 macro callTrapHandler(throwHandler)
359     storei PC, ArgumentCount + TagOffset[cfr]
360     prepareStateForCCall()
361     move cfr, a0
362     move PC, a1
363     cCall2(_llint_slow_path_handle_traps)
364     btpnz r0, throwHandler
365     loadi ArgumentCount + TagOffset[cfr], PC
366 end
367
368 macro checkSwitchToJITForLoop()
369     checkSwitchToJIT(
370         1,
371         macro()
372             storei PC, ArgumentCount + TagOffset[cfr]
373             prepareStateForCCall()
374             move cfr, a0
375             move PC, a1
376             cCall2(_llint_loop_osr)
377             btpz r0, .recover
378             move r1, sp
379             jmp r0
380         .recover:
381             loadi ArgumentCount + TagOffset[cfr], PC
382         end)
383 end
384
385 macro loadCaged(basePtr, source, dest, scratch)
386     loadp source, dest
387     if GIGACAGE_ENABLED and not C_LOOP
388         loadp basePtr, scratch
389         btpz scratch, .done
390         andp constexpr GIGACAGE_MASK, dest
391         addp scratch, dest
392     .done:
393     end
394 end
395
396 macro loadVariable(operand, value)
397     loadisFromInstruction(operand, value)
398     loadq [cfr, value, 8], value
399 end
400
401 # Index and value must be different registers. Index may be clobbered.
402 macro loadConstantOrVariable(index, value)
403     bpgteq index, FirstConstantRegisterIndex, .constant
404     loadq [cfr, index, 8], value
405     jmp .done
406 .constant:
407     loadp CodeBlock[cfr], value
408     loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value
409     subp FirstConstantRegisterIndex, index
410     loadq [value, index, 8], value
411 .done:
412 end
413
414 macro loadConstantOrVariableInt32(index, value, slow)
415     loadConstantOrVariable(index, value)
416     bqb value, tagTypeNumber, slow
417 end
418
419 macro loadConstantOrVariableCell(index, value, slow)
420     loadConstantOrVariable(index, value)
421     btqnz value, tagMask, slow
422 end
423
424 macro writeBarrierOnOperand(cellOperand)
425     loadisFromInstruction(cellOperand, t1)
426     loadConstantOrVariableCell(t1, t2, .writeBarrierDone)
427     skipIfIsRememberedOrInEden(
428         t2,
429         macro()
430             push PB, PC
431             move t2, a1 # t2 can be a0 (not on 64 bits, but better safe than sorry)
432             move cfr, a0
433             cCall2Void(_llint_write_barrier_slow)
434             pop PC, PB
435         end)
436 .writeBarrierDone:
437 end
438
439 macro writeBarrierOnOperands(cellOperand, valueOperand)
440     loadisFromInstruction(valueOperand, t1)
441     loadConstantOrVariableCell(t1, t0, .writeBarrierDone)
442     btpz t0, .writeBarrierDone
443
444     writeBarrierOnOperand(cellOperand)
445 .writeBarrierDone:
446 end
447
448 macro writeBarrierOnGlobal(valueOperand, loadHelper)
449     loadisFromInstruction(valueOperand, t1)
450     loadConstantOrVariableCell(t1, t0, .writeBarrierDone)
451     btpz t0, .writeBarrierDone
452
453     loadHelper(t3)
454     skipIfIsRememberedOrInEden(
455         t3,
456         macro()
457             push PB, PC
458             move cfr, a0
459             move t3, a1
460             cCall2Void(_llint_write_barrier_slow)
461             pop PC, PB
462         end
463     )
464 .writeBarrierDone:
465 end
466
467 macro writeBarrierOnGlobalObject(valueOperand)
468     writeBarrierOnGlobal(valueOperand,
469         macro(registerToStoreGlobal)
470             loadp CodeBlock[cfr], registerToStoreGlobal
471             loadp CodeBlock::m_globalObject[registerToStoreGlobal], registerToStoreGlobal
472         end)
473 end
474
475 macro writeBarrierOnGlobalLexicalEnvironment(valueOperand)
476     writeBarrierOnGlobal(valueOperand,
477         macro(registerToStoreGlobal)
478             loadp CodeBlock[cfr], registerToStoreGlobal
479             loadp CodeBlock::m_globalObject[registerToStoreGlobal], registerToStoreGlobal
480             loadp JSGlobalObject::m_globalLexicalEnvironment[registerToStoreGlobal], registerToStoreGlobal
481         end)
482 end
483
484 macro valueProfile(value, operand, scratch)
485     loadpFromInstruction(operand, scratch)
486     storeq value, ValueProfile::m_buckets[scratch]
487 end
488
489 macro structureIDToStructureWithScratch(structureIDThenStructure, scratch)
490     loadp CodeBlock[cfr], scratch
491     loadp CodeBlock::m_vm[scratch], scratch
492     loadp VM::heap + Heap::m_structureIDTable + StructureIDTable::m_table[scratch], scratch
493     loadp [scratch, structureIDThenStructure, 8], structureIDThenStructure
494 end
495
496 macro loadStructureWithScratch(cell, structure, scratch)
497     loadi JSCell::m_structureID[cell], structure
498     structureIDToStructureWithScratch(structure, scratch)
499 end
500
501 macro loadStructureAndClobberFirstArg(cell, structure)
502     loadi JSCell::m_structureID[cell], structure
503     loadp CodeBlock[cfr], cell
504     loadp CodeBlock::m_vm[cell], cell
505     loadp VM::heap + Heap::m_structureIDTable + StructureIDTable::m_table[cell], cell
506     loadp [cell, structure, 8], structure
507 end
508
509 # Entrypoints into the interpreter.
510
511 # Expects that CodeBlock is in t1, which is what prologue() leaves behind.
512 macro functionArityCheck(doneLabel, slowPath)
513     loadi PayloadOffset + ArgumentCount[cfr], t0
514     biaeq t0, CodeBlock::m_numParameters[t1], doneLabel
515     prepareStateForCCall()
516     move cfr, a0
517     move PC, a1
518     cCall2(slowPath)   # This slowPath has the protocol: r0 = 0 => no error, r0 != 0 => error
519     btiz r0, .noError
520     move r1, cfr   # r1 contains caller frame
521     jmp _llint_throw_from_slow_path_trampoline
522
523 .noError:
524     loadi CommonSlowPaths::ArityCheckData::paddedStackSpace[r1], t1
525     btiz t1, .continue
526     loadi PayloadOffset + ArgumentCount[cfr], t2
527     addi CallFrameHeaderSlots, t2
528
529     // Check if there are some unaligned slots we can use
530     move t1, t3
531     andi StackAlignmentSlots - 1, t3
532     btiz t3, .noExtraSlot
533     move ValueUndefined, t0
534 .fillExtraSlots:
535     storeq t0, [cfr, t2, 8]
536     addi 1, t2
537     bsubinz 1, t3, .fillExtraSlots
538     andi ~(StackAlignmentSlots - 1), t1
539     btiz t1, .continue
540
541 .noExtraSlot:
542     // Move frame up t1 slots
543     negq t1
544     move cfr, t3
545     subp CalleeSaveSpaceAsVirtualRegisters * 8, t3
546     addi CalleeSaveSpaceAsVirtualRegisters, t2
547     move t1, t0
548     lshiftp 3, t0
549     addp t0, cfr
550     addp t0, sp
551 .copyLoop:
552     loadq [t3], t0
553     storeq t0, [t3, t1, 8]
554     addp 8, t3
555     bsubinz 1, t2, .copyLoop
556
557     // Fill new slots with JSUndefined
558     move t1, t2
559     move ValueUndefined, t0
560 .fillLoop:
561     storeq t0, [t3, t1, 8]
562     addp 8, t3
563     baddinz 1, t2, .fillLoop
564
565 .continue:
566     # Reload CodeBlock and reset PC, since the slow_path clobbered them.
567     loadp CodeBlock[cfr], t1
568     loadp CodeBlock::m_instructions[t1], PB
569     move 0, PC
570     jmp doneLabel
571 end
572
573 macro branchIfException(label)
574     loadp Callee[cfr], t3
575     andp MarkedBlockMask, t3
576     loadp MarkedBlock::m_vm[t3], t3
577     btqz VM::m_exception[t3], .noException
578     jmp label
579 .noException:
580 end
581
582
583 # Instruction implementations
584 _llint_op_enter:
585     traceExecution()
586     checkStackPointerAlignment(t2, 0xdead00e1)
587     loadp CodeBlock[cfr], t2                // t2<CodeBlock> = cfr.CodeBlock
588     loadi CodeBlock::m_numVars[t2], t2      // t2<size_t> = t2<CodeBlock>.m_numVars
589     subq CalleeSaveSpaceAsVirtualRegisters, t2
590     move cfr, t1
591     subq CalleeSaveSpaceAsVirtualRegisters * 8, t1
592     btiz t2, .opEnterDone
593     move ValueUndefined, t0
594     negi t2
595     sxi2q t2, t2
596 .opEnterLoop:
597     storeq t0, [t1, t2, 8]
598     addq 1, t2
599     btqnz t2, .opEnterLoop
600 .opEnterDone:
601     callOpcodeSlowPath(_slow_path_enter)
602     dispatch(constexpr op_enter_length)
603
604
605 _llint_op_get_argument:
606     traceExecution()
607     loadisFromInstruction(1, t1)
608     loadisFromInstruction(2, t2)
609     loadi PayloadOffset + ArgumentCount[cfr], t0
610     bilteq t0, t2, .opGetArgumentOutOfBounds
611     loadq ThisArgumentOffset[cfr, t2, 8], t0
612     storeq t0, [cfr, t1, 8]
613     valueProfile(t0, 3, t2)
614     dispatch(constexpr op_get_argument_length)
615
616 .opGetArgumentOutOfBounds:
617     storeq ValueUndefined, [cfr, t1, 8]
618     valueProfile(ValueUndefined, 3, t2)
619     dispatch(constexpr op_get_argument_length)
620
621
622 _llint_op_argument_count:
623     traceExecution()
624     loadisFromInstruction(1, t1)
625     loadi PayloadOffset + ArgumentCount[cfr], t0
626     subi 1, t0
627     orq TagTypeNumber, t0
628     storeq t0, [cfr, t1, 8]
629     dispatch(constexpr op_argument_count_length)
630
631
632 _llint_op_get_scope:
633     traceExecution()
634     loadp Callee[cfr], t0
635     loadp JSCallee::m_scope[t0], t0
636     loadisFromInstruction(1, t1)
637     storeq t0, [cfr, t1, 8]
638     dispatch(constexpr op_get_scope_length)
639
640
641 _llint_op_to_this:
642     traceExecution()
643     loadisFromInstruction(1, t0)
644     loadq [cfr, t0, 8], t0
645     btqnz t0, tagMask, .opToThisSlow
646     bbneq JSCell::m_type[t0], FinalObjectType, .opToThisSlow
647     loadStructureWithScratch(t0, t1, t2)
648     loadpFromInstruction(2, t2)
649     bpneq t1, t2, .opToThisSlow
650     dispatch(constexpr op_to_this_length)
651
652 .opToThisSlow:
653     callOpcodeSlowPath(_slow_path_to_this)
654     dispatch(constexpr op_to_this_length)
655
656
657 _llint_op_check_tdz:
658     traceExecution()
659     loadisFromInstruction(1, t0)
660     loadConstantOrVariable(t0, t1)
661     bqneq t1, ValueEmpty, .opNotTDZ
662     callOpcodeSlowPath(_slow_path_throw_tdz_error)
663
664 .opNotTDZ:
665     dispatch(constexpr op_check_tdz_length)
666
667
668 _llint_op_mov:
669     traceExecution()
670     loadisFromInstruction(2, t1)
671     loadisFromInstruction(1, t0)
672     loadConstantOrVariable(t1, t2)
673     storeq t2, [cfr, t0, 8]
674     dispatch(constexpr op_mov_length)
675
676
677 _llint_op_not:
678     traceExecution()
679     loadisFromInstruction(2, t0)
680     loadisFromInstruction(1, t1)
681     loadConstantOrVariable(t0, t2)
682     xorq ValueFalse, t2
683     btqnz t2, ~1, .opNotSlow
684     xorq ValueTrue, t2
685     storeq t2, [cfr, t1, 8]
686     dispatch(constexpr op_not_length)
687
688 .opNotSlow:
689     callOpcodeSlowPath(_slow_path_not)
690     dispatch(constexpr op_not_length)
691
692
693 macro equalityComparison(integerComparison, slowPath)
694     traceExecution()
695     loadisFromInstruction(3, t0)
696     loadisFromInstruction(2, t2)
697     loadisFromInstruction(1, t3)
698     loadConstantOrVariableInt32(t0, t1, .slow)
699     loadConstantOrVariableInt32(t2, t0, .slow)
700     integerComparison(t0, t1, t0)
701     orq ValueFalse, t0
702     storeq t0, [cfr, t3, 8]
703     dispatch(4)
704
705 .slow:
706     callOpcodeSlowPath(slowPath)
707     dispatch(4)
708 end
709
710 _llint_op_eq:
711     equalityComparison(
712         macro (left, right, result) cieq left, right, result end,
713         _slow_path_eq)
714
715
716 _llint_op_neq:
717     equalityComparison(
718         macro (left, right, result) cineq left, right, result end,
719         _slow_path_neq)
720
721
722 macro equalNullComparison()
723     loadisFromInstruction(2, t0)
724     loadq [cfr, t0, 8], t0
725     btqnz t0, tagMask, .immediate
726     btbnz JSCell::m_flags[t0], MasqueradesAsUndefined, .masqueradesAsUndefined
727     move 0, t0
728     jmp .done
729 .masqueradesAsUndefined:
730     loadStructureWithScratch(t0, t2, t1)
731     loadp CodeBlock[cfr], t0
732     loadp CodeBlock::m_globalObject[t0], t0
733     cpeq Structure::m_globalObject[t2], t0, t0
734     jmp .done
735 .immediate:
736     andq ~TagBitUndefined, t0
737     cqeq t0, ValueNull, t0
738 .done:
739 end
740
741 _llint_op_eq_null:
742     traceExecution()
743     equalNullComparison()
744     loadisFromInstruction(1, t1)
745     orq ValueFalse, t0
746     storeq t0, [cfr, t1, 8]
747     dispatch(constexpr op_eq_null_length)
748
749
750 _llint_op_neq_null:
751     traceExecution()
752     equalNullComparison()
753     loadisFromInstruction(1, t1)
754     xorq ValueTrue, t0
755     storeq t0, [cfr, t1, 8]
756     dispatch(constexpr op_neq_null_length)
757
758
759 macro strictEq(equalityOperation, slowPath)
760     traceExecution()
761     loadisFromInstruction(3, t0)
762     loadisFromInstruction(2, t2)
763     loadConstantOrVariable(t0, t1)
764     loadConstantOrVariable(t2, t0)
765     move t0, t2
766     orq t1, t2
767     btqz t2, tagMask, .slow
768     bqaeq t0, tagTypeNumber, .leftOK
769     btqnz t0, tagTypeNumber, .slow
770 .leftOK:
771     bqaeq t1, tagTypeNumber, .rightOK
772     btqnz t1, tagTypeNumber, .slow
773 .rightOK:
774     equalityOperation(t0, t1, t0)
775     loadisFromInstruction(1, t1)
776     orq ValueFalse, t0
777     storeq t0, [cfr, t1, 8]
778     dispatch(4)
779
780 .slow:
781     callOpcodeSlowPath(slowPath)
782     dispatch(4)
783 end
784
785 _llint_op_stricteq:
786     strictEq(
787         macro (left, right, result) cqeq left, right, result end,
788         _slow_path_stricteq)
789
790
791 _llint_op_nstricteq:
792     strictEq(
793         macro (left, right, result) cqneq left, right, result end,
794         _slow_path_nstricteq)
795
796
797 macro preOp(arithmeticOperation, slowPath)
798     traceExecution()
799     loadisFromInstruction(1, t0)
800     loadq [cfr, t0, 8], t1
801     bqb t1, tagTypeNumber, .slow
802     arithmeticOperation(t1, .slow)
803     orq tagTypeNumber, t1
804     storeq t1, [cfr, t0, 8]
805     dispatch(2)
806
807 .slow:
808     callOpcodeSlowPath(slowPath)
809     dispatch(2)
810 end
811
812 _llint_op_inc:
813     preOp(
814         macro (value, slow) baddio 1, value, slow end,
815         _slow_path_inc)
816
817
818 _llint_op_dec:
819     preOp(
820         macro (value, slow) bsubio 1, value, slow end,
821         _slow_path_dec)
822
823
824 _llint_op_to_number:
825     traceExecution()
826     loadisFromInstruction(2, t0)
827     loadisFromInstruction(1, t1)
828     loadConstantOrVariable(t0, t2)
829     bqaeq t2, tagTypeNumber, .opToNumberIsImmediate
830     btqz t2, tagTypeNumber, .opToNumberSlow
831 .opToNumberIsImmediate:
832     storeq t2, [cfr, t1, 8]
833     valueProfile(t2, 3, t0)
834     dispatch(constexpr op_to_number_length)
835
836 .opToNumberSlow:
837     callOpcodeSlowPath(_slow_path_to_number)
838     dispatch(constexpr op_to_number_length)
839
840
841 _llint_op_to_string:
842     traceExecution()
843     loadisFromInstruction(2, t1)
844     loadisFromInstruction(1, t2)
845     loadConstantOrVariable(t1, t0)
846     btqnz t0, tagMask, .opToStringSlow
847     bbneq JSCell::m_type[t0], StringType, .opToStringSlow
848 .opToStringIsString:
849     storeq t0, [cfr, t2, 8]
850     dispatch(constexpr op_to_string_length)
851
852 .opToStringSlow:
853     callOpcodeSlowPath(_slow_path_to_string)
854     dispatch(constexpr op_to_string_length)
855
856
857 _llint_op_negate:
858     traceExecution()
859     loadisFromInstruction(2, t0)
860     loadisFromInstruction(1, t1)
861     loadConstantOrVariable(t0, t3)
862     loadisFromInstruction(3, t2)
863     bqb t3, tagTypeNumber, .opNegateNotInt
864     btiz t3, 0x7fffffff, .opNegateSlow
865     negi t3
866     ori ArithProfileInt, t2
867     orq tagTypeNumber, t3
868     storeisToInstruction(t2, 3)
869     storeq t3, [cfr, t1, 8]
870     dispatch(constexpr op_negate_length)
871 .opNegateNotInt:
872     btqz t3, tagTypeNumber, .opNegateSlow
873     xorq 0x8000000000000000, t3
874     ori ArithProfileNumber, t2
875     storeq t3, [cfr, t1, 8]
876     storeisToInstruction(t2, 3)
877     dispatch(constexpr op_negate_length)
878
879 .opNegateSlow:
880     callOpcodeSlowPath(_slow_path_negate)
881     dispatch(constexpr op_negate_length)
882
883
884 macro binaryOpCustomStore(integerOperationAndStore, doubleOperation, slowPath)
885     loadisFromInstruction(3, t0)
886     loadisFromInstruction(2, t2)
887     loadConstantOrVariable(t0, t1)
888     loadConstantOrVariable(t2, t0)
889     bqb t0, tagTypeNumber, .op1NotInt
890     bqb t1, tagTypeNumber, .op2NotInt
891     loadisFromInstruction(1, t2)
892     integerOperationAndStore(t1, t0, .slow, t2)
893     loadisFromInstruction(4, t1)
894     ori ArithProfileIntInt, t1
895     storeisToInstruction(t1, 4)
896     dispatch(5)
897
898 .op1NotInt:
899     # First operand is definitely not an int, the second operand could be anything.
900     btqz t0, tagTypeNumber, .slow
901     bqaeq t1, tagTypeNumber, .op1NotIntOp2Int
902     btqz t1, tagTypeNumber, .slow
903     addq tagTypeNumber, t1
904     fq2d t1, ft1
905     loadisFromInstruction(4, t2)
906     ori ArithProfileNumberNumber, t2
907     storeisToInstruction(t2, 4)
908     jmp .op1NotIntReady
909 .op1NotIntOp2Int:
910     loadisFromInstruction(4, t2)
911     ori ArithProfileNumberInt, t2
912     storeisToInstruction(t2, 4)
913     ci2d t1, ft1
914 .op1NotIntReady:
915     loadisFromInstruction(1, t2)
916     addq tagTypeNumber, t0
917     fq2d t0, ft0
918     doubleOperation(ft1, ft0)
919     fd2q ft0, t0
920     subq tagTypeNumber, t0
921     storeq t0, [cfr, t2, 8]
922     dispatch(5)
923
924 .op2NotInt:
925     # First operand is definitely an int, the second is definitely not.
926     loadisFromInstruction(1, t2)
927     btqz t1, tagTypeNumber, .slow
928     loadisFromInstruction(4, t3)
929     ori ArithProfileIntNumber, t3
930     storeisToInstruction(t3, 4)
931     ci2d t0, ft0
932     addq tagTypeNumber, t1
933     fq2d t1, ft1
934     doubleOperation(ft1, ft0)
935     fd2q ft0, t0
936     subq tagTypeNumber, t0
937     storeq t0, [cfr, t2, 8]
938     dispatch(5)
939
940 .slow:
941     callOpcodeSlowPath(slowPath)
942     dispatch(5)
943 end
944
945 macro binaryOp(integerOperation, doubleOperation, slowPath)
946     binaryOpCustomStore(
947         macro (left, right, slow, index)
948             integerOperation(left, right, slow)
949             orq tagTypeNumber, right
950             storeq right, [cfr, index, 8]
951         end,
952         doubleOperation, slowPath)
953 end
954
955 _llint_op_add:
956     traceExecution()
957     binaryOp(
958         macro (left, right, slow) baddio left, right, slow end,
959         macro (left, right) addd left, right end,
960         _slow_path_add)
961
962
963 _llint_op_mul:
964     traceExecution()
965     binaryOpCustomStore(
966         macro (left, right, slow, index)
967             # Assume t3 is scratchable.
968             move right, t3
969             bmulio left, t3, slow
970             btinz t3, .done
971             bilt left, 0, slow
972             bilt right, 0, slow
973         .done:
974             orq tagTypeNumber, t3
975             storeq t3, [cfr, index, 8]
976         end,
977         macro (left, right) muld left, right end,
978         _slow_path_mul)
979
980
981 _llint_op_sub:
982     traceExecution()
983     binaryOp(
984         macro (left, right, slow) bsubio left, right, slow end,
985         macro (left, right) subd left, right end,
986         _slow_path_sub)
987
988
989 _llint_op_div:
990     traceExecution()
991     if X86_64 or X86_64_WIN
992         binaryOpCustomStore(
993             macro (left, right, slow, index)
994                 # Assume t3 is scratchable.
995                 btiz left, slow
996                 bineq left, -1, .notNeg2TwoThe31DivByNeg1
997                 bieq right, -2147483648, .slow
998             .notNeg2TwoThe31DivByNeg1:
999                 btinz right, .intOK
1000                 bilt left, 0, slow
1001             .intOK:
1002                 move left, t3
1003                 move right, t0
1004                 cdqi
1005                 idivi t3
1006                 btinz t1, slow
1007                 orq tagTypeNumber, t0
1008                 storeq t0, [cfr, index, 8]
1009             end,
1010             macro (left, right) divd left, right end,
1011             _slow_path_div)
1012     else
1013         callOpcodeSlowPath(_slow_path_div)
1014         dispatch(constexpr op_div_length)
1015     end
1016
1017
1018 macro bitOp(operation, slowPath, advance)
1019     loadisFromInstruction(3, t0)
1020     loadisFromInstruction(2, t2)
1021     loadisFromInstruction(1, t3)
1022     loadConstantOrVariable(t0, t1)
1023     loadConstantOrVariable(t2, t0)
1024     bqb t0, tagTypeNumber, .slow
1025     bqb t1, tagTypeNumber, .slow
1026     operation(t1, t0)
1027     orq tagTypeNumber, t0
1028     storeq t0, [cfr, t3, 8]
1029     dispatch(advance)
1030
1031 .slow:
1032     callOpcodeSlowPath(slowPath)
1033     dispatch(advance)
1034 end
1035
1036 _llint_op_lshift:
1037     traceExecution()
1038     bitOp(
1039         macro (left, right) lshifti left, right end,
1040         _slow_path_lshift,
1041         constexpr op_lshift_length)
1042
1043
1044 _llint_op_rshift:
1045     traceExecution()
1046     bitOp(
1047         macro (left, right) rshifti left, right end,
1048         _slow_path_rshift,
1049         constexpr op_rshift_length)
1050
1051
1052 _llint_op_urshift:
1053     traceExecution()
1054     bitOp(
1055         macro (left, right) urshifti left, right end,
1056         _slow_path_urshift,
1057         constexpr op_urshift_length)
1058
1059
1060 _llint_op_unsigned:
1061     traceExecution()
1062     loadisFromInstruction(1, t0)
1063     loadisFromInstruction(2, t1)
1064     loadConstantOrVariable(t1, t2)
1065     bilt t2, 0, .opUnsignedSlow
1066     storeq t2, [cfr, t0, 8]
1067     dispatch(constexpr op_unsigned_length)
1068 .opUnsignedSlow:
1069     callOpcodeSlowPath(_slow_path_unsigned)
1070     dispatch(constexpr op_unsigned_length)
1071
1072
1073 _llint_op_bitand:
1074     traceExecution()
1075     bitOp(
1076         macro (left, right) andi left, right end,
1077         _slow_path_bitand,
1078         constexpr op_bitand_length)
1079
1080
1081 _llint_op_bitxor:
1082     traceExecution()
1083     bitOp(
1084         macro (left, right) xori left, right end,
1085         _slow_path_bitxor,
1086         constexpr op_bitxor_length)
1087
1088
1089 _llint_op_bitor:
1090     traceExecution()
1091     bitOp(
1092         macro (left, right) ori left, right end,
1093         _slow_path_bitor,
1094         constexpr op_bitor_length)
1095
1096
1097 _llint_op_overrides_has_instance:
1098     traceExecution()
1099     loadisFromInstruction(1, t3)
1100
1101     loadisFromInstruction(3, t1)
1102     loadConstantOrVariable(t1, t0)
1103     loadp CodeBlock[cfr], t2
1104     loadp CodeBlock::m_globalObject[t2], t2
1105     loadp JSGlobalObject::m_functionProtoHasInstanceSymbolFunction[t2], t2
1106     bqneq t0, t2, .opOverridesHasInstanceNotDefaultSymbol
1107
1108     loadisFromInstruction(2, t1)
1109     loadConstantOrVariable(t1, t0)
1110     tbz JSCell::m_flags[t0], ImplementsDefaultHasInstance, t1
1111     orq ValueFalse, t1
1112     storeq t1, [cfr, t3, 8]
1113     dispatch(constexpr op_overrides_has_instance_length)
1114
1115 .opOverridesHasInstanceNotDefaultSymbol:
1116     storeq ValueTrue, [cfr, t3, 8]
1117     dispatch(constexpr op_overrides_has_instance_length)
1118
1119
1120 _llint_op_instanceof_custom:
1121     traceExecution()
1122     callOpcodeSlowPath(_llint_slow_path_instanceof_custom)
1123     dispatch(constexpr op_instanceof_custom_length)
1124
1125
1126 _llint_op_is_empty:
1127     traceExecution()
1128     loadisFromInstruction(2, t1)
1129     loadisFromInstruction(1, t2)
1130     loadConstantOrVariable(t1, t0)
1131     cqeq t0, ValueEmpty, t3
1132     orq ValueFalse, t3
1133     storeq t3, [cfr, t2, 8]
1134     dispatch(constexpr op_is_empty_length)
1135
1136
1137 _llint_op_is_undefined:
1138     traceExecution()
1139     loadisFromInstruction(2, t1)
1140     loadisFromInstruction(1, t2)
1141     loadConstantOrVariable(t1, t0)
1142     btqz t0, tagMask, .opIsUndefinedCell
1143     cqeq t0, ValueUndefined, t3
1144     orq ValueFalse, t3
1145     storeq t3, [cfr, t2, 8]
1146     dispatch(constexpr op_is_undefined_length)
1147 .opIsUndefinedCell:
1148     btbnz JSCell::m_flags[t0], MasqueradesAsUndefined, .masqueradesAsUndefined
1149     move ValueFalse, t1
1150     storeq t1, [cfr, t2, 8]
1151     dispatch(constexpr op_is_undefined_length)
1152 .masqueradesAsUndefined:
1153     loadStructureWithScratch(t0, t3, t1)
1154     loadp CodeBlock[cfr], t1
1155     loadp CodeBlock::m_globalObject[t1], t1
1156     cpeq Structure::m_globalObject[t3], t1, t0
1157     orq ValueFalse, t0
1158     storeq t0, [cfr, t2, 8]
1159     dispatch(constexpr op_is_undefined_length)
1160
1161
1162 _llint_op_is_boolean:
1163     traceExecution()
1164     loadisFromInstruction(2, t1)
1165     loadisFromInstruction(1, t2)
1166     loadConstantOrVariable(t1, t0)
1167     xorq ValueFalse, t0
1168     tqz t0, ~1, t0
1169     orq ValueFalse, t0
1170     storeq t0, [cfr, t2, 8]
1171     dispatch(constexpr op_is_boolean_length)
1172
1173
1174 _llint_op_is_number:
1175     traceExecution()
1176     loadisFromInstruction(2, t1)
1177     loadisFromInstruction(1, t2)
1178     loadConstantOrVariable(t1, t0)
1179     tqnz t0, tagTypeNumber, t1
1180     orq ValueFalse, t1
1181     storeq t1, [cfr, t2, 8]
1182     dispatch(constexpr op_is_number_length)
1183
1184
1185 _llint_op_is_cell_with_type:
1186     traceExecution()
1187     loadisFromInstruction(3, t0)
1188     loadisFromInstruction(2, t1)
1189     loadisFromInstruction(1, t2)
1190     loadConstantOrVariable(t1, t3)
1191     btqnz t3, tagMask, .notCellCase
1192     cbeq JSCell::m_type[t3], t0, t1
1193     orq ValueFalse, t1
1194     storeq t1, [cfr, t2, 8]
1195     dispatch(constexpr op_is_cell_with_type_length)
1196 .notCellCase:
1197     storeq ValueFalse, [cfr, t2, 8]
1198     dispatch(constexpr op_is_cell_with_type_length)
1199
1200
1201 _llint_op_is_object:
1202     traceExecution()
1203     loadisFromInstruction(2, t1)
1204     loadisFromInstruction(1, t2)
1205     loadConstantOrVariable(t1, t0)
1206     btqnz t0, tagMask, .opIsObjectNotCell
1207     cbaeq JSCell::m_type[t0], ObjectType, t1
1208     orq ValueFalse, t1
1209     storeq t1, [cfr, t2, 8]
1210     dispatch(constexpr op_is_object_length)
1211 .opIsObjectNotCell:
1212     storeq ValueFalse, [cfr, t2, 8]
1213     dispatch(constexpr op_is_object_length)
1214
1215
1216 macro loadPropertyAtVariableOffset(propertyOffsetAsInt, objectAndStorage, value)
1217     bilt propertyOffsetAsInt, firstOutOfLineOffset, .isInline
1218     loadCaged(_g_jsValueGigacageBasePtr, JSObject::m_butterfly[objectAndStorage], objectAndStorage, value)
1219     negi propertyOffsetAsInt
1220     sxi2q propertyOffsetAsInt, propertyOffsetAsInt
1221     jmp .ready
1222 .isInline:
1223     addp sizeof JSObject - (firstOutOfLineOffset - 2) * 8, objectAndStorage
1224 .ready:
1225     loadq (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffsetAsInt, 8], value
1226 end
1227
1228
1229 macro storePropertyAtVariableOffset(propertyOffsetAsInt, objectAndStorage, value, scratch)
1230     bilt propertyOffsetAsInt, firstOutOfLineOffset, .isInline
1231     loadCaged(_g_jsValueGigacageBasePtr, JSObject::m_butterfly[objectAndStorage], objectAndStorage, scratch)
1232     negi propertyOffsetAsInt
1233     sxi2q propertyOffsetAsInt, propertyOffsetAsInt
1234     jmp .ready
1235 .isInline:
1236     addp sizeof JSObject - (firstOutOfLineOffset - 2) * 8, objectAndStorage
1237 .ready:
1238     storeq value, (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffsetAsInt, 8]
1239 end
1240
1241 _llint_op_get_by_id:
1242     traceExecution()
1243     loadisFromInstruction(2, t0)
1244     loadConstantOrVariableCell(t0, t3, .opGetByIdSlow)
1245     loadi JSCell::m_structureID[t3], t1
1246     loadisFromInstruction(4, t2)
1247     bineq t2, t1, .opGetByIdSlow
1248     loadisFromInstruction(5, t1)
1249     loadisFromInstruction(1, t2)
1250     loadPropertyAtVariableOffset(t1, t3, t0)
1251     storeq t0, [cfr, t2, 8]
1252     valueProfile(t0, 8, t1)
1253     dispatch(constexpr op_get_by_id_length)
1254
1255 .opGetByIdSlow:
1256     callOpcodeSlowPath(_llint_slow_path_get_by_id)
1257     dispatch(constexpr op_get_by_id_length)
1258
1259
1260 _llint_op_get_by_id_proto_load:
1261     traceExecution()
1262     loadisFromInstruction(2, t0)
1263     loadConstantOrVariableCell(t0, t3, .opGetByIdProtoSlow)
1264     loadi JSCell::m_structureID[t3], t1
1265     loadisFromInstruction(4, t2)
1266     bineq t2, t1, .opGetByIdProtoSlow
1267     loadisFromInstruction(5, t1)
1268     loadpFromInstruction(6, t3)
1269     loadisFromInstruction(1, t2)
1270     loadPropertyAtVariableOffset(t1, t3, t0)
1271     storeq t0, [cfr, t2, 8]
1272     valueProfile(t0, 8, t1)
1273     dispatch(constexpr op_get_by_id_proto_load_length)
1274
1275 .opGetByIdProtoSlow:
1276     callOpcodeSlowPath(_llint_slow_path_get_by_id)
1277     dispatch(constexpr op_get_by_id_proto_load_length)
1278
1279
1280 _llint_op_get_by_id_unset:
1281     traceExecution()
1282     loadisFromInstruction(2, t0)
1283     loadConstantOrVariableCell(t0, t3, .opGetByIdUnsetSlow)
1284     loadi JSCell::m_structureID[t3], t1
1285     loadisFromInstruction(4, t2)
1286     bineq t2, t1, .opGetByIdUnsetSlow
1287     loadisFromInstruction(1, t2)
1288     storeq ValueUndefined, [cfr, t2, 8]
1289     valueProfile(ValueUndefined, 8, t1)
1290     dispatch(constexpr op_get_by_id_unset_length)
1291
1292 .opGetByIdUnsetSlow:
1293     callOpcodeSlowPath(_llint_slow_path_get_by_id)
1294     dispatch(constexpr op_get_by_id_unset_length)
1295
1296
1297 _llint_op_get_array_length:
1298     traceExecution()
1299     loadisFromInstruction(2, t0)
1300     loadpFromInstruction(4, t1)
1301     loadConstantOrVariableCell(t0, t3, .opGetArrayLengthSlow)
1302     move t3, t2
1303     arrayProfile(t2, t1, t0)
1304     btiz t2, IsArray, .opGetArrayLengthSlow
1305     btiz t2, IndexingShapeMask, .opGetArrayLengthSlow
1306     loadisFromInstruction(1, t1)
1307     loadCaged(_g_jsValueGigacageBasePtr, JSObject::m_butterfly[t3], t0, t2)
1308     loadi -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], t0
1309     bilt t0, 0, .opGetArrayLengthSlow
1310     orq tagTypeNumber, t0
1311     valueProfile(t0, 8, t2)
1312     storeq t0, [cfr, t1, 8]
1313     dispatch(constexpr op_get_array_length_length)
1314
1315 .opGetArrayLengthSlow:
1316     callOpcodeSlowPath(_llint_slow_path_get_by_id)
1317     dispatch(constexpr op_get_array_length_length)
1318
1319
1320 _llint_op_put_by_id:
1321     traceExecution()
1322     loadisFromInstruction(1, t3)
1323     loadConstantOrVariableCell(t3, t0, .opPutByIdSlow)
1324     loadisFromInstruction(4, t2)
1325     bineq t2, JSCell::m_structureID[t0], .opPutByIdSlow
1326
1327     # At this point, we have:
1328     # t2 -> current structure ID
1329     # t0 -> object base
1330
1331     loadisFromInstruction(3, t1)
1332     loadConstantOrVariable(t1, t3)
1333
1334     loadpFromInstruction(8, t1)
1335
1336     # At this point, we have:
1337     # t0 -> object base
1338     # t1 -> put by id flags
1339     # t2 -> current structure ID
1340     # t3 -> value to put
1341
1342     btpnz t1, PutByIdPrimaryTypeMask, .opPutByIdTypeCheckObjectWithStructureOrOther
1343
1344     # We have one of the non-structure type checks. Find out which one.
1345     andp PutByIdSecondaryTypeMask, t1
1346     bplt t1, PutByIdSecondaryTypeString, .opPutByIdTypeCheckLessThanString
1347
1348     # We are one of the following: String, Symbol, Object, ObjectOrOther, Top
1349     bplt t1, PutByIdSecondaryTypeObjectOrOther, .opPutByIdTypeCheckLessThanObjectOrOther
1350
1351     # We are either ObjectOrOther or Top.
1352     bpeq t1, PutByIdSecondaryTypeTop, .opPutByIdDoneCheckingTypes
1353
1354     # Check if we are ObjectOrOther.
1355     btqz t3, tagMask, .opPutByIdTypeCheckObject
1356 .opPutByIdTypeCheckOther:
1357     andq ~TagBitUndefined, t3
1358     bqeq t3, ValueNull, .opPutByIdDoneCheckingTypes
1359     jmp .opPutByIdSlow
1360
1361 .opPutByIdTypeCheckLessThanObjectOrOther:
1362     # We are either String, Symbol or Object.
1363     btqnz t3, tagMask, .opPutByIdSlow
1364     bpeq t1, PutByIdSecondaryTypeObject, .opPutByIdTypeCheckObject
1365     bpeq t1, PutByIdSecondaryTypeSymbol, .opPutByIdTypeCheckSymbol
1366     bbeq JSCell::m_type[t3], StringType, .opPutByIdDoneCheckingTypes
1367     jmp .opPutByIdSlow
1368 .opPutByIdTypeCheckObject:
1369     bbaeq JSCell::m_type[t3], ObjectType, .opPutByIdDoneCheckingTypes
1370     jmp .opPutByIdSlow
1371 .opPutByIdTypeCheckSymbol:
1372     bbeq JSCell::m_type[t3], SymbolType, .opPutByIdDoneCheckingTypes
1373     jmp .opPutByIdSlow
1374
1375 .opPutByIdTypeCheckLessThanString:
1376     # We are one of the following: Bottom, Boolean, Other, Int32, Number
1377     bplt t1, PutByIdSecondaryTypeInt32, .opPutByIdTypeCheckLessThanInt32
1378
1379     # We are either Int32 or Number.
1380     bpeq t1, PutByIdSecondaryTypeNumber, .opPutByIdTypeCheckNumber
1381
1382     bqaeq t3, tagTypeNumber, .opPutByIdDoneCheckingTypes
1383     jmp .opPutByIdSlow
1384
1385 .opPutByIdTypeCheckNumber:
1386     btqnz t3, tagTypeNumber, .opPutByIdDoneCheckingTypes
1387     jmp .opPutByIdSlow
1388
1389 .opPutByIdTypeCheckLessThanInt32:
1390     # We are one of the following: Bottom, Boolean, Other.
1391     bpneq t1, PutByIdSecondaryTypeBoolean, .opPutByIdTypeCheckBottomOrOther
1392     xorq ValueFalse, t3
1393     btqz t3, ~1, .opPutByIdDoneCheckingTypes
1394     jmp .opPutByIdSlow
1395
1396 .opPutByIdTypeCheckBottomOrOther:
1397     bpeq t1, PutByIdSecondaryTypeOther, .opPutByIdTypeCheckOther
1398     jmp .opPutByIdSlow
1399
1400 .opPutByIdTypeCheckObjectWithStructureOrOther:
1401     btqz t3, tagMask, .opPutByIdTypeCheckObjectWithStructure
1402     btpnz t1, PutByIdPrimaryTypeObjectWithStructureOrOther, .opPutByIdTypeCheckOther
1403     jmp .opPutByIdSlow
1404
1405 .opPutByIdTypeCheckObjectWithStructure:
1406     urshiftp 3, t1
1407     bineq t1, JSCell::m_structureID[t3], .opPutByIdSlow
1408
1409 .opPutByIdDoneCheckingTypes:
1410     loadisFromInstruction(6, t1)
1411     
1412     btiz t1, .opPutByIdNotTransition
1413
1414     # This is the transition case. t1 holds the new structureID. t2 holds the old structure ID.
1415     # If we have a chain, we need to check it. t0 is the base. We may clobber t1 to use it as
1416     # scratch.
1417     loadpFromInstruction(7, t3)
1418     btpz t3, .opPutByIdTransitionDirect
1419
1420     loadp StructureChain::m_vector[t3], t3
1421     assert(macro (ok) btpnz t3, ok end)
1422
1423     structureIDToStructureWithScratch(t2, t1)
1424     loadq Structure::m_prototype[t2], t2
1425     bqeq t2, ValueNull, .opPutByIdTransitionChainDone
1426 .opPutByIdTransitionChainLoop:
1427     # At this point, t2 contains a prototye, and [t3] contains the Structure* that we want that
1428     # prototype to have. We don't want to have to load the Structure* for t2. Instead, we load
1429     # the Structure* from [t3], and then we compare its id to the id in the header of t2.
1430     loadp [t3], t1
1431     loadi JSCell::m_structureID[t2], t2
1432     # Now, t1 has the Structure* and t2 has the StructureID that we want that Structure* to have.
1433     bineq t2, Structure::m_blob + StructureIDBlob::u.fields.structureID[t1], .opPutByIdSlow
1434     addp 8, t3
1435     loadq Structure::m_prototype[t1], t2
1436     bqneq t2, ValueNull, .opPutByIdTransitionChainLoop
1437
1438 .opPutByIdTransitionChainDone:
1439     # Reload the new structure, since we clobbered it above.
1440     loadisFromInstruction(6, t1)
1441
1442 .opPutByIdTransitionDirect:
1443     storei t1, JSCell::m_structureID[t0]
1444     writeBarrierOnOperand(1)
1445     # Reload base into t0
1446     loadisFromInstruction(1, t1)
1447     loadConstantOrVariable(t1, t0)
1448
1449 .opPutByIdNotTransition:
1450     # The only thing live right now is t0, which holds the base.
1451     loadisFromInstruction(3, t1)
1452     loadConstantOrVariable(t1, t2)
1453     loadisFromInstruction(5, t1)
1454     storePropertyAtVariableOffset(t1, t0, t2, t3)
1455     writeBarrierOnOperands(1, 3)
1456     dispatch(constexpr op_put_by_id_length)
1457
1458 .opPutByIdSlow:
1459     callOpcodeSlowPath(_llint_slow_path_put_by_id)
1460     dispatch(constexpr op_put_by_id_length)
1461
1462 macro finishGetByVal(result, scratch)
1463     loadisFromInstruction(1, scratch)
1464     storeq result, [cfr, scratch, 8]
1465     valueProfile(result, 5, scratch)
1466     dispatch(6)
1467 end
1468
1469 macro finishIntGetByVal(result, scratch)
1470     orq tagTypeNumber, result
1471     finishGetByVal(result, scratch)
1472 end
1473
1474 macro finishDoubleGetByVal(result, scratch1, scratch2)
1475     fd2q result, scratch1
1476     subq tagTypeNumber, scratch1
1477     finishGetByVal(scratch1, scratch2)
1478 end
1479
1480 _llint_op_get_by_val:
1481     traceExecution()
1482     loadisFromInstruction(2, t2)
1483     loadConstantOrVariableCell(t2, t0, .opGetByValSlow)
1484     loadpFromInstruction(4, t3)
1485     move t0, t2
1486     arrayProfile(t2, t3, t1)
1487     loadisFromInstruction(3, t3)
1488     loadConstantOrVariableInt32(t3, t1, .opGetByValSlow)
1489     sxi2q t1, t1
1490     loadCaged(_g_jsValueGigacageBasePtr, JSObject::m_butterfly[t0], t3, t5)
1491     andi IndexingShapeMask, t2
1492     bieq t2, Int32Shape, .opGetByValIsContiguous
1493     bineq t2, ContiguousShape, .opGetByValNotContiguous
1494 .opGetByValIsContiguous:
1495
1496     biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t3], .opGetByValOutOfBounds
1497     loadisFromInstruction(1, t0)
1498     loadq [t3, t1, 8], t2
1499     btqz t2, .opGetByValOutOfBounds
1500     jmp .opGetByValDone
1501
1502 .opGetByValNotContiguous:
1503     bineq t2, DoubleShape, .opGetByValNotDouble
1504     biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t3], .opGetByValOutOfBounds
1505     loadis 8[PB, PC, 8], t0
1506     loadd [t3, t1, 8], ft0
1507     bdnequn ft0, ft0, .opGetByValOutOfBounds
1508     fd2q ft0, t2
1509     subq tagTypeNumber, t2
1510     jmp .opGetByValDone
1511     
1512 .opGetByValNotDouble:
1513     subi ArrayStorageShape, t2
1514     bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
1515     biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValOutOfBounds
1516     loadisFromInstruction(1, t0)
1517     loadq ArrayStorage::m_vector[t3, t1, 8], t2
1518     btqz t2, .opGetByValOutOfBounds
1519
1520 .opGetByValDone:
1521     storeq t2, [cfr, t0, 8]
1522     valueProfile(t2, 5, t0)
1523     dispatch(constexpr op_get_by_val_length)
1524
1525 .opGetByValOutOfBounds:
1526     loadpFromInstruction(4, t0)
1527     storeb 1, ArrayProfile::m_outOfBounds[t0]
1528     jmp .opGetByValSlow
1529
1530 .opGetByValNotIndexedStorage:
1531     # First lets check if we even have a typed array. This lets us do some boilerplate up front.
1532     loadb JSCell::m_type[t0], t2
1533     subi FirstArrayType, t2
1534     bia t2, LastArrayType - FirstArrayType, .opGetByValSlow
1535     
1536     # Sweet, now we know that we have a typed array. Do some basic things now.
1537     loadCaged(_g_primitiveGigacageBasePtr, JSArrayBufferView::m_vector[t0], t3, t5)
1538     biaeq t1, JSArrayBufferView::m_length[t0], .opGetByValSlow
1539     
1540     # Now bisect through the various types. Note that we can treat Uint8ArrayType and
1541     # Uint8ClampedArrayType the same.
1542     bia t2, Uint8ClampedArrayType - FirstArrayType, .opGetByValAboveUint8ClampedArray
1543     
1544     # We have one of Int8ArrayType .. Uint8ClampedArrayType.
1545     bia t2, Int16ArrayType - FirstArrayType, .opGetByValInt32ArrayOrUint8Array
1546     
1547     # We have one of Int8ArrayType or Int16ArrayType
1548     bineq t2, Int8ArrayType - FirstArrayType, .opGetByValInt16Array
1549     
1550     # We have Int8ArrayType
1551     loadbs [t3, t1], t0
1552     finishIntGetByVal(t0, t1)
1553
1554 .opGetByValInt16Array:
1555     loadhs [t3, t1, 2], t0
1556     finishIntGetByVal(t0, t1)
1557
1558 .opGetByValInt32ArrayOrUint8Array:
1559     # We have one of Int16Array, Uint8Array, or Uint8ClampedArray.
1560     bieq t2, Int32ArrayType - FirstArrayType, .opGetByValInt32Array
1561     
1562     # We have either Uint8Array or Uint8ClampedArray. They behave the same so that's cool.
1563     loadb [t3, t1], t0
1564     finishIntGetByVal(t0, t1)
1565
1566 .opGetByValInt32Array:
1567     loadi [t3, t1, 4], t0
1568     finishIntGetByVal(t0, t1)
1569
1570 .opGetByValAboveUint8ClampedArray:
1571     # We have one of Uint16ArrayType .. Float64ArrayType.
1572     bia t2, Uint32ArrayType - FirstArrayType, .opGetByValAboveUint32Array
1573     
1574     # We have either Uint16ArrayType or Uint32ArrayType.
1575     bieq t2, Uint32ArrayType - FirstArrayType, .opGetByValUint32Array
1576
1577     # We have Uint16ArrayType.
1578     loadh [t3, t1, 2], t0
1579     finishIntGetByVal(t0, t1)
1580
1581 .opGetByValUint32Array:
1582     # This is the hardest part because of large unsigned values.
1583     loadi [t3, t1, 4], t0
1584     bilt t0, 0, .opGetByValSlow # This case is still awkward to implement in LLInt.
1585     finishIntGetByVal(t0, t1)
1586
1587 .opGetByValAboveUint32Array:
1588     # We have one of Float32ArrayType or Float64ArrayType. Sadly, we cannot handle Float32Array
1589     # inline yet. That would require some offlineasm changes.
1590     bieq t2, Float32ArrayType - FirstArrayType, .opGetByValSlow
1591
1592     # We have Float64ArrayType.
1593     loadd [t3, t1, 8], ft0
1594     bdnequn ft0, ft0, .opGetByValSlow
1595     finishDoubleGetByVal(ft0, t0, t1)
1596
1597 .opGetByValSlow:
1598     callOpcodeSlowPath(_llint_slow_path_get_by_val)
1599     dispatch(constexpr op_get_by_val_length)
1600
1601
1602 macro contiguousPutByVal(storeCallback)
1603     biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], .outOfBounds
1604 .storeResult:
1605     loadisFromInstruction(3, t2)
1606     storeCallback(t2, t1, [t0, t3, 8])
1607     dispatch(5)
1608
1609 .outOfBounds:
1610     biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t0], .opPutByValOutOfBounds
1611     loadp 32[PB, PC, 8], t2
1612     storeb 1, ArrayProfile::m_mayStoreToHole[t2]
1613     addi 1, t3, t2
1614     storei t2, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0]
1615     jmp .storeResult
1616 end
1617
1618 macro putByVal(slowPath)
1619     traceExecution()
1620     loadisFromInstruction(1, t0)
1621     loadConstantOrVariableCell(t0, t1, .opPutByValSlow)
1622     loadpFromInstruction(4, t3)
1623     move t1, t2
1624     arrayProfile(t2, t3, t0)
1625     loadisFromInstruction(2, t0)
1626     loadConstantOrVariableInt32(t0, t3, .opPutByValSlow)
1627     sxi2q t3, t3
1628     loadCaged(_g_jsValueGigacageBasePtr, JSObject::m_butterfly[t1], t0, t5)
1629     andi IndexingShapeMask, t2
1630     bineq t2, Int32Shape, .opPutByValNotInt32
1631     contiguousPutByVal(
1632         macro (operand, scratch, address)
1633             loadConstantOrVariable(operand, scratch)
1634             bpb scratch, tagTypeNumber, .opPutByValSlow
1635             storep scratch, address
1636             writeBarrierOnOperands(1, 3)
1637         end)
1638
1639 .opPutByValNotInt32:
1640     bineq t2, DoubleShape, .opPutByValNotDouble
1641     contiguousPutByVal(
1642         macro (operand, scratch, address)
1643             loadConstantOrVariable(operand, scratch)
1644             bqb scratch, tagTypeNumber, .notInt
1645             ci2d scratch, ft0
1646             jmp .ready
1647         .notInt:
1648             addp tagTypeNumber, scratch
1649             fq2d scratch, ft0
1650             bdnequn ft0, ft0, .opPutByValSlow
1651         .ready:
1652             stored ft0, address
1653             writeBarrierOnOperands(1, 3)
1654         end)
1655
1656 .opPutByValNotDouble:
1657     bineq t2, ContiguousShape, .opPutByValNotContiguous
1658     contiguousPutByVal(
1659         macro (operand, scratch, address)
1660             loadConstantOrVariable(operand, scratch)
1661             storep scratch, address
1662             writeBarrierOnOperands(1, 3)
1663         end)
1664
1665 .opPutByValNotContiguous:
1666     bineq t2, ArrayStorageShape, .opPutByValSlow
1667     biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t0], .opPutByValOutOfBounds
1668     btqz ArrayStorage::m_vector[t0, t3, 8], .opPutByValArrayStorageEmpty
1669 .opPutByValArrayStorageStoreResult:
1670     loadisFromInstruction(3, t2)
1671     loadConstantOrVariable(t2, t1)
1672     storeq t1, ArrayStorage::m_vector[t0, t3, 8]
1673     writeBarrierOnOperands(1, 3)
1674     dispatch(5)
1675
1676 .opPutByValArrayStorageEmpty:
1677     loadpFromInstruction(4, t1)
1678     storeb 1, ArrayProfile::m_mayStoreToHole[t1]
1679     addi 1, ArrayStorage::m_numValuesInVector[t0]
1680     bib t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], .opPutByValArrayStorageStoreResult
1681     addi 1, t3, t1
1682     storei t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0]
1683     jmp .opPutByValArrayStorageStoreResult
1684
1685 .opPutByValOutOfBounds:
1686     loadpFromInstruction(4, t0)
1687     storeb 1, ArrayProfile::m_outOfBounds[t0]
1688 .opPutByValSlow:
1689     callOpcodeSlowPath(slowPath)
1690     dispatch(5)
1691 end
1692
1693 _llint_op_put_by_val:
1694     putByVal(_llint_slow_path_put_by_val)
1695
1696 _llint_op_put_by_val_direct:
1697     putByVal(_llint_slow_path_put_by_val_direct)
1698
1699
1700 _llint_op_jmp:
1701     traceExecution()
1702     dispatchIntIndirect(1)
1703
1704
1705 macro jumpTrueOrFalse(conditionOp, slow)
1706     loadisFromInstruction(1, t1)
1707     loadConstantOrVariable(t1, t0)
1708     xorq ValueFalse, t0
1709     btqnz t0, -1, .slow
1710     conditionOp(t0, .target)
1711     dispatch(3)
1712
1713 .target:
1714     dispatchIntIndirect(2)
1715
1716 .slow:
1717     callOpcodeSlowPath(slow)
1718     dispatch(0)
1719 end
1720
1721
1722 macro equalNull(cellHandler, immediateHandler)
1723     loadisFromInstruction(1, t0)
1724     assertNotConstant(t0)
1725     loadq [cfr, t0, 8], t0
1726     btqnz t0, tagMask, .immediate
1727     loadStructureWithScratch(t0, t2, t1)
1728     cellHandler(t2, JSCell::m_flags[t0], .target)
1729     dispatch(3)
1730
1731 .target:
1732     dispatchIntIndirect(2)
1733
1734 .immediate:
1735     andq ~TagBitUndefined, t0
1736     immediateHandler(t0, .target)
1737     dispatch(3)
1738 end
1739
1740 _llint_op_jeq_null:
1741     traceExecution()
1742     equalNull(
1743         macro (structure, value, target) 
1744             btbz value, MasqueradesAsUndefined, .notMasqueradesAsUndefined
1745             loadp CodeBlock[cfr], t0
1746             loadp CodeBlock::m_globalObject[t0], t0
1747             bpeq Structure::m_globalObject[structure], t0, target
1748 .notMasqueradesAsUndefined:
1749         end,
1750         macro (value, target) bqeq value, ValueNull, target end)
1751
1752
1753 _llint_op_jneq_null:
1754     traceExecution()
1755     equalNull(
1756         macro (structure, value, target) 
1757             btbz value, MasqueradesAsUndefined, target
1758             loadp CodeBlock[cfr], t0
1759             loadp CodeBlock::m_globalObject[t0], t0
1760             bpneq Structure::m_globalObject[structure], t0, target
1761         end,
1762         macro (value, target) bqneq value, ValueNull, target end)
1763
1764
1765 _llint_op_jneq_ptr:
1766     traceExecution()
1767     loadisFromInstruction(1, t0)
1768     loadisFromInstruction(2, t1)
1769     loadp CodeBlock[cfr], t2
1770     loadp CodeBlock::m_globalObject[t2], t2
1771     loadp JSGlobalObject::m_specialPointers[t2, t1, 8], t1
1772     bpneq t1, [cfr, t0, 8], .opJneqPtrTarget
1773     dispatch(5)
1774
1775 .opJneqPtrTarget:
1776     storei 1, 32[PB, PC, 8]
1777     dispatchIntIndirect(3)
1778
1779
1780 macro compare(integerCompare, doubleCompare, slowPath)
1781     loadisFromInstruction(1, t2)
1782     loadisFromInstruction(2, t3)
1783     loadConstantOrVariable(t2, t0)
1784     loadConstantOrVariable(t3, t1)
1785     bqb t0, tagTypeNumber, .op1NotInt
1786     bqb t1, tagTypeNumber, .op2NotInt
1787     integerCompare(t0, t1, .jumpTarget)
1788     dispatch(4)
1789
1790 .op1NotInt:
1791     btqz t0, tagTypeNumber, .slow
1792     bqb t1, tagTypeNumber, .op1NotIntOp2NotInt
1793     ci2d t1, ft1
1794     jmp .op1NotIntReady
1795 .op1NotIntOp2NotInt:
1796     btqz t1, tagTypeNumber, .slow
1797     addq tagTypeNumber, t1
1798     fq2d t1, ft1
1799 .op1NotIntReady:
1800     addq tagTypeNumber, t0
1801     fq2d t0, ft0
1802     doubleCompare(ft0, ft1, .jumpTarget)
1803     dispatch(4)
1804
1805 .op2NotInt:
1806     ci2d t0, ft0
1807     btqz t1, tagTypeNumber, .slow
1808     addq tagTypeNumber, t1
1809     fq2d t1, ft1
1810     doubleCompare(ft0, ft1, .jumpTarget)
1811     dispatch(4)
1812
1813 .jumpTarget:
1814     dispatchIntIndirect(3)
1815
1816 .slow:
1817     callOpcodeSlowPath(slowPath)
1818     dispatch(0)
1819 end
1820
1821
1822 _llint_op_switch_imm:
1823     traceExecution()
1824     loadisFromInstruction(3, t2)
1825     loadisFromInstruction(1, t3)
1826     loadConstantOrVariable(t2, t1)
1827     loadp CodeBlock[cfr], t2
1828     loadp CodeBlock::m_rareData[t2], t2
1829     muli sizeof SimpleJumpTable, t3    # FIXME: would be nice to peephole this!
1830     loadp CodeBlock::RareData::m_switchJumpTables + VectorBufferOffset[t2], t2
1831     addp t3, t2
1832     bqb t1, tagTypeNumber, .opSwitchImmNotInt
1833     subi SimpleJumpTable::min[t2], t1
1834     biaeq t1, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchImmFallThrough
1835     loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t3
1836     loadis [t3, t1, 4], t1
1837     btiz t1, .opSwitchImmFallThrough
1838     dispatch(t1)
1839
1840 .opSwitchImmNotInt:
1841     btqnz t1, tagTypeNumber, .opSwitchImmSlow   # Go slow if it's a double.
1842 .opSwitchImmFallThrough:
1843     dispatchIntIndirect(2)
1844
1845 .opSwitchImmSlow:
1846     callOpcodeSlowPath(_llint_slow_path_switch_imm)
1847     dispatch(0)
1848
1849
1850 _llint_op_switch_char:
1851     traceExecution()
1852     loadisFromInstruction(3, t2)
1853     loadisFromInstruction(1, t3)
1854     loadConstantOrVariable(t2, t1)
1855     loadp CodeBlock[cfr], t2
1856     loadp CodeBlock::m_rareData[t2], t2
1857     muli sizeof SimpleJumpTable, t3
1858     loadp CodeBlock::RareData::m_switchJumpTables + VectorBufferOffset[t2], t2
1859     addp t3, t2
1860     btqnz t1, tagMask, .opSwitchCharFallThrough
1861     bbneq JSCell::m_type[t1], StringType, .opSwitchCharFallThrough
1862     bineq JSString::m_length[t1], 1, .opSwitchCharFallThrough
1863     loadp JSString::m_value[t1], t0
1864     btpz  t0, .opSwitchOnRope
1865     loadp StringImpl::m_data8[t0], t1
1866     btinz StringImpl::m_hashAndFlags[t0], HashFlags8BitBuffer, .opSwitchChar8Bit
1867     loadh [t1], t0
1868     jmp .opSwitchCharReady
1869 .opSwitchChar8Bit:
1870     loadb [t1], t0
1871 .opSwitchCharReady:
1872     subi SimpleJumpTable::min[t2], t0
1873     biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchCharFallThrough
1874     loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t2
1875     loadis [t2, t0, 4], t1
1876     btiz t1, .opSwitchCharFallThrough
1877     dispatch(t1)
1878
1879 .opSwitchCharFallThrough:
1880     dispatchIntIndirect(2)
1881
1882 .opSwitchOnRope:
1883     callOpcodeSlowPath(_llint_slow_path_switch_char)
1884     dispatch(0)
1885
1886
1887 macro arrayProfileForCall()
1888     loadisFromInstruction(4, t3)
1889     negp t3
1890     loadq ThisArgumentOffset[cfr, t3, 8], t0
1891     btqnz t0, tagMask, .done
1892     loadpFromInstruction((CallOpCodeSize - 2), t1)
1893     loadi JSCell::m_structureID[t0], t3
1894     storei t3, ArrayProfile::m_lastSeenStructureID[t1]
1895 .done:
1896 end
1897
1898 macro doCall(slowPath, prepareCall)
1899     loadisFromInstruction(2, t0)
1900     loadpFromInstruction(5, t1)
1901     loadp LLIntCallLinkInfo::callee[t1], t2
1902     loadConstantOrVariable(t0, t3)
1903     bqneq t3, t2, .opCallSlow
1904     loadisFromInstruction(4, t3)
1905     lshifti 3, t3
1906     negp t3
1907     addp cfr, t3
1908     storeq t2, Callee[t3]
1909     loadisFromInstruction(3, t2)
1910     storei PC, ArgumentCount + TagOffset[cfr]
1911     storei t2, ArgumentCount + PayloadOffset[t3]
1912     move t3, sp
1913     prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4)
1914     callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1])
1915
1916 .opCallSlow:
1917     slowPathForCall(slowPath, prepareCall)
1918 end
1919
1920 _llint_op_ret:
1921     traceExecution()
1922     checkSwitchToJITForEpilogue()
1923     loadisFromInstruction(1, t2)
1924     loadConstantOrVariable(t2, r0)
1925     doReturn()
1926
1927
1928 _llint_op_to_primitive:
1929     traceExecution()
1930     loadisFromInstruction(2, t2)
1931     loadisFromInstruction(1, t3)
1932     loadConstantOrVariable(t2, t0)
1933     btqnz t0, tagMask, .opToPrimitiveIsImm
1934     bbaeq JSCell::m_type[t0], ObjectType, .opToPrimitiveSlowCase
1935 .opToPrimitiveIsImm:
1936     storeq t0, [cfr, t3, 8]
1937     dispatch(constexpr op_to_primitive_length)
1938
1939 .opToPrimitiveSlowCase:
1940     callOpcodeSlowPath(_slow_path_to_primitive)
1941     dispatch(constexpr op_to_primitive_length)
1942
1943
1944 _llint_op_catch:
1945     # This is where we end up from the JIT's throw trampoline (because the
1946     # machine code return address will be set to _llint_op_catch), and from
1947     # the interpreter's throw trampoline (see _llint_throw_trampoline).
1948     # The throwing code must have known that we were throwing to the interpreter,
1949     # and have set VM::targetInterpreterPCForThrow.
1950     loadp Callee[cfr], t3
1951     andp MarkedBlockMask, t3
1952     loadp MarkedBlock::m_vm[t3], t3
1953     restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0)
1954     loadp VM::callFrameForCatch[t3], cfr
1955     storep 0, VM::callFrameForCatch[t3]
1956     restoreStackPointerAfterCall()
1957
1958     loadp CodeBlock[cfr], PB
1959     loadp CodeBlock::m_instructions[PB], PB
1960     loadp VM::targetInterpreterPCForThrow[t3], PC
1961     subp PB, PC
1962     rshiftp 3, PC
1963
1964     callOpcodeSlowPath(_llint_slow_path_check_if_exception_is_uncatchable_and_notify_profiler)
1965     bpeq r1, 0, .isCatchableException
1966     jmp _llint_throw_from_slow_path_trampoline
1967
1968 .isCatchableException:
1969     loadp Callee[cfr], t3
1970     andp MarkedBlockMask, t3
1971     loadp MarkedBlock::m_vm[t3], t3
1972
1973     loadq VM::m_exception[t3], t0
1974     storeq 0, VM::m_exception[t3]
1975     loadisFromInstruction(1, t2)
1976     storeq t0, [cfr, t2, 8]
1977
1978     loadq Exception::m_value[t0], t3
1979     loadisFromInstruction(2, t2)
1980     storeq t3, [cfr, t2, 8]
1981
1982     traceExecution()
1983     dispatch(constexpr op_catch_length)
1984
1985
1986 _llint_op_end:
1987     traceExecution()
1988     checkSwitchToJITForEpilogue()
1989     loadisFromInstruction(1, t0)
1990     assertNotConstant(t0)
1991     loadq [cfr, t0, 8], r0
1992     doReturn()
1993
1994
1995 _llint_throw_from_slow_path_trampoline:
1996     loadp Callee[cfr], t1
1997     andp MarkedBlockMask, t1
1998     loadp MarkedBlock::m_vm[t1], t1
1999     copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(t1, t2)
2000
2001     callSlowPath(_llint_slow_path_handle_exception)
2002
2003     # When throwing from the interpreter (i.e. throwing from LLIntSlowPaths), so
2004     # the throw target is not necessarily interpreted code, we come to here.
2005     # This essentially emulates the JIT's throwing protocol.
2006     loadp Callee[cfr], t1
2007     andp MarkedBlockMask, t1
2008     loadp MarkedBlock::m_vm[t1], t1
2009     jmp VM::targetMachinePCForThrow[t1]
2010
2011
2012 _llint_throw_during_call_trampoline:
2013     preserveReturnAddressAfterCall(t2)
2014     jmp _llint_throw_from_slow_path_trampoline
2015
2016
2017 macro nativeCallTrampoline(executableOffsetToFunction)
2018
2019     functionPrologue()
2020     storep 0, CodeBlock[cfr]
2021     loadp Callee[cfr], t0
2022     andp MarkedBlockMask, t0, t1
2023     loadp MarkedBlock::m_vm[t1], t1
2024     storep cfr, VM::topCallFrame[t1]
2025     if ARM64 or C_LOOP
2026         storep lr, ReturnPC[cfr]
2027     end
2028     move cfr, a0
2029     loadp Callee[cfr], t1
2030     loadp JSFunction::m_executable[t1], t1
2031     checkStackPointerAlignment(t3, 0xdead0001)
2032     if C_LOOP
2033         cloopCallNative executableOffsetToFunction[t1]
2034     else
2035         if X86_64_WIN
2036             subp 32, sp
2037         end
2038         call executableOffsetToFunction[t1]
2039         if X86_64_WIN
2040             addp 32, sp
2041         end
2042     end
2043
2044     loadp Callee[cfr], t3
2045     andp MarkedBlockMask, t3
2046     loadp MarkedBlock::m_vm[t3], t3
2047
2048     btqnz VM::m_exception[t3], .handleException
2049
2050     functionEpilogue()
2051     ret
2052
2053 .handleException:
2054     storep cfr, VM::topCallFrame[t3]
2055     jmp _llint_throw_from_slow_path_trampoline
2056 end
2057
2058 macro getConstantScope(dst)
2059     loadpFromInstruction(6, t0)
2060     loadisFromInstruction(dst, t1)
2061     storeq t0, [cfr, t1, 8]
2062 end
2063
2064 macro varInjectionCheck(slowPath)
2065     loadp CodeBlock[cfr], t0
2066     loadp CodeBlock::m_globalObject[t0], t0
2067     loadp JSGlobalObject::m_varInjectionWatchpoint[t0], t0
2068     bbeq WatchpointSet::m_state[t0], IsInvalidated, slowPath
2069 end
2070
2071 macro resolveScope()
2072     loadisFromInstruction(5, t2)
2073     loadisFromInstruction(2, t0)
2074     loadp [cfr, t0, 8], t0
2075     btiz t2, .resolveScopeLoopEnd
2076
2077 .resolveScopeLoop:
2078     loadp JSScope::m_next[t0], t0
2079     subi 1, t2
2080     btinz t2, .resolveScopeLoop
2081
2082 .resolveScopeLoopEnd:
2083     loadisFromInstruction(1, t1)
2084     storeq t0, [cfr, t1, 8]
2085 end
2086
2087
2088 _llint_op_resolve_scope:
2089     traceExecution()
2090     loadisFromInstruction(4, t0)
2091
2092 #rGlobalProperty:
2093     bineq t0, GlobalProperty, .rGlobalVar
2094     getConstantScope(1)
2095     dispatch(constexpr op_resolve_scope_length)
2096
2097 .rGlobalVar:
2098     bineq t0, GlobalVar, .rGlobalLexicalVar
2099     getConstantScope(1)
2100     dispatch(constexpr op_resolve_scope_length)
2101
2102 .rGlobalLexicalVar:
2103     bineq t0, GlobalLexicalVar, .rClosureVar
2104     getConstantScope(1)
2105     dispatch(constexpr op_resolve_scope_length)
2106
2107 .rClosureVar:
2108     bineq t0, ClosureVar, .rModuleVar
2109     resolveScope()
2110     dispatch(constexpr op_resolve_scope_length)
2111
2112 .rModuleVar:
2113     bineq t0, ModuleVar, .rGlobalPropertyWithVarInjectionChecks
2114     getConstantScope(1)
2115     dispatch(constexpr op_resolve_scope_length)
2116
2117 .rGlobalPropertyWithVarInjectionChecks:
2118     bineq t0, GlobalPropertyWithVarInjectionChecks, .rGlobalVarWithVarInjectionChecks
2119     varInjectionCheck(.rDynamic)
2120     getConstantScope(1)
2121     dispatch(constexpr op_resolve_scope_length)
2122
2123 .rGlobalVarWithVarInjectionChecks:
2124     bineq t0, GlobalVarWithVarInjectionChecks, .rGlobalLexicalVarWithVarInjectionChecks
2125     varInjectionCheck(.rDynamic)
2126     getConstantScope(1)
2127     dispatch(constexpr op_resolve_scope_length)
2128
2129 .rGlobalLexicalVarWithVarInjectionChecks:
2130     bineq t0, GlobalLexicalVarWithVarInjectionChecks, .rClosureVarWithVarInjectionChecks
2131     varInjectionCheck(.rDynamic)
2132     getConstantScope(1)
2133     dispatch(constexpr op_resolve_scope_length)
2134
2135 .rClosureVarWithVarInjectionChecks:
2136     bineq t0, ClosureVarWithVarInjectionChecks, .rDynamic
2137     varInjectionCheck(.rDynamic)
2138     resolveScope()
2139     dispatch(constexpr op_resolve_scope_length)
2140
2141 .rDynamic:
2142     callOpcodeSlowPath(_slow_path_resolve_scope)
2143     dispatch(constexpr op_resolve_scope_length)
2144
2145
2146 macro loadWithStructureCheck(operand, slowPath)
2147     loadisFromInstruction(operand, t0)
2148     loadq [cfr, t0, 8], t0
2149     loadStructureWithScratch(t0, t2, t1)
2150     loadpFromInstruction(5, t1)
2151     bpneq t2, t1, slowPath
2152 end
2153
2154 macro getProperty()
2155     loadisFromInstruction(6, t1)
2156     loadPropertyAtVariableOffset(t1, t0, t2)
2157     valueProfile(t2, 7, t0)
2158     loadisFromInstruction(1, t0)
2159     storeq t2, [cfr, t0, 8]
2160 end
2161
2162 macro getGlobalVar(tdzCheckIfNecessary)
2163     loadpFromInstruction(6, t0)
2164     loadq [t0], t0
2165     tdzCheckIfNecessary(t0)
2166     valueProfile(t0, 7, t1)
2167     loadisFromInstruction(1, t1)
2168     storeq t0, [cfr, t1, 8]
2169 end
2170
2171 macro getClosureVar()
2172     loadisFromInstruction(6, t1)
2173     loadq JSEnvironmentRecord_variables[t0, t1, 8], t0
2174     valueProfile(t0, 7, t1)
2175     loadisFromInstruction(1, t1)
2176     storeq t0, [cfr, t1, 8]
2177 end
2178
2179 _llint_op_get_from_scope:
2180     traceExecution()
2181     loadisFromInstruction(4, t0)
2182     andi ResolveTypeMask, t0
2183
2184 #gGlobalProperty:
2185     bineq t0, GlobalProperty, .gGlobalVar
2186     loadWithStructureCheck(2, .gDynamic)
2187     getProperty()
2188     dispatch(constexpr op_get_from_scope_length)
2189
2190 .gGlobalVar:
2191     bineq t0, GlobalVar, .gGlobalLexicalVar
2192     getGlobalVar(macro(v) end)
2193     dispatch(constexpr op_get_from_scope_length)
2194
2195 .gGlobalLexicalVar:
2196     bineq t0, GlobalLexicalVar, .gClosureVar
2197     getGlobalVar(
2198         macro (value)
2199             bqeq value, ValueEmpty, .gDynamic
2200         end)
2201     dispatch(constexpr op_get_from_scope_length)
2202
2203 .gClosureVar:
2204     bineq t0, ClosureVar, .gGlobalPropertyWithVarInjectionChecks
2205     loadVariable(2, t0)
2206     getClosureVar()
2207     dispatch(constexpr op_get_from_scope_length)
2208
2209 .gGlobalPropertyWithVarInjectionChecks:
2210     bineq t0, GlobalPropertyWithVarInjectionChecks, .gGlobalVarWithVarInjectionChecks
2211     loadWithStructureCheck(2, .gDynamic)
2212     getProperty()
2213     dispatch(constexpr op_get_from_scope_length)
2214
2215 .gGlobalVarWithVarInjectionChecks:
2216     bineq t0, GlobalVarWithVarInjectionChecks, .gGlobalLexicalVarWithVarInjectionChecks
2217     varInjectionCheck(.gDynamic)
2218     getGlobalVar(macro(v) end)
2219     dispatch(constexpr op_get_from_scope_length)
2220
2221 .gGlobalLexicalVarWithVarInjectionChecks:
2222     bineq t0, GlobalLexicalVarWithVarInjectionChecks, .gClosureVarWithVarInjectionChecks
2223     varInjectionCheck(.gDynamic)
2224     getGlobalVar(
2225         macro (value)
2226             bqeq value, ValueEmpty, .gDynamic
2227         end)
2228     dispatch(constexpr op_get_from_scope_length)
2229
2230 .gClosureVarWithVarInjectionChecks:
2231     bineq t0, ClosureVarWithVarInjectionChecks, .gDynamic
2232     varInjectionCheck(.gDynamic)
2233     loadVariable(2, t0)
2234     getClosureVar()
2235     dispatch(constexpr op_get_from_scope_length)
2236
2237 .gDynamic:
2238     callOpcodeSlowPath(_llint_slow_path_get_from_scope)
2239     dispatch(constexpr op_get_from_scope_length)
2240
2241
2242 macro putProperty()
2243     loadisFromInstruction(3, t1)
2244     loadConstantOrVariable(t1, t2)
2245     loadisFromInstruction(6, t1)
2246     storePropertyAtVariableOffset(t1, t0, t2, t3)
2247 end
2248
2249 macro putGlobalVariable()
2250     loadisFromInstruction(3, t0)
2251     loadConstantOrVariable(t0, t1)
2252     loadpFromInstruction(5, t2)
2253     loadpFromInstruction(6, t0)
2254     notifyWrite(t2, .pDynamic)
2255     storeq t1, [t0]
2256 end
2257
2258 macro putClosureVar()
2259     loadisFromInstruction(3, t1)
2260     loadConstantOrVariable(t1, t2)
2261     loadisFromInstruction(6, t1)
2262     storeq t2, JSEnvironmentRecord_variables[t0, t1, 8]
2263 end
2264
2265 macro putLocalClosureVar()
2266     loadisFromInstruction(3, t1)
2267     loadConstantOrVariable(t1, t2)
2268     loadpFromInstruction(5, t3)
2269     btpz t3, .noVariableWatchpointSet
2270     notifyWrite(t3, .pDynamic)
2271 .noVariableWatchpointSet:
2272     loadisFromInstruction(6, t1)
2273     storeq t2, JSEnvironmentRecord_variables[t0, t1, 8]
2274 end
2275
2276 macro checkTDZInGlobalPutToScopeIfNecessary()
2277     loadisFromInstruction(4, t0)
2278     andi InitializationModeMask, t0
2279     rshifti InitializationModeShift, t0
2280     bineq t0, NotInitialization, .noNeedForTDZCheck
2281     loadpFromInstruction(6, t0)
2282     loadq [t0], t0
2283     bqeq t0, ValueEmpty, .pDynamic
2284 .noNeedForTDZCheck:
2285 end
2286
2287
2288 _llint_op_put_to_scope:
2289     traceExecution()
2290     loadisFromInstruction(4, t0)
2291     andi ResolveTypeMask, t0
2292
2293 #pLocalClosureVar:
2294     bineq t0, LocalClosureVar, .pGlobalProperty
2295     loadVariable(1, t0)
2296     putLocalClosureVar()
2297     writeBarrierOnOperands(1, 3)
2298     dispatch(constexpr op_put_to_scope_length)
2299
2300 .pGlobalProperty:
2301     bineq t0, GlobalProperty, .pGlobalVar
2302     loadWithStructureCheck(1, .pDynamic)
2303     putProperty()
2304     writeBarrierOnOperands(1, 3)
2305     dispatch(constexpr op_put_to_scope_length)
2306
2307 .pGlobalVar:
2308     bineq t0, GlobalVar, .pGlobalLexicalVar
2309     writeBarrierOnGlobalObject(3)
2310     putGlobalVariable()
2311     dispatch(constexpr op_put_to_scope_length)
2312
2313 .pGlobalLexicalVar:
2314     bineq t0, GlobalLexicalVar, .pClosureVar
2315     writeBarrierOnGlobalLexicalEnvironment(3)
2316     checkTDZInGlobalPutToScopeIfNecessary()
2317     putGlobalVariable()
2318     dispatch(constexpr op_put_to_scope_length)
2319
2320 .pClosureVar:
2321     bineq t0, ClosureVar, .pGlobalPropertyWithVarInjectionChecks
2322     loadVariable(1, t0)
2323     putClosureVar()
2324     writeBarrierOnOperands(1, 3)
2325     dispatch(constexpr op_put_to_scope_length)
2326
2327 .pGlobalPropertyWithVarInjectionChecks:
2328     bineq t0, GlobalPropertyWithVarInjectionChecks, .pGlobalVarWithVarInjectionChecks
2329     loadWithStructureCheck(1, .pDynamic)
2330     putProperty()
2331     writeBarrierOnOperands(1, 3)
2332     dispatch(constexpr op_put_to_scope_length)
2333
2334 .pGlobalVarWithVarInjectionChecks:
2335     bineq t0, GlobalVarWithVarInjectionChecks, .pGlobalLexicalVarWithVarInjectionChecks
2336     writeBarrierOnGlobalObject(3)
2337     varInjectionCheck(.pDynamic)
2338     putGlobalVariable()
2339     dispatch(constexpr op_put_to_scope_length)
2340
2341 .pGlobalLexicalVarWithVarInjectionChecks:
2342     bineq t0, GlobalLexicalVarWithVarInjectionChecks, .pClosureVarWithVarInjectionChecks
2343     writeBarrierOnGlobalLexicalEnvironment(3)
2344     varInjectionCheck(.pDynamic)
2345     checkTDZInGlobalPutToScopeIfNecessary()
2346     putGlobalVariable()
2347     dispatch(constexpr op_put_to_scope_length)
2348
2349 .pClosureVarWithVarInjectionChecks:
2350     bineq t0, ClosureVarWithVarInjectionChecks, .pModuleVar
2351     varInjectionCheck(.pDynamic)
2352     loadVariable(1, t0)
2353     putClosureVar()
2354     writeBarrierOnOperands(1, 3)
2355     dispatch(constexpr op_put_to_scope_length)
2356
2357 .pModuleVar:
2358     bineq t0, ModuleVar, .pDynamic
2359     callOpcodeSlowPath(_slow_path_throw_strict_mode_readonly_property_write_error)
2360     dispatch(constexpr op_put_to_scope_length)
2361
2362 .pDynamic:
2363     callOpcodeSlowPath(_llint_slow_path_put_to_scope)
2364     dispatch(constexpr op_put_to_scope_length)
2365
2366
2367 _llint_op_get_from_arguments:
2368     traceExecution()
2369     loadVariable(2, t0)
2370     loadi 24[PB, PC, 8], t1
2371     loadq DirectArguments_storage[t0, t1, 8], t0
2372     valueProfile(t0, 4, t1)
2373     loadisFromInstruction(1, t1)
2374     storeq t0, [cfr, t1, 8]
2375     dispatch(constexpr op_get_from_arguments_length)
2376
2377
2378 _llint_op_put_to_arguments:
2379     traceExecution()
2380     loadVariable(1, t0)
2381     loadi 16[PB, PC, 8], t1
2382     loadisFromInstruction(3, t3)
2383     loadConstantOrVariable(t3, t2)
2384     storeq t2, DirectArguments_storage[t0, t1, 8]
2385     writeBarrierOnOperands(1, 3)
2386     dispatch(constexpr op_put_to_arguments_length)
2387
2388
2389 _llint_op_get_parent_scope:
2390     traceExecution()
2391     loadVariable(2, t0)
2392     loadp JSScope::m_next[t0], t0
2393     loadisFromInstruction(1, t1)
2394     storeq t0, [cfr, t1, 8]
2395     dispatch(constexpr op_get_parent_scope_length)
2396
2397
2398 _llint_op_profile_type:
2399     traceExecution()
2400     loadp CodeBlock[cfr], t1
2401     loadp CodeBlock::m_vm[t1], t1
2402     # t1 is holding the pointer to the typeProfilerLog.
2403     loadp VM::m_typeProfilerLog[t1], t1
2404     # t2 is holding the pointer to the current log entry.
2405     loadp TypeProfilerLog::m_currentLogEntryPtr[t1], t2
2406
2407     # t0 is holding the JSValue argument.
2408     loadisFromInstruction(1, t3)
2409     loadConstantOrVariable(t3, t0)
2410
2411     bqeq t0, ValueEmpty, .opProfileTypeDone
2412     # Store the JSValue onto the log entry.
2413     storeq t0, TypeProfilerLog::LogEntry::value[t2]
2414     
2415     # Store the TypeLocation onto the log entry.
2416     loadpFromInstruction(2, t3)
2417     storep t3, TypeProfilerLog::LogEntry::location[t2]
2418
2419     btqz t0, tagMask, .opProfileTypeIsCell
2420     storei 0, TypeProfilerLog::LogEntry::structureID[t2]
2421     jmp .opProfileTypeSkipIsCell
2422 .opProfileTypeIsCell:
2423     loadi JSCell::m_structureID[t0], t3
2424     storei t3, TypeProfilerLog::LogEntry::structureID[t2]
2425 .opProfileTypeSkipIsCell:
2426     
2427     # Increment the current log entry.
2428     addp sizeof TypeProfilerLog::LogEntry, t2
2429     storep t2, TypeProfilerLog::m_currentLogEntryPtr[t1]
2430
2431     loadp TypeProfilerLog::m_logEndPtr[t1], t1
2432     bpneq t2, t1, .opProfileTypeDone
2433     callOpcodeSlowPath(_slow_path_profile_type_clear_log)
2434
2435 .opProfileTypeDone:
2436     dispatch(constexpr op_profile_type_length)
2437
2438 _llint_op_profile_control_flow:
2439     traceExecution()
2440     loadpFromInstruction(1, t0)
2441     addq 1, BasicBlockLocation::m_executionCount[t0]
2442     dispatch(constexpr op_profile_control_flow_length)
2443
2444
2445 _llint_op_get_rest_length:
2446     traceExecution()
2447     loadi PayloadOffset + ArgumentCount[cfr], t0
2448     subi 1, t0
2449     loadisFromInstruction(2, t1)
2450     bilteq t0, t1, .storeZero
2451     subi t1, t0
2452     jmp .boxUp
2453 .storeZero:
2454     move 0, t0
2455 .boxUp:
2456     orq tagTypeNumber, t0
2457     loadisFromInstruction(1, t1)
2458     storeq t0, [cfr, t1, 8]
2459     dispatch(constexpr op_get_rest_length_length)
2460
2461
2462 _llint_op_log_shadow_chicken_prologue:
2463     traceExecution()
2464     acquireShadowChickenPacket(.opLogShadowChickenPrologueSlow)
2465     storep cfr, ShadowChicken::Packet::frame[t0]
2466     loadp CallerFrame[cfr], t1
2467     storep t1, ShadowChicken::Packet::callerFrame[t0]
2468     loadp Callee[cfr], t1
2469     storep t1, ShadowChicken::Packet::callee[t0]
2470     loadVariable(1, t1)
2471     storep t1, ShadowChicken::Packet::scope[t0]
2472     dispatch(constexpr op_log_shadow_chicken_prologue_length)
2473 .opLogShadowChickenPrologueSlow:
2474     callOpcodeSlowPath(_llint_slow_path_log_shadow_chicken_prologue)
2475     dispatch(constexpr op_log_shadow_chicken_prologue_length)
2476
2477
2478 _llint_op_log_shadow_chicken_tail:
2479     traceExecution()
2480     acquireShadowChickenPacket(.opLogShadowChickenTailSlow)
2481     storep cfr, ShadowChicken::Packet::frame[t0]
2482     storep ShadowChickenTailMarker, ShadowChicken::Packet::callee[t0]
2483     loadVariable(1, t1)
2484     storep t1, ShadowChicken::Packet::thisValue[t0]
2485     loadVariable(2, t1)
2486     storep t1, ShadowChicken::Packet::scope[t0]
2487     loadp CodeBlock[cfr], t1
2488     storep t1, ShadowChicken::Packet::codeBlock[t0]
2489     storei PC, ShadowChicken::Packet::callSiteIndex[t0]
2490     dispatch(constexpr op_log_shadow_chicken_tail_length)
2491 .opLogShadowChickenTailSlow:
2492     callOpcodeSlowPath(_llint_slow_path_log_shadow_chicken_tail)
2493     dispatch(constexpr op_log_shadow_chicken_tail_length)
2494 `;
2495
2496     new File("LowLevelInterpreter64.asm", source);
2497 })();
2498