2 * Copyright (C) 2011-2016 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include "DFGAbstractInterpreter.h"
31 #include "DFGGenerationInfo.h"
32 #include "DFGInPlaceAbstractState.h"
33 #include "DFGJITCompiler.h"
34 #include "DFGOSRExit.h"
35 #include "DFGOSRExitJumpPlaceholder.h"
36 #include "DFGSilentRegisterSavePlan.h"
37 #include "DFGValueSource.h"
38 #include "JITMathIC.h"
39 #include "JITOperations.h"
40 #include "MarkedAllocator.h"
42 #include "SpillRegistersMode.h"
43 #include "StructureStubInfo.h"
44 #include "ValueRecovery.h"
45 #include "VirtualRegister.h"
47 namespace JSC { namespace DFG {
51 class SlowPathGenerator;
53 class SpeculateInt32Operand;
54 class SpeculateStrictInt32Operand;
55 class SpeculateDoubleOperand;
56 class SpeculateCellOperand;
57 class SpeculateBooleanOperand;
59 enum GeneratedOperandType { GeneratedOperandTypeUnknown, GeneratedOperandInteger, GeneratedOperandJSValue};
61 // === SpeculativeJIT ===
63 // The SpeculativeJIT is used to generate a fast, but potentially
64 // incomplete code path for the dataflow. When code generating
65 // we may make assumptions about operand types, dynamically check,
66 // and bail-out to an alternate code path if these checks fail.
67 // Importantly, the speculative code path cannot be reentered once
68 // a speculative check has failed. This allows the SpeculativeJIT
69 // to propagate type information (including information that has
70 // only speculatively been asserted) through the dataflow.
71 class SpeculativeJIT {
72 WTF_MAKE_FAST_ALLOCATED;
74 friend struct OSRExit;
76 typedef JITCompiler::TrustedImm32 TrustedImm32;
77 typedef JITCompiler::Imm32 Imm32;
78 typedef JITCompiler::ImmPtr ImmPtr;
79 typedef JITCompiler::TrustedImm64 TrustedImm64;
80 typedef JITCompiler::Imm64 Imm64;
82 // These constants are used to set priorities for spill order for
83 // the register allocator.
86 SpillOrderConstant = 1, // no spill, and cheap fill
87 SpillOrderSpilled = 2, // no spill
88 SpillOrderJS = 4, // needs spill
89 SpillOrderCell = 4, // needs spill
90 SpillOrderStorage = 4, // needs spill
91 SpillOrderInteger = 5, // needs spill and box
92 SpillOrderBoolean = 5, // needs spill and box
93 SpillOrderDouble = 6, // needs spill and convert
95 #elif USE(JSVALUE32_64)
97 SpillOrderConstant = 1, // no spill, and cheap fill
98 SpillOrderSpilled = 2, // no spill
99 SpillOrderJS = 4, // needs spill
100 SpillOrderStorage = 4, // needs spill
101 SpillOrderDouble = 4, // needs spill
102 SpillOrderInteger = 5, // needs spill and box
103 SpillOrderCell = 5, // needs spill and box
104 SpillOrderBoolean = 5, // needs spill and box
108 enum UseChildrenMode { CallUseChildren, UseChildrenCalledExplicitly };
111 SpeculativeJIT(JITCompiler&);
114 struct TrustedImmPtr {
115 template <typename T>
116 explicit TrustedImmPtr(T* value)
119 static_assert(!std::is_base_of<HeapCell, T>::value, "To use a GC pointer, the graph must be aware of it. Use SpeculativeJIT::TrustedImmPtr::weakPointer instead.");
122 explicit TrustedImmPtr(RegisteredStructure structure)
123 : m_value(structure.get())
126 // This is only here so that TrustedImmPtr(0) does not confuse the C++
127 // overload handling rules.
128 explicit TrustedImmPtr(int value)
134 explicit TrustedImmPtr(std::nullptr_t)
138 explicit TrustedImmPtr(FrozenValue* value)
140 RELEASE_ASSERT(value->value().isCell());
141 m_value = MacroAssembler::TrustedImmPtr(value->cell());
144 explicit TrustedImmPtr(size_t value)
145 : m_value(bitwise_cast<void*>(value))
149 static TrustedImmPtr weakPointer(Graph& graph, JSCell* cell)
151 // There are weird relationships in how optimized CodeBlocks
152 // point to other CodeBlocks. We don't want to have them be
153 // part of the weak pointer set. For example, an optimized CodeBlock
154 // having a weak pointer to itself will cause it to get collected.
155 ASSERT(!jsDynamicCast<CodeBlock*>(graph.m_vm, cell));
157 graph.m_plan.weakReferences.addLazily(cell);
158 return TrustedImmPtr(bitwise_cast<size_t>(cell));
161 operator MacroAssembler::TrustedImmPtr() const { return m_value; }
165 return m_value.asIntptr();
169 MacroAssembler::TrustedImmPtr m_value;
174 void createOSREntries();
175 void linkOSREntries(LinkBuffer&);
177 BasicBlock* nextBlock()
179 for (BlockIndex resultIndex = m_block->index + 1; ; resultIndex++) {
180 if (resultIndex >= m_jit.graph().numBlocks())
182 if (BasicBlock* result = m_jit.graph().block(resultIndex))
188 GPRReg fillJSValue(Edge);
189 #elif USE(JSVALUE32_64)
190 bool fillJSValue(Edge, GPRReg&, GPRReg&, FPRReg&);
192 GPRReg fillStorage(Edge);
194 // lock and unlock GPR & FPR registers.
195 void lock(GPRReg reg)
199 void lock(FPRReg reg)
203 void unlock(GPRReg reg)
207 void unlock(FPRReg reg)
212 // Used to check whether a child node is on its last use,
213 // and its machine registers may be reused.
214 bool canReuse(Node* node)
216 return generationInfo(node).useCount() == 1;
218 bool canReuse(Node* nodeA, Node* nodeB)
220 return nodeA == nodeB && generationInfo(nodeA).useCount() == 2;
222 bool canReuse(Edge nodeUse)
224 return canReuse(nodeUse.node());
226 GPRReg reuse(GPRReg reg)
231 FPRReg reuse(FPRReg reg)
237 // Allocate a gpr/fpr.
240 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION)
241 m_jit.addRegisterAllocationAtOffset(m_jit.debugOffset());
243 VirtualRegister spillMe;
244 GPRReg gpr = m_gprs.allocate(spillMe);
245 if (spillMe.isValid()) {
246 #if USE(JSVALUE32_64)
247 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe);
248 if ((info.registerFormat() & DataFormatJS))
249 m_gprs.release(info.tagGPR() == gpr ? info.payloadGPR() : info.tagGPR());
255 GPRReg allocate(GPRReg specific)
257 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION)
258 m_jit.addRegisterAllocationAtOffset(m_jit.debugOffset());
260 VirtualRegister spillMe = m_gprs.allocateSpecific(specific);
261 if (spillMe.isValid()) {
262 #if USE(JSVALUE32_64)
263 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe);
264 RELEASE_ASSERT(info.registerFormat() != DataFormatJSDouble);
265 if ((info.registerFormat() & DataFormatJS))
266 m_gprs.release(info.tagGPR() == specific ? info.payloadGPR() : info.tagGPR());
274 return m_gprs.tryAllocate();
278 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION)
279 m_jit.addRegisterAllocationAtOffset(m_jit.debugOffset());
281 VirtualRegister spillMe;
282 FPRReg fpr = m_fprs.allocate(spillMe);
283 if (spillMe.isValid())
288 // Check whether a VirtualRegsiter is currently in a machine register.
289 // We use this when filling operands to fill those that are already in
290 // machine registers first (by locking VirtualRegsiters that are already
291 // in machine register before filling those that are not we attempt to
292 // avoid spilling values we will need immediately).
293 bool isFilled(Node* node)
295 return generationInfo(node).registerFormat() != DataFormatNone;
297 bool isFilledDouble(Node* node)
299 return generationInfo(node).registerFormat() == DataFormatDouble;
302 // Called on an operand once it has been consumed by a parent node.
305 if (!node->hasResult())
307 GenerationInfo& info = generationInfo(node);
309 // use() returns true when the value becomes dead, and any
310 // associated resources may be freed.
311 if (!info.use(*m_stream))
314 // Release the associated machine registers.
315 DataFormat registerFormat = info.registerFormat();
317 if (registerFormat == DataFormatDouble)
318 m_fprs.release(info.fpr());
319 else if (registerFormat != DataFormatNone)
320 m_gprs.release(info.gpr());
321 #elif USE(JSVALUE32_64)
322 if (registerFormat == DataFormatDouble)
323 m_fprs.release(info.fpr());
324 else if (registerFormat & DataFormatJS) {
325 m_gprs.release(info.tagGPR());
326 m_gprs.release(info.payloadGPR());
327 } else if (registerFormat != DataFormatNone)
328 m_gprs.release(info.gpr());
331 void use(Edge nodeUse)
336 RegisterSet usedRegisters();
338 bool masqueradesAsUndefinedWatchpointIsStillValid(const CodeOrigin& codeOrigin)
340 return m_jit.graph().masqueradesAsUndefinedWatchpointIsStillValid(codeOrigin);
342 bool masqueradesAsUndefinedWatchpointIsStillValid()
344 return masqueradesAsUndefinedWatchpointIsStillValid(m_currentNode->origin.semantic);
347 void compileStoreBarrier(Node*);
349 static GPRReg selectScratchGPR(GPRReg preserve1 = InvalidGPRReg, GPRReg preserve2 = InvalidGPRReg, GPRReg preserve3 = InvalidGPRReg, GPRReg preserve4 = InvalidGPRReg)
351 return AssemblyHelpers::selectScratchGPR(preserve1, preserve2, preserve3, preserve4);
354 // Called by the speculative operand types, below, to fill operand to
355 // machine registers, implicitly generating speculation checks as needed.
356 GPRReg fillSpeculateInt32(Edge, DataFormat& returnFormat);
357 GPRReg fillSpeculateInt32Strict(Edge);
358 GPRReg fillSpeculateInt52(Edge, DataFormat desiredFormat);
359 FPRReg fillSpeculateDouble(Edge);
360 GPRReg fillSpeculateCell(Edge);
361 GPRReg fillSpeculateBoolean(Edge);
362 GeneratedOperandType checkGeneratedTypeForToInt32(Node*);
364 void addSlowPathGenerator(std::unique_ptr<SlowPathGenerator>);
365 void addSlowPathGenerator(std::function<void()>);
366 void runSlowPathGenerators(PCToCodeOriginMapBuilder&);
369 void noticeOSRBirth(Node*);
370 void bail(AbortReason);
371 void compileCurrentBlock();
373 void checkArgumentTypes();
375 void clearGenerationInfo();
377 // These methods are used when generating 'unexpected'
378 // calls out from JIT code to C++ helper routines -
379 // they spill all live values to the appropriate
380 // slots in the JSStack without changing any state
381 // in the GenerationInfo.
382 SilentRegisterSavePlan silentSavePlanForGPR(VirtualRegister spillMe, GPRReg source);
383 SilentRegisterSavePlan silentSavePlanForFPR(VirtualRegister spillMe, FPRReg source);
384 void silentSpill(const SilentRegisterSavePlan&);
385 void silentFill(const SilentRegisterSavePlan&, GPRReg canTrample);
387 template<typename CollectionType>
388 void silentSpill(const CollectionType& savePlans)
390 for (unsigned i = 0; i < savePlans.size(); ++i)
391 silentSpill(savePlans[i]);
394 template<typename CollectionType>
395 void silentFill(const CollectionType& savePlans, GPRReg exclude = InvalidGPRReg)
397 GPRReg canTrample = SpeculativeJIT::pickCanTrample(exclude);
398 for (unsigned i = savePlans.size(); i--;)
399 silentFill(savePlans[i], canTrample);
402 template<typename CollectionType>
403 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, GPRReg exclude, GPRReg exclude2 = InvalidGPRReg, FPRReg fprExclude = InvalidFPRReg)
405 ASSERT(plans.isEmpty());
406 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
407 GPRReg gpr = iter.regID();
408 if (iter.name().isValid() && gpr != exclude && gpr != exclude2) {
409 SilentRegisterSavePlan plan = silentSavePlanForGPR(iter.name(), gpr);
415 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
416 if (iter.name().isValid() && iter.regID() != fprExclude) {
417 SilentRegisterSavePlan plan = silentSavePlanForFPR(iter.name(), iter.regID());
424 template<typename CollectionType>
425 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, NoResultTag)
427 silentSpillAllRegistersImpl(doSpill, plans, InvalidGPRReg, InvalidGPRReg, InvalidFPRReg);
429 template<typename CollectionType>
430 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, FPRReg exclude)
432 silentSpillAllRegistersImpl(doSpill, plans, InvalidGPRReg, InvalidGPRReg, exclude);
434 template<typename CollectionType>
435 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, JSValueRegs exclude)
437 #if USE(JSVALUE32_64)
438 silentSpillAllRegistersImpl(doSpill, plans, exclude.tagGPR(), exclude.payloadGPR());
440 silentSpillAllRegistersImpl(doSpill, plans, exclude.gpr());
444 void silentSpillAllRegisters(GPRReg exclude, GPRReg exclude2 = InvalidGPRReg, FPRReg fprExclude = InvalidFPRReg)
446 silentSpillAllRegistersImpl(true, m_plans, exclude, exclude2, fprExclude);
448 void silentSpillAllRegisters(FPRReg exclude)
450 silentSpillAllRegisters(InvalidGPRReg, InvalidGPRReg, exclude);
452 void silentSpillAllRegisters(JSValueRegs exclude)
455 silentSpillAllRegisters(exclude.payloadGPR());
457 silentSpillAllRegisters(exclude.payloadGPR(), exclude.tagGPR());
461 static GPRReg pickCanTrample(GPRReg exclude)
463 GPRReg result = GPRInfo::regT0;
464 if (result == exclude)
465 result = GPRInfo::regT1;
468 static GPRReg pickCanTrample(FPRReg)
470 return GPRInfo::regT0;
472 static GPRReg pickCanTrample(NoResultTag)
474 return GPRInfo::regT0;
478 static GPRReg pickCanTrample(JSValueRegs exclude)
480 return pickCanTrample(exclude.payloadGPR());
483 static GPRReg pickCanTrample(JSValueRegs exclude)
485 GPRReg result = GPRInfo::regT0;
486 if (result == exclude.tagGPR()) {
487 result = GPRInfo::regT1;
488 if (result == exclude.payloadGPR())
489 result = GPRInfo::regT2;
490 } else if (result == exclude.payloadGPR()) {
491 result = GPRInfo::regT1;
492 if (result == exclude.tagGPR())
493 result = GPRInfo::regT2;
499 template<typename RegisterType>
500 void silentFillAllRegisters(RegisterType exclude)
502 GPRReg canTrample = pickCanTrample(exclude);
504 while (!m_plans.isEmpty()) {
505 SilentRegisterSavePlan& plan = m_plans.last();
506 silentFill(plan, canTrample);
507 m_plans.removeLast();
511 // These methods convert between doubles, and doubles boxed and JSValues.
513 GPRReg boxDouble(FPRReg fpr, GPRReg gpr)
515 return m_jit.boxDouble(fpr, gpr);
517 FPRReg unboxDouble(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
519 return m_jit.unboxDouble(gpr, resultGPR, fpr);
521 GPRReg boxDouble(FPRReg fpr)
523 return boxDouble(fpr, allocate());
526 void boxInt52(GPRReg sourceGPR, GPRReg targetGPR, DataFormat);
527 #elif USE(JSVALUE32_64)
528 void boxDouble(FPRReg fpr, GPRReg tagGPR, GPRReg payloadGPR)
530 m_jit.boxDouble(fpr, tagGPR, payloadGPR);
532 void unboxDouble(GPRReg tagGPR, GPRReg payloadGPR, FPRReg fpr, FPRReg scratchFPR)
534 m_jit.unboxDouble(tagGPR, payloadGPR, fpr, scratchFPR);
537 void boxDouble(FPRReg fpr, JSValueRegs regs)
539 m_jit.boxDouble(fpr, regs);
542 // Spill a VirtualRegister to the JSStack.
543 void spill(VirtualRegister spillMe)
545 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe);
547 #if USE(JSVALUE32_64)
548 if (info.registerFormat() == DataFormatNone) // it has been spilled. JS values which have two GPRs can reach here
551 // Check the GenerationInfo to see if this value need writing
552 // to the JSStack - if not, mark it as spilled & return.
553 if (!info.needsSpill()) {
554 info.setSpilled(*m_stream, spillMe);
558 DataFormat spillFormat = info.registerFormat();
559 switch (spillFormat) {
560 case DataFormatStorage: {
561 // This is special, since it's not a JS value - as in it's not visible to JS
563 m_jit.storePtr(info.gpr(), JITCompiler::addressFor(spillMe));
564 info.spill(*m_stream, spillMe, DataFormatStorage);
568 case DataFormatInt32: {
569 m_jit.store32(info.gpr(), JITCompiler::payloadFor(spillMe));
570 info.spill(*m_stream, spillMe, DataFormatInt32);
575 case DataFormatDouble: {
576 m_jit.storeDouble(info.fpr(), JITCompiler::addressFor(spillMe));
577 info.spill(*m_stream, spillMe, DataFormatDouble);
581 case DataFormatInt52:
582 case DataFormatStrictInt52: {
583 m_jit.store64(info.gpr(), JITCompiler::addressFor(spillMe));
584 info.spill(*m_stream, spillMe, spillFormat);
589 // The following code handles JSValues, int32s, and cells.
590 RELEASE_ASSERT(spillFormat == DataFormatCell || spillFormat & DataFormatJS);
592 GPRReg reg = info.gpr();
593 // We need to box int32 and cell values ...
594 // but on JSVALUE64 boxing a cell is a no-op!
595 if (spillFormat == DataFormatInt32)
596 m_jit.or64(GPRInfo::tagTypeNumberRegister, reg);
598 // Spill the value, and record it as spilled in its boxed form.
599 m_jit.store64(reg, JITCompiler::addressFor(spillMe));
600 info.spill(*m_stream, spillMe, (DataFormat)(spillFormat | DataFormatJS));
602 #elif USE(JSVALUE32_64)
604 case DataFormatBoolean: {
605 m_jit.store32(info.gpr(), JITCompiler::payloadFor(spillMe));
606 info.spill(*m_stream, spillMe, spillFormat);
610 case DataFormatDouble: {
611 // On JSVALUE32_64 boxing a double is a no-op.
612 m_jit.storeDouble(info.fpr(), JITCompiler::addressFor(spillMe));
613 info.spill(*m_stream, spillMe, DataFormatDouble);
618 // The following code handles JSValues.
619 RELEASE_ASSERT(spillFormat & DataFormatJS);
620 m_jit.store32(info.tagGPR(), JITCompiler::tagFor(spillMe));
621 m_jit.store32(info.payloadGPR(), JITCompiler::payloadFor(spillMe));
622 info.spill(*m_stream, spillMe, spillFormat);
628 bool isKnownInteger(Node* node) { return m_state.forNode(node).isType(SpecInt32Only); }
629 bool isKnownCell(Node* node) { return m_state.forNode(node).isType(SpecCell); }
631 bool isKnownNotInteger(Node* node) { return !(m_state.forNode(node).m_type & SpecInt32Only); }
632 bool isKnownNotNumber(Node* node) { return !(m_state.forNode(node).m_type & SpecFullNumber); }
633 bool isKnownNotCell(Node* node) { return !(m_state.forNode(node).m_type & SpecCell); }
634 bool isKnownNotOther(Node* node) { return !(m_state.forNode(node).m_type & SpecOther); }
636 UniquedStringImpl* identifierUID(unsigned index)
638 return m_jit.graph().identifiers()[index];
641 // Spill all VirtualRegisters back to the JSStack.
642 void flushRegisters()
644 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
645 if (iter.name().isValid()) {
650 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
651 if (iter.name().isValid()) {
658 // Used to ASSERT flushRegisters() has been called prior to
659 // calling out from JIT code to a C helper function.
662 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
663 if (iter.name().isValid())
666 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
667 if (iter.name().isValid())
674 static MacroAssembler::Imm64 valueOfJSConstantAsImm64(Node* node)
676 return MacroAssembler::Imm64(JSValue::encode(node->asJSValue()));
680 // Helper functions to enable code sharing in implementations of bit/shift ops.
681 void bitOp(NodeType op, int32_t imm, GPRReg op1, GPRReg result)
685 m_jit.and32(Imm32(imm), op1, result);
688 m_jit.or32(Imm32(imm), op1, result);
691 m_jit.xor32(Imm32(imm), op1, result);
694 RELEASE_ASSERT_NOT_REACHED();
697 void bitOp(NodeType op, GPRReg op1, GPRReg op2, GPRReg result)
701 m_jit.and32(op1, op2, result);
704 m_jit.or32(op1, op2, result);
707 m_jit.xor32(op1, op2, result);
710 RELEASE_ASSERT_NOT_REACHED();
713 void shiftOp(NodeType op, GPRReg op1, int32_t shiftAmount, GPRReg result)
717 m_jit.rshift32(op1, Imm32(shiftAmount), result);
720 m_jit.lshift32(op1, Imm32(shiftAmount), result);
723 m_jit.urshift32(op1, Imm32(shiftAmount), result);
726 RELEASE_ASSERT_NOT_REACHED();
729 void shiftOp(NodeType op, GPRReg op1, GPRReg shiftAmount, GPRReg result)
733 m_jit.rshift32(op1, shiftAmount, result);
736 m_jit.lshift32(op1, shiftAmount, result);
739 m_jit.urshift32(op1, shiftAmount, result);
742 RELEASE_ASSERT_NOT_REACHED();
746 // Returns the index of the branch node if peephole is okay, UINT_MAX otherwise.
747 unsigned detectPeepHoleBranch()
749 // Check that no intervening nodes will be generated.
750 for (unsigned index = m_indexInBlock + 1; index < m_block->size() - 1; ++index) {
751 Node* node = m_block->at(index);
752 if (!node->shouldGenerate())
754 // Check if it's a Phantom that can be safely ignored.
755 if (node->op() == Phantom && !node->child1())
760 // Check if the lastNode is a branch on this node.
761 Node* lastNode = m_block->terminal();
762 return lastNode->op() == Branch && lastNode->child1() == m_currentNode ? m_block->size() - 1 : UINT_MAX;
765 void compileCheckTraps(Node*);
767 void compileMovHint(Node*);
768 void compileMovHintAndCheck(Node*);
770 void cachedGetById(CodeOrigin, JSValueRegs base, JSValueRegs result, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill, AccessType = AccessType::Get);
773 void cachedGetById(CodeOrigin, GPRReg baseGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill, AccessType = AccessType::Get);
774 void cachedPutById(CodeOrigin, GPRReg base, GPRReg value, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill);
775 void cachedGetByIdWithThis(CodeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget = JITCompiler::JumpList());
776 #elif USE(JSVALUE32_64)
777 void cachedGetById(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill, AccessType = AccessType::Get);
778 void cachedPutById(CodeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill);
779 void cachedGetByIdWithThis(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPROrNone, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget = JITCompiler::JumpList());
782 void compileDeleteById(Node*);
783 void compileDeleteByVal(Node*);
784 void compileTryGetById(Node*);
785 void compileIn(Node*);
787 void nonSpeculativeNonPeepholeCompareNullOrUndefined(Edge operand);
788 void nonSpeculativePeepholeBranchNullOrUndefined(Edge operand, Node* branchNode);
790 void nonSpeculativePeepholeBranch(Node*, Node* branchNode, MacroAssembler::RelationalCondition, S_JITOperation_EJJ helperFunction);
791 void nonSpeculativeNonPeepholeCompare(Node*, MacroAssembler::RelationalCondition, S_JITOperation_EJJ helperFunction);
792 bool nonSpeculativeCompare(Node*, MacroAssembler::RelationalCondition, S_JITOperation_EJJ helperFunction);
794 void nonSpeculativePeepholeStrictEq(Node*, Node* branchNode, bool invert = false);
795 void nonSpeculativeNonPeepholeStrictEq(Node*, bool invert = false);
796 bool nonSpeculativeStrictEq(Node*, bool invert = false);
798 void compileInstanceOfForObject(Node*, GPRReg valueReg, GPRReg prototypeReg, GPRReg scratchAndResultReg, GPRReg scratch2Reg);
799 void compileInstanceOf(Node*);
800 void compileInstanceOfCustom(Node*);
802 void compileIsCellWithType(Node*);
803 void compileIsTypedArrayView(Node*);
805 void emitCall(Node*);
807 void emitAllocateButterfly(GPRReg storageGPR, GPRReg sizeGPR, GPRReg scratch1, GPRReg scratch2, GPRReg scratch3, MacroAssembler::JumpList& slowCases);
808 void emitInitializeButterfly(GPRReg storageGPR, GPRReg sizeGPR, JSValueRegs emptyValueRegs, GPRReg scratchGPR);
809 void compileAllocateNewArrayWithSize(JSGlobalObject*, GPRReg resultGPR, GPRReg sizeGPR, IndexingType, bool shouldConvertLargeSizeToArrayStorage = true);
811 // Called once a node has completed code generation but prior to setting
812 // its result, to free up its children. (This must happen prior to setting
813 // the nodes result, since the node may have the same VirtualRegister as
814 // a child, and as such will use the same GeneratioInfo).
815 void useChildren(Node*);
817 // These method called to initialize the the GenerationInfo
818 // to describe the result of an operation.
819 void int32Result(GPRReg reg, Node* node, DataFormat format = DataFormatInt32, UseChildrenMode mode = CallUseChildren)
821 if (mode == CallUseChildren)
824 VirtualRegister virtualRegister = node->virtualRegister();
825 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
827 if (format == DataFormatInt32) {
828 m_jit.jitAssertIsInt32(reg);
829 m_gprs.retain(reg, virtualRegister, SpillOrderInteger);
830 info.initInt32(node, node->refCount(), reg);
833 RELEASE_ASSERT(format == DataFormatJSInt32);
834 m_jit.jitAssertIsJSInt32(reg);
835 m_gprs.retain(reg, virtualRegister, SpillOrderJS);
836 info.initJSValue(node, node->refCount(), reg, format);
837 #elif USE(JSVALUE32_64)
838 RELEASE_ASSERT_NOT_REACHED();
842 void int32Result(GPRReg reg, Node* node, UseChildrenMode mode)
844 int32Result(reg, node, DataFormatInt32, mode);
846 void int52Result(GPRReg reg, Node* node, DataFormat format, UseChildrenMode mode = CallUseChildren)
848 if (mode == CallUseChildren)
851 VirtualRegister virtualRegister = node->virtualRegister();
852 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
854 m_gprs.retain(reg, virtualRegister, SpillOrderJS);
855 info.initInt52(node, node->refCount(), reg, format);
857 void int52Result(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
859 int52Result(reg, node, DataFormatInt52, mode);
861 void strictInt52Result(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
863 int52Result(reg, node, DataFormatStrictInt52, mode);
865 void noResult(Node* node, UseChildrenMode mode = CallUseChildren)
867 if (mode == UseChildrenCalledExplicitly)
871 void cellResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
873 if (mode == CallUseChildren)
876 VirtualRegister virtualRegister = node->virtualRegister();
877 m_gprs.retain(reg, virtualRegister, SpillOrderCell);
878 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
879 info.initCell(node, node->refCount(), reg);
881 void blessedBooleanResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
884 jsValueResult(reg, node, DataFormatJSBoolean, mode);
886 booleanResult(reg, node, mode);
889 void unblessedBooleanResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
894 blessedBooleanResult(reg, node, mode);
897 void jsValueResult(GPRReg reg, Node* node, DataFormat format = DataFormatJS, UseChildrenMode mode = CallUseChildren)
899 if (format == DataFormatJSInt32)
900 m_jit.jitAssertIsJSInt32(reg);
902 if (mode == CallUseChildren)
905 VirtualRegister virtualRegister = node->virtualRegister();
906 m_gprs.retain(reg, virtualRegister, SpillOrderJS);
907 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
908 info.initJSValue(node, node->refCount(), reg, format);
910 void jsValueResult(GPRReg reg, Node* node, UseChildrenMode mode)
912 jsValueResult(reg, node, DataFormatJS, mode);
914 #elif USE(JSVALUE32_64)
915 void booleanResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
917 if (mode == CallUseChildren)
920 VirtualRegister virtualRegister = node->virtualRegister();
921 m_gprs.retain(reg, virtualRegister, SpillOrderBoolean);
922 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
923 info.initBoolean(node, node->refCount(), reg);
925 void jsValueResult(GPRReg tag, GPRReg payload, Node* node, DataFormat format = DataFormatJS, UseChildrenMode mode = CallUseChildren)
927 if (mode == CallUseChildren)
930 VirtualRegister virtualRegister = node->virtualRegister();
931 m_gprs.retain(tag, virtualRegister, SpillOrderJS);
932 m_gprs.retain(payload, virtualRegister, SpillOrderJS);
933 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
934 info.initJSValue(node, node->refCount(), tag, payload, format);
936 void jsValueResult(GPRReg tag, GPRReg payload, Node* node, UseChildrenMode mode)
938 jsValueResult(tag, payload, node, DataFormatJS, mode);
941 void jsValueResult(JSValueRegs regs, Node* node, DataFormat format = DataFormatJS, UseChildrenMode mode = CallUseChildren)
944 jsValueResult(regs.gpr(), node, format, mode);
946 jsValueResult(regs.tagGPR(), regs.payloadGPR(), node, format, mode);
949 void storageResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
951 if (mode == CallUseChildren)
954 VirtualRegister virtualRegister = node->virtualRegister();
955 m_gprs.retain(reg, virtualRegister, SpillOrderStorage);
956 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
957 info.initStorage(node, node->refCount(), reg);
959 void doubleResult(FPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
961 if (mode == CallUseChildren)
964 VirtualRegister virtualRegister = node->virtualRegister();
965 m_fprs.retain(reg, virtualRegister, SpillOrderDouble);
966 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
967 info.initDouble(node, node->refCount(), reg);
969 void initConstantInfo(Node* node)
971 ASSERT(node->hasConstant());
972 generationInfo(node).initConstant(node, node->refCount());
975 // These methods add calls to C++ helper functions.
976 // These methods are broadly value representation specific (i.e.
977 // deal with the fact that a JSValue may be passed in one or two
978 // machine registers, and delegate the calling convention specific
979 // decision as to how to fill the regsiters to setupArguments* methods.
981 JITCompiler::Call callOperation(V_JITOperation_E operation)
983 m_jit.setupArgumentsExecState();
984 return appendCall(operation);
986 JITCompiler::Call callOperation(P_JITOperation_E operation, GPRReg result)
988 m_jit.setupArgumentsExecState();
989 return appendCallSetResult(operation, result);
991 JITCompiler::Call callOperation(P_JITOperation_EC operation, GPRReg result, GPRReg cell)
993 m_jit.setupArgumentsWithExecState(cell);
994 return appendCallSetResult(operation, result);
996 JITCompiler::Call callOperation(Jss_JITOperation_EJssUi operation, GPRReg result, GPRReg arg1, GPRReg arg2)
998 m_jit.setupArgumentsWithExecState(arg1, arg2);
999 return appendCallSetResult(operation, result);
1001 JITCompiler::Call callOperation(P_JITOperation_EO operation, GPRReg result, GPRReg object)
1003 m_jit.setupArgumentsWithExecState(object);
1004 return appendCallSetResult(operation, result);
1006 JITCompiler::Call callOperation(P_JITOperation_EOS operation, GPRReg result, GPRReg object, size_t size)
1008 m_jit.setupArgumentsWithExecState(object, TrustedImmPtr(size));
1009 return appendCallSetResult(operation, result);
1011 JITCompiler::Call callOperation(P_JITOperation_EOZ operation, GPRReg result, GPRReg object, int32_t size)
1013 m_jit.setupArgumentsWithExecState(object, TrustedImmPtr(size));
1014 return appendCallSetResult(operation, result);
1016 JITCompiler::Call callOperation(C_JITOperation_EOZ operation, GPRReg result, GPRReg object, int32_t size)
1018 m_jit.setupArgumentsWithExecState(object, TrustedImmPtr(static_cast<size_t>(size)));
1019 return appendCallSetResult(operation, result);
1021 JITCompiler::Call callOperation(P_JITOperation_EPS operation, GPRReg result, GPRReg old, size_t size)
1023 m_jit.setupArgumentsWithExecState(old, TrustedImmPtr(size));
1024 return appendCallSetResult(operation, result);
1026 JITCompiler::Call callOperation(C_JITOperation_EPUi operation, GPRReg result, void* arg1, uint32_t arg2)
1028 m_jit.setupArgumentsWithExecState(TrustedImmPtr(arg1), TrustedImm32(arg2));
1029 return appendCallSetResult(operation, result);
1031 JITCompiler::Call callOperation(P_JITOperation_ES operation, GPRReg result, size_t size)
1033 m_jit.setupArgumentsWithExecState(TrustedImmPtr(size));
1034 return appendCallSetResult(operation, result);
1036 JITCompiler::Call callOperation(P_JITOperation_ESJss operation, GPRReg result, size_t index, GPRReg arg1)
1038 m_jit.setupArgumentsWithExecState(TrustedImmPtr(index), arg1);
1039 return appendCallSetResult(operation, result);
1041 JITCompiler::Call callOperation(Z_JITOperation_EOI operation, GPRReg result, GPRReg obj, GPRReg impl)
1043 m_jit.setupArgumentsWithExecState(obj, impl);
1044 return appendCallSetResult(operation, result);
1046 JITCompiler::Call callOperation(P_JITOperation_ESt operation, GPRReg result, RegisteredStructure structure)
1048 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure));
1049 return appendCallSetResult(operation, result);
1051 JITCompiler::Call callOperation(P_JITOperation_EStZP operation, GPRReg result, RegisteredStructure structure, GPRReg arg2, GPRReg arg3)
1053 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2, arg3);
1054 return appendCallSetResult(operation, result);
1056 JITCompiler::Call callOperation(P_JITOperation_EStZP operation, GPRReg result, RegisteredStructure structure, size_t arg2, GPRReg arg3)
1058 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(arg2), arg3);
1059 return appendCallSetResult(operation, result);
1061 JITCompiler::Call callOperation(P_JITOperation_EStZP operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1063 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1064 return appendCallSetResult(operation, result);
1066 JITCompiler::Call callOperation(P_JITOperation_EStZB operation, GPRReg result, RegisteredStructure structure, GPRReg arg2, GPRReg butterfly)
1068 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2, butterfly);
1069 return appendCallSetResult(operation, result);
1071 JITCompiler::Call callOperation(P_JITOperation_EStZB operation, GPRReg result, RegisteredStructure structure, size_t arg2, GPRReg butterfly)
1073 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(arg2), butterfly);
1074 return appendCallSetResult(operation, result);
1076 JITCompiler::Call callOperation(P_JITOperation_EStZB operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg butterfly)
1078 m_jit.setupArgumentsWithExecState(arg1, arg2, butterfly);
1079 return appendCallSetResult(operation, result);
1081 JITCompiler::Call callOperation(P_JITOperation_EStZB operation, GPRReg result, GPRReg arg1, GPRReg arg2, Butterfly* butterfly)
1083 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(butterfly));
1084 return appendCallSetResult(operation, result);
1086 JITCompiler::Call callOperation(P_JITOperation_EStPS operation, GPRReg result, RegisteredStructure structure, void* pointer, size_t size)
1088 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImmPtr(pointer), TrustedImmPtr(size));
1089 return appendCallSetResult(operation, result);
1091 JITCompiler::Call callOperation(P_JITOperation_EStSS operation, GPRReg result, RegisteredStructure structure, size_t index, size_t size)
1093 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImmPtr(index), TrustedImmPtr(size));
1094 return appendCallSetResult(operation, result);
1096 JITCompiler::Call callOperation(C_JITOperation_E operation, GPRReg result)
1098 m_jit.setupArgumentsExecState();
1099 return appendCallSetResult(operation, result);
1101 JITCompiler::Call callOperation(C_JITOperation_EC operation, GPRReg result, GPRReg arg1)
1103 m_jit.setupArgumentsWithExecState(arg1);
1104 return appendCallSetResult(operation, result);
1106 JITCompiler::Call callOperation(C_JITOperation_EC operation, GPRReg result, JSCell* cell)
1108 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), cell));
1109 return appendCallSetResult(operation, result);
1111 JITCompiler::Call callOperation(C_JITOperation_ECZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1113 m_jit.setupArgumentsWithExecState(arg1, arg2);
1114 return appendCallSetResult(operation, result);
1116 JITCompiler::Call callOperation(C_JITOperation_ECZC operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1118 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1119 return appendCallSetResult(operation, result);
1121 JITCompiler::Call callOperation(C_JITOperation_EJscC operation, GPRReg result, GPRReg arg1, JSCell* cell)
1123 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr::weakPointer(m_jit.graph(), cell));
1124 return appendCallSetResult(operation, result);
1126 JITCompiler::Call callOperation(C_JITOperation_EIcf operation, GPRReg result, InlineCallFrame* inlineCallFrame)
1128 m_jit.setupArgumentsWithExecState(TrustedImmPtr(inlineCallFrame));
1129 return appendCallSetResult(operation, result);
1131 JITCompiler::Call callOperation(C_JITOperation_ESt operation, GPRReg result, RegisteredStructure structure)
1133 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure));
1134 return appendCallSetResult(operation, result);
1138 JITCompiler::Call callOperation(C_JITOperation_EStJscSymtabJ operation, GPRReg result, RegisteredStructure structure, GPRReg scope, SymbolTable* table, TrustedImm64 initialValue)
1140 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), scope, TrustedImmPtr::weakPointer(m_jit.graph(), table), initialValue);
1141 return appendCallSetResult(operation, result);
1144 JITCompiler::Call callOperation(C_JITOperation_EStJscSymtabJ operation, GPRReg result, RegisteredStructure structure, GPRReg scope, SymbolTable* table, TrustedImm32 tag, TrustedImm32 payload)
1146 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), scope, TrustedImmPtr::weakPointer(m_jit.graph(), table), payload, tag);
1147 return appendCallSetResult(operation, result);
1150 JITCompiler::Call callOperation(C_JITOperation_EStZ operation, GPRReg result, RegisteredStructure structure, unsigned knownLength)
1152 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(knownLength));
1153 return appendCallSetResult(operation, result);
1155 JITCompiler::Call callOperation(C_JITOperation_EStZZ operation, GPRReg result, RegisteredStructure structure, unsigned knownLength, unsigned minCapacity)
1157 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(knownLength), TrustedImm32(minCapacity));
1158 return appendCallSetResult(operation, result);
1160 JITCompiler::Call callOperation(C_JITOperation_EStZ operation, GPRReg result, RegisteredStructure structure, GPRReg length)
1162 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), length);
1163 return appendCallSetResult(operation, result);
1165 JITCompiler::Call callOperation(C_JITOperation_EStZZ operation, GPRReg result, RegisteredStructure structure, GPRReg length, unsigned minCapacity)
1167 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), length, TrustedImm32(minCapacity));
1168 return appendCallSetResult(operation, result);
1170 JITCompiler::Call callOperation(C_JITOperation_EJssSt operation, GPRReg result, GPRReg arg1, RegisteredStructure structure)
1172 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(structure));
1173 return appendCallSetResult(operation, result);
1175 JITCompiler::Call callOperation(C_JITOperation_EJssJss operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1177 m_jit.setupArgumentsWithExecState(arg1, arg2);
1178 return appendCallSetResult(operation, result);
1180 JITCompiler::Call callOperation(C_JITOperation_B_EJssJss operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1182 m_jit.setupArgumentsWithExecState(arg1, arg2);
1183 return appendCallSetResult(operation, result);
1185 JITCompiler::Call callOperation(C_JITOperation_TT operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1187 m_jit.setupArguments(arg1, arg2);
1188 return appendCallSetResult(operation, result);
1190 JITCompiler::Call callOperation(C_JITOperation_EJssJssJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1192 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1193 return appendCallSetResult(operation, result);
1196 JITCompiler::Call callOperation(S_JITOperation_ECC operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1198 m_jit.setupArgumentsWithExecState(arg1, arg2);
1199 return appendCallSetResult(operation, result);
1202 JITCompiler::Call callOperation(S_JITOperation_EGC operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg2)
1204 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), globalObject), arg2);
1205 return appendCallSetResult(operation, result);
1208 JITCompiler::Call callOperation(C_JITOperation_EGC operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg2)
1210 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), globalObject), arg2);
1211 return appendCallSetResult(operation, result);
1214 JITCompiler::Call callOperation(Jss_JITOperation_EZ operation, GPRReg result, GPRReg arg1)
1216 m_jit.setupArgumentsWithExecState(arg1);
1217 return appendCallSetResult(operation, result);
1220 JITCompiler::Call callOperation(V_JITOperation_EC operation, GPRReg arg1)
1222 m_jit.setupArgumentsWithExecState(arg1);
1223 return appendCall(operation);
1226 JITCompiler::Call callOperation(V_JITOperation_ECliJsf operation, CallLinkInfo* callLinkInfo, GPRReg arg1)
1228 m_jit.setupArgumentsWithExecState(TrustedImmPtr(callLinkInfo), arg1);
1229 return appendCall(operation);
1232 JITCompiler::Call callOperation(V_JITOperation_EC operation, JSCell* arg1)
1234 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), arg1));
1235 return appendCall(operation);
1238 JITCompiler::Call callOperation(V_JITOperation_ECIcf operation, GPRReg arg1, InlineCallFrame* inlineCallFrame)
1240 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(inlineCallFrame));
1241 return appendCall(operation);
1243 JITCompiler::Call callOperation(V_JITOperation_ECCIcf operation, GPRReg arg1, GPRReg arg2, InlineCallFrame* inlineCallFrame)
1245 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(inlineCallFrame));
1246 return appendCall(operation);
1249 JITCompiler::Call callOperation(V_JITOperation_ECZ operation, GPRReg arg1, int arg2)
1251 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2));
1252 return appendCall(operation);
1254 JITCompiler::Call callOperation(V_JITOperation_ECC operation, GPRReg arg1, GPRReg arg2)
1256 m_jit.setupArgumentsWithExecState(arg1, arg2);
1257 return appendCall(operation);
1259 JITCompiler::Call callOperation(V_JITOperation_ECC operation, GPRReg arg1, JSCell* arg2)
1261 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr::weakPointer(m_jit.graph(), arg2));
1262 return appendCall(operation);
1264 JITCompiler::Call callOperation(V_JITOperation_ECC operation, JSCell* arg1, GPRReg arg2)
1266 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), arg1), arg2);
1267 return appendCall(operation);
1270 JITCompiler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb operation, void* pointer)
1272 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
1273 return appendCallWithCallFrameRollbackOnException(operation);
1276 JITCompiler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E operation, GPRReg result)
1278 m_jit.setupArgumentsExecState();
1279 return appendCallWithCallFrameRollbackOnExceptionSetResult(operation, result);
1281 JITCompiler::Call callOperation(Z_JITOperation_EC operation, GPRReg result, GPRReg arg1)
1283 m_jit.setupArgumentsWithExecState(arg1);
1284 return appendCallSetResult(operation, result);
1287 JITCompiler::Call callOperation(V_JITOperation_ECIZC operation, GPRReg regOp1, UniquedStringImpl* identOp2, int32_t op3, GPRReg regOp4)
1289 m_jit.setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4);
1290 return appendCall(operation);
1293 template<typename FunctionType, typename... Args>
1294 JITCompiler::Call callOperation(FunctionType operation, NoResultTag, Args... args)
1296 return callOperation(operation, args...);
1299 JITCompiler::Call callOperation(D_JITOperation_ZZ operation, FPRReg result, GPRReg arg1, GPRReg arg2)
1301 m_jit.setupArguments(arg1, arg2);
1302 return appendCallSetResult(operation, result);
1304 JITCompiler::Call callOperation(D_JITOperation_D operation, FPRReg result, FPRReg arg1)
1306 m_jit.setupArguments(arg1);
1307 return appendCallSetResult(operation, result);
1309 JITCompiler::Call callOperation(D_JITOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
1311 m_jit.setupArguments(arg1, arg2);
1312 return appendCallSetResult(operation, result);
1315 JITCompiler::Call callOperation(J_JITOperation_EJss operation, JSValueRegs result, GPRReg arg1)
1317 m_jit.setupArgumentsWithExecState(arg1);
1318 return appendCallSetResult(operation, result);
1321 JITCompiler::Call callOperation(T_JITOperation_EJss operation, GPRReg result, GPRReg arg1)
1323 m_jit.setupArgumentsWithExecState(arg1);
1324 return appendCallSetResult(operation, result);
1326 JITCompiler::Call callOperation(C_JITOperation_EJscZ operation, GPRReg result, GPRReg arg1, int32_t arg2)
1328 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2));
1329 return appendCallSetResult(operation, result);
1331 JITCompiler::Call callOperation(C_JITOperation_EZ operation, GPRReg result, GPRReg arg1)
1333 m_jit.setupArgumentsWithExecState(arg1);
1334 return appendCallSetResult(operation, result);
1336 JITCompiler::Call callOperation(C_JITOperation_EZ operation, GPRReg result, int32_t arg1)
1338 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
1339 return appendCallSetResult(operation, result);
1342 JITCompiler::Call callOperation(J_JITOperation_EJscC operation, GPRReg result, GPRReg arg1, JSCell* cell)
1344 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr::weakPointer(m_jit.graph(), cell));
1345 return appendCallSetResult(operation, result);
1348 JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg result, GPRReg arg1, JSCell* cell, GPRReg arg2)
1350 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr::weakPointer(m_jit.graph(), cell), arg2);
1351 return appendCallSetResult(operation, result);
1354 JITCompiler::Call callOperation(J_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1356 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1357 return appendCallSetResult(operation, result);
1360 JITCompiler::Call callOperation(J_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1362 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1363 return appendCallSetResult(operation, result);
1366 JITCompiler::Call callOperation(V_JITOperation_EWs operation, WatchpointSet* watchpointSet)
1368 m_jit.setupArgumentsWithExecState(TrustedImmPtr(watchpointSet));
1369 return appendCall(operation);
1372 JITCompiler::Call callOperation(C_JITOperation_ERUiUi operation, GPRReg result, GPRReg arg1, Imm32 arg2, GPRReg arg3)
1374 m_jit.setupArgumentsWithExecState(arg1, arg2.asTrustedImm32(), arg3);
1375 return appendCallSetResult(operation, result);
1378 JITCompiler::Call callOperation(C_JITOperation_EJscI operation, GPRReg result, GPRReg arg1, UniquedStringImpl* impl)
1380 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl));
1381 return appendCallSetResult(operation, result);
1386 JITCompiler::Call callOperation(Z_JITOperation_EOJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1388 m_jit.setupArgumentsWithExecState(arg1, arg2);
1389 return appendCallSetResult(operation, result);
1391 JITCompiler::Call callOperation(C_JITOperation_ECJZ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1393 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1394 return appendCallSetResult(operation, result);
1396 JITCompiler::Call callOperation(J_JITOperation_EJMic operation, JSValueRegs result, JSValueRegs arg, TrustedImmPtr mathIC)
1398 m_jit.setupArgumentsWithExecState(arg.gpr(), mathIC);
1399 return appendCallSetResult(operation, result.gpr());
1401 JITCompiler::Call callOperation(J_JITOperation_EJJMic operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, TrustedImmPtr mathIC)
1403 m_jit.setupArgumentsWithExecState(arg1.gpr(), arg2.gpr(), mathIC);
1404 return appendCallSetResult(operation, result.gpr());
1406 JITCompiler::Call callOperation(J_JITOperation_EJJI operation, GPRReg result, GPRReg arg1, GPRReg arg2, UniquedStringImpl* uid)
1408 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(uid));
1409 return appendCallSetResult(operation, result);
1411 JITCompiler::Call callOperation(V_JITOperation_EJJJI operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, UniquedStringImpl* uid)
1413 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, TrustedImmPtr(uid));
1414 return appendCall(operation);
1416 JITCompiler::Call callOperation(V_JITOperation_EJJJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4)
1418 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4);
1419 return appendCall(operation);
1421 JITCompiler::Call callOperation(V_JITOperation_EOJJZ operation, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3, GPRReg arg4)
1423 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg3.payloadGPR(), arg4);
1424 return appendCall(operation);
1426 JITCompiler::Call callOperation(V_JITOperation_EOJssJZ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3, GPRReg arg4)
1428 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3.payloadGPR(), arg4);
1429 return appendCall(operation);
1431 JITCompiler::Call callOperation(V_JITOperation_EOIJZ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3, GPRReg arg4)
1433 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3.payloadGPR(), arg4);
1434 return appendCall(operation);
1436 JITCompiler::Call callOperation(V_JITOperation_EOSymJZ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3, GPRReg arg4)
1438 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3.payloadGPR(), arg4);
1439 return appendCall(operation);
1441 JITCompiler::Call callOperation(V_JITOperation_EOJOOZ operation, GPRReg arg1, JSValueRegs arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1443 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg3, arg4, arg5);
1444 return appendCall(operation);
1446 JITCompiler::Call callOperation(V_JITOperation_EOJssOOZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1448 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4, arg5);
1449 return appendCall(operation);
1451 JITCompiler::Call callOperation(V_JITOperation_EOIOOZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1453 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4, arg5);
1454 return appendCall(operation);
1456 JITCompiler::Call callOperation(V_JITOperation_EOSymOOZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1458 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4, arg5);
1459 return appendCall(operation);
1461 JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, GPRReg arg2, UniquedStringImpl* impl, unsigned value)
1463 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(impl), TrustedImm32(value));
1464 return appendCall(operation);
1466 JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, GPRReg result, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
1468 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
1469 return appendCallSetResult(operation, result);
1471 JITCompiler::Call callOperation(J_JITOperation_E operation, GPRReg result)
1473 m_jit.setupArgumentsExecState();
1474 return appendCallSetResult(operation, result);
1476 JITCompiler::Call callOperation(J_JITOperation_EP operation, GPRReg result, void* pointer)
1478 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
1479 return appendCallSetResult(operation, result);
1481 JITCompiler::Call callOperation(Z_JITOperation_D operation, GPRReg result, FPRReg arg1)
1483 m_jit.setupArguments(arg1);
1484 JITCompiler::Call call = m_jit.appendCall(operation);
1485 m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, result);
1488 JITCompiler::Call callOperation(Q_JITOperation_J operation, GPRReg result, GPRReg value)
1490 m_jit.setupArguments(value);
1491 return appendCallSetResult(operation, result);
1493 JITCompiler::Call callOperation(Q_JITOperation_D operation, GPRReg result, FPRReg value)
1495 m_jit.setupArguments(value);
1496 return appendCallSetResult(operation, result);
1498 JITCompiler::Call callOperation(J_JITOperation_EI operation, GPRReg result, UniquedStringImpl* uid)
1500 m_jit.setupArgumentsWithExecState(TrustedImmPtr(uid));
1501 return appendCallSetResult(operation, result);
1503 JITCompiler::Call callOperation(J_JITOperation_EA operation, GPRReg result, GPRReg arg1)
1505 m_jit.setupArgumentsWithExecState(arg1);
1506 return appendCallSetResult(operation, result);
1508 JITCompiler::Call callOperation(J_JITOperation_EAZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1510 m_jit.setupArgumentsWithExecState(arg1, arg2);
1511 return appendCallSetResult(operation, result);
1513 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1515 m_jit.setupArgumentsWithExecState(arg1, arg2);
1516 return appendCallSetResult(operation, result);
1518 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1520 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1521 return appendCallSetResult(operation, result);
1523 JITCompiler::Call callOperation(J_JITOperation_EJssZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1525 m_jit.setupArgumentsWithExecState(arg1, arg2);
1526 return appendCallSetResult(operation, result);
1528 JITCompiler::Call callOperation(J_JITOperation_EPS operation, GPRReg result, void* pointer, size_t size)
1530 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer), TrustedImmPtr(size));
1531 return appendCallSetResult(operation, result);
1533 JITCompiler::Call callOperation(J_JITOperation_ESS operation, GPRReg result, int startConstant, int numConstants)
1535 m_jit.setupArgumentsWithExecState(TrustedImm32(startConstant), TrustedImm32(numConstants));
1536 return appendCallSetResult(operation, result);
1538 JITCompiler::Call callOperation(J_JITOperation_EPP operation, GPRReg result, GPRReg arg1, void* pointer)
1540 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(pointer));
1541 return appendCallSetResult(operation, result);
1543 JITCompiler::Call callOperation(J_JITOperation_EC operation, GPRReg result, JSCell* cell)
1545 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), cell));
1546 return appendCallSetResult(operation, result);
1548 JITCompiler::Call callOperation(J_JITOperation_ECZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1550 m_jit.setupArgumentsWithExecState(arg1, arg2);
1551 return appendCallSetResult(operation, result);
1553 JITCompiler::Call callOperation(J_JITOperation_ECZZ operation, GPRReg result, GPRReg arg1, GPRReg arg2, int32_t constant)
1555 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImm32(constant));
1556 return appendCallSetResult(operation, result);
1558 JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, GPRReg result, StructureStubInfo* stubInfo, GPRReg arg1, const UniquedStringImpl* uid)
1560 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
1561 return appendCallSetResult(operation, result);
1563 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, GPRReg result, StructureStubInfo* stubInfo, GPRReg arg1, UniquedStringImpl* uid)
1565 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
1566 return appendCallSetResult(operation, result);
1568 JITCompiler::Call callOperation(J_JITOperation_ESsiJJI operation, GPRReg result, StructureStubInfo* stubInfo, GPRReg arg1, GPRReg arg2, UniquedStringImpl* uid)
1570 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, arg2, TrustedImmPtr(uid));
1571 return appendCallSetResult(operation, result);
1573 JITCompiler::Call callOperation(J_JITOperation_EDA operation, GPRReg result, FPRReg arg1, GPRReg arg2)
1575 m_jit.setupArgumentsWithExecState(arg1, arg2);
1576 return appendCallSetResult(operation, result);
1578 JITCompiler::Call callOperation(J_JITOperation_EJC operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1580 m_jit.setupArgumentsWithExecState(arg1, arg2);
1581 return appendCallSetResult(operation, result);
1583 JITCompiler::Call callOperation(J_JITOperation_EJZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1585 m_jit.setupArgumentsWithExecState(arg1, arg2);
1586 return appendCallSetResult(operation, result);
1588 JITCompiler::Call callOperation(J_JITOperation_EJA operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1590 m_jit.setupArgumentsWithExecState(arg1, arg2);
1591 return appendCallSetResult(operation, result);
1593 JITCompiler::Call callOperation(J_JITOperation_EP operation, GPRReg result, GPRReg arg1)
1595 m_jit.setupArgumentsWithExecState(arg1);
1596 return appendCallSetResult(operation, result);
1598 JITCompiler::Call callOperation(J_JITOperation_EZ operation, GPRReg result, GPRReg arg1)
1600 m_jit.setupArgumentsWithExecState(arg1);
1601 return appendCallSetResult(operation, result);
1603 JITCompiler::Call callOperation(J_JITOperation_EZ operation, GPRReg result, int32_t arg1)
1605 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
1606 return appendCallSetResult(operation, result);
1608 JITCompiler::Call callOperation(J_JITOperation_EZZ operation, GPRReg result, int32_t arg1, GPRReg arg2)
1610 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2);
1611 return appendCallSetResult(operation, result);
1613 JITCompiler::Call callOperation(J_JITOperation_EZIcfZ operation, GPRReg result, int32_t arg1, InlineCallFrame* inlineCallFrame, GPRReg arg2)
1615 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), TrustedImmPtr(inlineCallFrame), arg2);
1616 return appendCallSetResult(operation, result);
1619 JITCompiler::Call callOperation(P_JITOperation_EJS operation, GPRReg result, GPRReg value, size_t index)
1621 m_jit.setupArgumentsWithExecState(value, TrustedImmPtr(index));
1622 return appendCallSetResult(operation, result);
1625 JITCompiler::Call callOperation(P_JITOperation_EStJ operation, GPRReg result, RegisteredStructure structure, GPRReg arg2)
1627 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2);
1628 return appendCallSetResult(operation, result);
1631 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg1)
1633 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), globalObject), arg1);
1634 return appendCallSetResult(operation, result);
1637 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, JSValueRegs arg1)
1639 return callOperation(operation, result, globalObject, arg1.gpr());
1642 JITCompiler::Call callOperation(C_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
1644 m_jit.setupArgumentsWithExecState(arg1);
1645 return appendCallSetResult(operation, result);
1647 JITCompiler::Call callOperation(C_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1649 m_jit.setupArgumentsWithExecState(arg1.gpr());
1650 return appendCallSetResult(operation, result);
1652 JITCompiler::Call callOperation(C_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1654 m_jit.setupArgumentsWithExecState(arg1, arg2);
1655 return appendCallSetResult(operation, result);
1657 JITCompiler::Call callOperation(C_JITOperation_EJJC operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1659 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1660 return appendCallSetResult(operation, result);
1662 JITCompiler::Call callOperation(C_JITOperation_EJJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1664 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1665 return appendCallSetResult(operation, result);
1667 JITCompiler::Call callOperation(C_JITOperation_EJZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1669 m_jit.setupArgumentsWithExecState(arg1, arg2);
1670 return appendCallSetResult(operation, result);
1672 JITCompiler::Call callOperation(C_JITOperation_EJZC operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1674 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1675 return appendCallSetResult(operation, result);
1677 JITCompiler::Call callOperation(S_JITOperation_J operation, GPRReg result, GPRReg arg1)
1679 m_jit.setupArguments(arg1);
1680 return appendCallSetResult(operation, result);
1682 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
1684 m_jit.setupArgumentsWithExecState(arg1);
1685 return appendCallSetResult(operation, result);
1687 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1689 return callOperation(operation, result, arg1.gpr());
1691 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
1693 return callOperation(operation, result.payloadGPR(), arg1.payloadGPR());
1695 JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1697 return callOperation(operation, result, arg1.payloadGPR());
1699 JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
1701 m_jit.setupArgumentsWithExecState(arg1);
1702 return appendCallSetResult(operation, result);
1704 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, GPRReg arg1, UniquedStringImpl* uid)
1706 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(uid));
1707 return appendCallSetResult(operation, result);
1709 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, JSValueRegs arg1, UniquedStringImpl* uid)
1711 return callOperation(operation, result, arg1.gpr(), uid);
1713 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1715 m_jit.setupArgumentsWithExecState(arg1, arg2);
1716 return appendCallSetResult(operation, result);
1718 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
1720 return callOperation(operation, result, arg1.gpr(), arg2.gpr());
1722 JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1724 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1725 return appendCallSetResult(operation, result);
1727 JITCompiler::Call callOperation(S_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1729 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1730 return appendCallSetResult(operation, result);
1732 JITCompiler::Call callOperation(S_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1734 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1735 return appendCallSetResult(operation, result);
1738 JITCompiler::Call callOperation(J_JITOperation_EPP operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1740 m_jit.setupArgumentsWithExecState(arg1, arg2);
1741 return appendCallSetResult(operation, result);
1743 JITCompiler::Call callOperation(J_JITOperation_EPPP operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1745 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1746 return appendCallSetResult(operation, result);
1748 JITCompiler::Call callOperation(J_JITOperation_EGP operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1750 m_jit.setupArgumentsWithExecState(arg1, arg2);
1751 return appendCallSetResult(operation, result);
1753 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1755 m_jit.setupArgumentsWithExecState(arg1, arg2);
1756 return appendCallSetResult(operation, result);
1758 JITCompiler::Call callOperation(J_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1760 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1761 return appendCallSetResult(operation, result);
1763 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, int32_t imm)
1765 m_jit.setupArgumentsWithExecState(arg1, MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm))));
1766 return appendCallSetResult(operation, result);
1768 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, int32_t imm, GPRReg arg2)
1770 m_jit.setupArgumentsWithExecState(MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm))), arg2);
1771 return appendCallSetResult(operation, result);
1773 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2)
1775 return callOperation(operation, result.payloadGPR(), arg1.payloadGPR(), arg2.payloadGPR());
1777 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1779 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1780 return appendCallSetResult(operation, result);
1782 JITCompiler::Call callOperation(J_JITOperation_ECC operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1784 m_jit.setupArgumentsWithExecState(arg1, arg2);
1785 return appendCallSetResult(operation, result);
1787 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1789 m_jit.setupArgumentsWithExecState(arg1, arg2);
1790 return appendCallSetResult(operation, result);
1792 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2)
1794 m_jit.setupArgumentsWithExecState(arg1, arg2.gpr());
1795 return appendCallSetResult(operation, result);
1798 JITCompiler::Call callOperation(V_JITOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3)
1800 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1801 return appendCall(operation);
1803 JITCompiler::Call callOperation(V_JITOperation_EJ operation, GPRReg arg1)
1805 m_jit.setupArgumentsWithExecState(arg1);
1806 return appendCall(operation);
1808 JITCompiler::Call callOperation(V_JITOperation_EJPP operation, GPRReg arg1, GPRReg arg2, void* pointer)
1810 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(pointer));
1811 return appendCall(operation);
1813 JITCompiler::Call callOperation(V_JITOperation_ESsiJJI operation, StructureStubInfo* stubInfo, GPRReg arg1, GPRReg arg2, UniquedStringImpl* uid)
1815 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, arg2, TrustedImmPtr(uid));
1816 return appendCall(operation);
1818 JITCompiler::Call callOperation(V_JITOperation_EJJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1820 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1821 return appendCall(operation);
1823 JITCompiler::Call callOperation(V_JITOperation_EPZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1825 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1826 return appendCall(operation);
1829 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1831 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1832 return appendCall(operation);
1834 JITCompiler::Call callOperation(V_JITOperation_ECJ operation, GPRReg arg1, JSValueRegs arg2)
1836 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR());
1837 return appendCall(operation);
1839 JITCompiler::Call callOperation(V_JITOperation_ECJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1841 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1842 return appendCall(operation);
1845 JITCompiler::Call callOperation(Z_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1847 m_jit.setupArgumentsWithExecState(arg1.payloadGPR());
1848 return appendCallSetResult(operation, result);
1851 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, GPRReg arg1, unsigned arg2, unsigned arg3)
1853 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2), TrustedImm32(arg3));
1854 return appendCallSetResult(operation, result);
1856 JITCompiler::Call callOperation(F_JITOperation_EFJZZ operation, GPRReg result, GPRReg arg1, GPRReg arg2, unsigned arg3, GPRReg arg4)
1858 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImm32(arg3), arg4);
1859 return appendCallSetResult(operation, result);
1862 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1864 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1865 return appendCallSetResult(operation, result);
1867 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, JSValueRegs arg1, GPRReg arg2, JSValueRegs arg3)
1869 return callOperation(operation, result, arg1.payloadGPR(), arg2, arg3.payloadGPR());
1872 JITCompiler::Call callOperation(Z_JITOperation_EJZ operation, GPRReg result, GPRReg arg1, unsigned arg2)
1874 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2));
1875 return appendCallSetResult(operation, result);
1877 JITCompiler::Call callOperation(V_JITOperation_EZJZZZ operation, unsigned arg1, GPRReg arg2, unsigned arg3, GPRReg arg4, unsigned arg5)
1879 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2, TrustedImm32(arg3), arg4, TrustedImm32(arg5));
1880 return appendCall(operation);
1882 JITCompiler::Call callOperation(V_JITOperation_ECJZC operation, GPRReg regOp1, GPRReg regOp2, int32_t op3, GPRReg regOp4)
1884 m_jit.setupArgumentsWithExecState(regOp1, regOp2, TrustedImm32(op3), regOp4);
1885 return appendCall(operation);
1887 JITCompiler::Call callOperation(V_JITOperation_ECIZJJ operation, GPRReg regOp1, UniquedStringImpl* identOp2, int32_t op3, GPRReg regOp4, GPRReg regOp5)
1889 m_jit.setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4, regOp5);
1890 return appendCall(operation);
1892 JITCompiler::Call callOperation(D_JITOperation_EJ operation, FPRReg result, JSValueRegs arg1)
1894 m_jit.setupArgumentsWithExecState(arg1.gpr());
1895 return appendCallSetResult(operation, result);
1897 #else // USE(JSVALUE32_64)
1898 JITCompiler::Call callOperation(Z_JITOperation_EOJ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2)
1900 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
1901 return appendCallSetResult(operation, result);
1903 JITCompiler::Call callOperation(C_JITOperation_ECJZ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2, GPRReg arg3)
1905 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3);
1906 return appendCallSetResult(operation, result);
1908 JITCompiler::Call callOperation(J_JITOperation_EJMic operation, JSValueRegs result, JSValueRegs arg, TrustedImmPtr mathIC)
1910 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg.payloadGPR(), arg.tagGPR(), mathIC);
1911 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1913 JITCompiler::Call callOperation(J_JITOperation_EJZ operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
1915 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
1916 return appendCallSetResult(operation, result);
1918 JITCompiler::Call callOperation(J_JITOperation_EJJMic operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, TrustedImmPtr mathIC)
1920 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), mathIC);
1921 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1924 JITCompiler::Call callOperation(J_JITOperation_EJJI operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, UniquedStringImpl* uid)
1926 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), TrustedImmPtr(uid));
1927 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1929 JITCompiler::Call callOperation(V_JITOperation_EJJJI operation, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3, UniquedStringImpl* uid)
1931 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR(), TrustedImmPtr(uid));
1932 return appendCall(operation);
1934 JITCompiler::Call callOperation(V_JITOperation_EJJJJ operation, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3, JSValueRegs arg4)
1936 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR(), arg4.payloadGPR(), arg4.tagGPR());
1937 return appendCall(operation);
1939 JITCompiler::Call callOperation(V_JITOperation_EOJJZ operation, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3, GPRReg arg4)
1941 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR(), arg4);
1942 return appendCall(operation);
1944 JITCompiler::Call callOperation(V_JITOperation_EOJssJZ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3, GPRReg arg4)
1946 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR(), arg4);
1947 return appendCall(operation);
1949 JITCompiler::Call callOperation(V_JITOperation_EOIJZ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3, GPRReg arg4)
1951 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR(), arg4);
1952 return appendCall(operation);
1954 JITCompiler::Call callOperation(V_JITOperation_EOSymJZ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3, GPRReg arg4)
1956 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR(), arg4);
1957 return appendCall(operation);
1959 JITCompiler::Call callOperation(V_JITOperation_EOJOOZ operation, GPRReg arg1, JSValueRegs arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1961 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3, arg4, arg5);
1962 return appendCall(operation);
1964 JITCompiler::Call callOperation(V_JITOperation_EOJssOOZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1966 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4, arg5);
1967 return appendCall(operation);
1969 JITCompiler::Call callOperation(V_JITOperation_EOIOOZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1971 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4, arg5);
1972 return appendCall(operation);
1974 JITCompiler::Call callOperation(V_JITOperation_EOSymOOZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
1976 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4, arg5);
1977 return appendCall(operation);
1979 JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, JSValueRegs arg2, UniquedStringImpl* impl, unsigned value)
1981 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), TrustedImmPtr(impl), TrustedImm32(value));
1982 return appendCall(operation);
1984 JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, JSValueRegs result, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
1986 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
1987 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1989 JITCompiler::Call callOperation(D_JITOperation_G operation, FPRReg result, JSGlobalObject* globalObject)
1991 m_jit.setupArguments(TrustedImmPtr::weakPointer(m_jit.graph(), globalObject));
1992 return appendCallSetResult(operation, result);
1994 JITCompiler::Call callOperation(Z_JITOperation_D operation, GPRReg result, FPRReg arg1)
1996 prepareForExternalCall();
1997 m_jit.setupArguments(arg1);
1998 JITCompiler::Call call = m_jit.appendCall(operation);
1999 m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, result);
2002 JITCompiler::Call callOperation(J_JITOperation_E operation, JSValueRegs result)
2004 m_jit.setupArgumentsExecState();
2005 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2007 JITCompiler::Call callOperation(J_JITOperation_EP operation, JSValueRegs result, void* pointer)
2009 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
2010 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2012 JITCompiler::Call callOperation(J_JITOperation_EPP operation, JSValueRegs result, GPRReg arg1, void* pointer)
2014 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(pointer));
2015 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2017 JITCompiler::Call callOperation(J_JITOperation_EPP operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2019 m_jit.setupArgumentsWithExecState(arg1, arg2);
2020 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2022 JITCompiler::Call callOperation(J_JITOperation_EPPP operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
2024 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
2025 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2027 JITCompiler::Call callOperation(J_JITOperation_EGP operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2029 m_jit.setupArgumentsWithExecState(arg1, arg2);
2030 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2032 JITCompiler::Call callOperation(J_JITOperation_EP operation, JSValueRegs result, GPRReg arg1)
2034 m_jit.setupArgumentsWithExecState(arg1);
2035 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2037 JITCompiler::Call callOperation(J_JITOperation_EI operation, JSValueRegs result, UniquedStringImpl* uid)
2039 m_jit.setupArgumentsWithExecState(TrustedImmPtr(uid));
2040 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2042 JITCompiler::Call callOperation(J_JITOperation_EA operation, JSValueRegs result, GPRReg arg1)
2044 m_jit.setupArgumentsWithExecState(arg1);
2045 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2047 JITCompiler::Call callOperation(J_JITOperation_EAZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2049 m_jit.setupArgumentsWithExecState(arg1, arg2);
2050 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2052 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, GPRReg arg1)
2054 m_jit.setupArgumentsWithExecState(arg1);
2055 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2057 JITCompiler::Call callOperation(J_JITOperation_EJC operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
2059 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
2060 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2062 JITCompiler::Call callOperation(J_JITOperation_EJssZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2064 m_jit.setupArgumentsWithExecState(arg1, arg2);
2065 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2067 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2069 m_jit.setupArgumentsWithExecState(arg1, arg2);
2070 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2072 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
2074 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
2075 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2077 JITCompiler::Call callOperation(J_JITOperation_EPS operation, JSValueRegs result, void* pointer, size_t size)
2079 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer), TrustedImmPtr(size));
2080 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2082 JITCompiler::Call callOperation(J_JITOperation_ESS operation, JSValueRegs result, int startConstant, int numConstants)
2084 m_jit.setupArgumentsWithExecState(TrustedImm32(startConstant), TrustedImm32(numConstants));
2085 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2087 JITCompiler::Call callOperation(J_JITOperation_EJP operation, JSValueRegs result, JSValueRegs arg1, void* pointer)
2089 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImmPtr(pointer));
2090 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2092 JITCompiler::Call callOperation(J_JITOperation_EJP operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
2094 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
2095 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2098 JITCompiler::Call callOperation(J_JITOperation_EC operation, JSValueRegs result, JSCell* cell)
2100 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), cell));
2101 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2103 JITCompiler::Call callOperation(J_JITOperation_ECZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2105 m_jit.setupArgumentsWithExecState(arg1, arg2);
2106 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2108 JITCompiler::Call callOperation(J_JITOperation_ECZZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, int32_t constant)
2110 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImm32(constant));
2111 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2113 JITCompiler::Call callOperation(J_JITOperation_EJscC operation, JSValueRegs result, GPRReg arg1, JSCell* cell)
2115 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr::weakPointer(m_jit.graph(), cell));
2116 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2118 JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg result, GPRReg arg1, JSCell* cell, JSValueRegs arg2)
2120 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr::weakPointer(m_jit.graph(), cell), EABI_32BIT_DUMMY_ARG arg2.payloadGPR(), arg2.tagGPR());
2121 return appendCallSetResult(operation, result);
2123 JITCompiler::Call callOperation(J_JITOperation_EGReoJ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
2125 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2126 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2128 JITCompiler::Call callOperation(J_JITOperation_EGReoJss operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
2130 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
2131 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2133 JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, JSValueRegs result, StructureStubInfo* stubInfo, GPRReg arg1, const UniquedStringImpl* uid)
2135 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
2136 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2138 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, JSValueRegs result, StructureStubInfo* stubInfo, JSValueRegs arg1, UniquedStringImpl* uid)
2140 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1.payloadGPR(), arg1.tagGPR(), TrustedImmPtr(uid));
2141 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2143 JITCompiler::Call callOperation(J_JITOperation_ESsiJJI operation, JSValueRegs result, StructureStubInfo* stubInfo, JSValueRegs arg1, JSValueRegs arg2, UniquedStringImpl* uid)
2145 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), TrustedImmPtr(uid));
2146 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2148 JITCompiler::Call callOperation(J_JITOperation_ESsiJJI operation, JSValueRegs result, StructureStubInfo* stubInfo, int32_t arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, UniquedStringImpl* uid)
2150 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, TrustedImm32(arg1Tag), arg2Payload, arg2Tag, TrustedImmPtr(uid));
2151 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2153 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, JSValueRegs result, StructureStubInfo* stubInfo, int32_t arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
2155 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, TrustedImm32(arg1Tag), TrustedImmPtr(uid));
2156 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2158 JITCompiler::Call callOperation(J_JITOperation_ESsiJJI operation, JSValueRegs result, StructureStubInfo* stubInfo, int32_t arg1Tag, GPRReg arg1Payload, int32_t arg2Tag, GPRReg arg2Payload, UniquedStringImpl* uid)
2160 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, TrustedImm32(arg1Tag), arg2Payload, TrustedImm32(arg2Tag), TrustedImmPtr(uid));
2161 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2163 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, JSValueRegs result, StructureStubInfo* stubInfo, GPRReg arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
2165 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, arg1Tag, TrustedImmPtr(uid));
2166 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2168 JITCompiler::Call callOperation(J_JITOperation_EDA operation, JSValueRegs result, FPRReg arg1, GPRReg arg2)
2170 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1, arg2);
2171 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2173 JITCompiler::Call callOperation(J_JITOperation_EJA operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
2175 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
2176 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2178 JITCompiler::Call callOperation(J_JITOperation_EJA operation, JSValueRegs result, TrustedImm32 arg1Tag, GPRReg arg1Payload, GPRReg arg2)
2180 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
2181 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2183 JITCompiler::Call callOperation(J_JITOperation_EJA operation, JSValueRegs result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
2185 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
2186 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2188 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
2190 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2191 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2193 JITCompiler::Call callOperation(J_JITOperation_EZ operation, JSValueRegs result, GPRReg arg1)
2195 m_jit.setupArgumentsWithExecState(arg1);
2196 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2198 JITCompiler::Call callOperation(J_JITOperation_EZ operation, JSValueRegs result, int32_t arg1)
2200 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
2201 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2203 JITCompiler::Call callOperation(J_JITOperation_EZIcfZ operation, JSValueRegs result, int32_t arg1, InlineCallFrame* inlineCallFrame, GPRReg arg2)
2205 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), TrustedImmPtr(inlineCallFrame), arg2);
2206 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2208 JITCompiler::Call callOperation(J_JITOperation_EZZ operation, JSValueRegs result, int32_t arg1, GPRReg arg2)
2210 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2);
2211 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2214 JITCompiler::Call callOperation(P_JITOperation_EJS operation, GPRReg result, JSValueRegs value, size_t index)
2216 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG value.payloadGPR(), value.tagGPR(), TrustedImmPtr(index));
2217 return appendCallSetResult(operation, result);
2220 JITCompiler::Call callOperation(P_JITOperation_EStJ operation, GPRReg result, RegisteredStructure structure, JSValueRegs arg2)
2222 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2.payloadGPR(), arg2.tagGPR());
2223 return appendCallSetResult(operation, result);
2226 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, JSValueRegs arg1)
2228 m_jit.setupArgumentsWithExecState(TrustedImmPtr::weakPointer(m_jit.graph(), globalObject), arg1.payloadGPR(), arg1.tagGPR());
2229 return appendCallSetResult(operation, result);
2232 JITCompiler::Call callOperation(C_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
2234 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2235 return appendCallSetResult(operation, result);
2238 JITCompiler::Call callOperation(C_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
2240 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR());
2241 return appendCallSetResult(operation, result);
2244 JITCompiler::Call callOperation(C_JITOperation_EJJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3)
2246 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2247 return appendCallSetResult(operation, result);
2250 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
2252 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2253 return appendCallSetResult(operation, result);
2256 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, JSValueRegs arg1, UniquedStringImpl* uid)
2258 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImmPtr(uid));
2259 return appendCallSetResult(operation, result);
2262 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
2264 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR());
2265 return appendCallSetResult(operation, result);
2268 JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3)
2270 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2271 return appendCallSetResult(operation, result);
2273 JITCompiler::Call callOperation(S_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
2275 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2276 return appendCallSetResult(operation, result);
2278 JITCompiler::Call callOperation(S_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
2280 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
2281 return appendCallSetResult(operation, result);
2283 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2)
2285 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR());
2286 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2288 JITCompiler::Call callOperation(J_JITOperation_EGJJ operation, JSValueRegs result, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3)
2290 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2291 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2293 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, MacroAssembler::TrustedImm32 imm)
2295 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), imm, TrustedImm32(JSValue::Int32Tag));
2296 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2298 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, MacroAssembler::TrustedImm32 imm, JSValueRegs arg2)
2300 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG imm, TrustedImm32(JSValue::Int32Tag), arg2.payloadGPR(), arg2.tagGPR());
2301 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2303 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3)
2305 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2306 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2309 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, JSValueRegs result, GPRReg arg1, JSValueRegs arg2)
2311 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
2312 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2314 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2Payload)
2316 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, MacroAssembler::TrustedImm32(JSValue::CellTag));
2317 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2319 JITCompiler::Call callOperation(J_JITOperation_ECC operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2321 m_jit.setupArgumentsWithExecState(arg1, arg2);
2322 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2325 JITCompiler::Call callOperation(V_JITOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3)
2327 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3);
2328 return appendCall(operation);
2331 JITCompiler::Call callOperation(V_JITOperation_EJ operation, JSValueRegs arg1)
2333 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2334 return appendCall(operation);
2337 JITCompiler::Call callOperation(V_JITOperation_EJPP operation, JSValueRegs arg1, GPRReg arg2, void* pointer)
2339 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2, TrustedImmPtr(pointer));
2340 return appendCall(operation);
2342 JITCompiler::Call callOperation(V_JITOperation_ESsiJJI operation, StructureStubInfo* stubInfo, JSValueRegs arg1, GPRReg arg2Payload, UniquedStringImpl* uid)
2344 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1.payloadGPR(), arg1.tagGPR(), arg2Payload, TrustedImm32(JSValue::CellTag), TrustedImmPtr(uid));
2345 return appendCall(operation);
2347 JITCompiler::Call callOperation(V_JITOperation_ECJ operation, GPRReg arg1, JSValueRegs arg2)
2349 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
2350 return appendCall(operation);
2352 JITCompiler::Call callOperation(V_JITOperation_ECJJ operation, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3)
2354 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2355 return appendCall(operation);
2358 JITCompiler::Call callOperation(V_JITOperation_EPZJ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
2360 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2361 return appendCall(operation);
2364 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
2366 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2367 return appendCall(operation);
2369 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, TrustedImm32 arg3Tag, GPRReg arg3Payload)
2371 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2372 return appendCall(operation);
2374 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
2376 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2377 return appendCall(operation);
2380 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, JSValueRegs arg1, GPRReg arg2, JSValueRegs arg3)
2382 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2383 return appendCallSetResult(operation, result);
2385 JITCompiler::Call callOperation(Z_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
2387 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2388 return appendCallSetResult(operation, result);
2390 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, JSValueRegs arg1, unsigned arg2, unsigned arg3)
2392 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImm32(arg2), TrustedImm32(arg3));
2393 return appendCallSetResult(operation, result);
2395 JITCompiler::Call callOperation(F_JITOperation_EFJZZ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2, unsigned arg3, GPRReg arg4)
2397 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), TrustedImm32(arg3), arg4);
2398 return appendCallSetResult(operation, result);
2400 JITCompiler::Call callOperation(Z_JITOperation_EJZ operation, GPRReg result, JSValueRegs arg1, unsigned arg2)
2402 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImm32(arg2));
2403 return appendCallSetResult(operation, result);
2405 JITCompiler::Call callOperation(V_JITOperation_EZJZZZ operation, unsigned arg1, JSValueRegs arg2, unsigned arg3, GPRReg arg4, unsigned arg5)
2407 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2.payloadGPR(), arg2.tagGPR(), TrustedImm32(arg3), arg4, TrustedImm32(arg5));
2408 return appendCall(operation);
2410 JITCompiler::Call callOperation(V_JITOperation_ECJZC operation, GPRReg arg1, JSValueRegs arg2, int32_t arg3, GPRReg arg4)
2412 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), TrustedImm32(arg3), arg4);
2413 return appendCall(operation);
2415 JITCompiler::Call callOperation(V_JITOperation_ECIZCC operation, GPRReg arg1, UniquedStringImpl* identOp2, int32_t op3, GPRReg arg4, GPRReg arg5)
2417 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(identOp2), TrustedImm32(op3), arg4, arg5);
2418 return appendCall(operation);
2420 JITCompiler::Call callOperation(D_JITOperation_EJ operation, FPRReg result, JSValueRegs arg1)
2422 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2423 return appendCallSetResult(operation, result);
2425 #endif // USE(JSVALUE32_64)
2427 #if !defined(NDEBUG) && !CPU(ARM) && !CPU(MIPS)
2428 void prepareForExternalCall()
2430 // We're about to call out to a "native" helper function. The helper
2431 // function is expected to set topCallFrame itself with the ExecState
2432 // that is passed to it.
2434 // We explicitly trash topCallFrame here so that we'll know if some of
2435 // the helper functions are not setting topCallFrame when they should
2436 // be doing so. Note: the previous value in topcallFrame was not valid
2437 // anyway since it was not being updated by JIT'ed code by design.
2439 for (unsigned i = 0; i < sizeof(void*) / 4; i++)
2440 m_jit.store32(TrustedImm32(0xbadbeef), reinterpret_cast<char*>(&m_jit.vm()->topCallFrame) + i * 4);
2443 void prepareForExternalCall() { }
2446 // These methods add call instructions, optionally setting results, and optionally rolling back the call frame on an exception.
2447 JITCompiler::Call appendCall(const FunctionPtr& function)
2449 prepareForExternalCall();
2450 m_jit.emitStoreCodeOrigin(m_currentNode->origin.semantic);
2451 return m_jit.appendCall(function);
2453 JITCompiler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr& function)
2455 JITCompiler::Call call = appendCall(function);
2456 m_jit.exceptionCheckWithCallFrameRollback();
2459 JITCompiler::Call appendCallWithCallFrameRollbackOnExceptionSetResult(const FunctionPtr& function, GPRReg result)
2461 JITCompiler::Call call = appendCallWithCallFrameRollbackOnException(function);
2462 if ((result != InvalidGPRReg) && (result != GPRInfo::returnValueGPR))
2463 m_jit.move(GPRInfo::returnValueGPR, result);
2466 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result)
2468 JITCompiler::Call call = appendCall(function);
2469 if (result != InvalidGPRReg)
2470 m_jit.move(GPRInfo::returnValueGPR, result);
2473 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result1, GPRReg result2)
2475 JITCompiler::Call call = appendCall(function);
2476 m_jit.setupResults(result1, result2);
2479 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, JSValueRegs resultRegs)
2482 return appendCallSetResult(function, resultRegs.gpr());
2484 return appendCallSetResult(function, resultRegs.payloadGPR(), resultRegs.tagGPR());
2488 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2490 JITCompiler::Call call = appendCall(function);
2491 if (result != InvalidFPRReg) {
2492 m_jit.assembler().fstpl(0, JITCompiler::stackPointerRegister);
2493 m_jit.loadDouble(JITCompiler::stackPointerRegister, result);
2497 #elif CPU(ARM) && !CPU(ARM_HARDFP)
2498 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2500 JITCompiler::Call call = appendCall(function);
2501 if (result != InvalidFPRReg)
2502 m_jit.assembler().vmov(result, GPRInfo::returnValueGPR, GPRInfo::returnValueGPR2);
2505 #else // CPU(X86_64) || (CPU(ARM) && CPU(ARM_HARDFP)) || CPU(ARM64) || CPU(MIPS)
2506 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2508 JITCompiler::Call call = appendCall(function);
2509 if (result != InvalidFPRReg)
2510 m_jit.moveDouble(FPRInfo::returnValueFPR, result);
2515 void branchDouble(JITCompiler::DoubleCondition cond, FPRReg left, FPRReg right, BasicBlock* destination)
2517 return addBranch(m_jit.branchDouble(cond, left, right), destination);
2520 void branchDoubleNonZero(FPRReg value, FPRReg scratch, BasicBlock* destination)
2522 return addBranch(m_jit.branchDoubleNonZero(value, scratch), destination);
2525 template<typename T, typename U>
2526 void branch32(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2528 return addBranch(m_jit.branch32(cond, left, right), destination);
2531 template<typename T, typename U>
2532 void branchTest32(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2534 return addBranch(m_jit.branchTest32(cond, value, mask), destination);
2537 template<typename T>
2538 void branchTest32(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2540 return addBranch(m_jit.branchTest32(cond, value), destination);
2544 template<typename T, typename U>
2545 void branch64(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2547 return addBranch(m_jit.branch64(cond, left, right), destination);
2551 template<typename T, typename U>
2552 void branch8(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2554 return addBranch(m_jit.branch8(cond, left, right), destination);
2557 template<typename T, typename U>
2558 void branchPtr(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2560 return addBranch(m_jit.branchPtr(cond, left, right), destination);
2563 template<typename T, typename U>
2564 void branchTestPtr(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2566 return addBranch(m_jit.branchTestPtr(cond, value, mask), destination);
2569 template<typename T>
2570 void branchTestPtr(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2572 return addBranch(m_jit.branchTestPtr(cond, value), destination);
2575 template<typename T, typename U>
2576 void branchTest8(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2578 return addBranch(m_jit.branchTest8(cond, value, mask), destination);
2581 template<typename T>
2582 void branchTest8(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2584 return addBranch(m_jit.branchTest8(cond, value), destination);
2587 enum FallThroughMode {
2591 void jump(BasicBlock* destination, FallThroughMode fallThroughMode = AtFallThroughPoint)
2593 if (destination == nextBlock()
2594 && fallThroughMode == AtFallThroughPoint)
2596 addBranch(m_jit.jump(), destination);
2599 void addBranch(const MacroAssembler::Jump& jump, BasicBlock* destination)
2601 m_branches.append(BranchRecord(jump, destination));
2603 void addBranch(const MacroAssembler::JumpList& jump, BasicBlock* destination);
2605 void linkBranches();
2607 void dump(const char* label = 0);
2609 bool betterUseStrictInt52(Node* node)
2611 return !generationInfo(node).isInt52();
2613 bool betterUseStrictInt52(Edge edge)
2615 return betterUseStrictInt52(edge.node());
2618 bool compare(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_JITOperation_EJJ);
2619 bool compilePeepHoleBranch(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_JITOperation_EJJ);
2620 void compilePeepHoleInt32Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2621 void compilePeepHoleInt52Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2622 void compilePeepHoleBooleanBranch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2623 void compilePeepHoleDoubleBranch(Node*, Node* branchNode, JITCompiler::DoubleCondition);
2624 void compilePeepHoleObjectEquality(Node*, Node* branchNode);
2625 void compilePeepHoleObjectStrictEquality(Edge objectChild, Edge otherChild, Node* branchNode);
2626 void compilePeepHoleObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild, Node* branchNode);
2627 void compileObjectEquality(Node*);
2628 void compileObjectStrictEquality(Edge objectChild, Edge otherChild);
2629 void compileObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild);
2630 void compileObjectOrOtherLogicalNot(Edge value);
2631 void compileLogicalNot(Node*);
2632 void compileLogicalNotStringOrOther(Node*);
2633 void compileStringEquality(
2634 Node*, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR,
2635 GPRReg leftTempGPR, GPRReg rightTempGPR, GPRReg leftTemp2GPR,
2636 GPRReg rightTemp2GPR, JITCompiler::JumpList fastTrue,
2637 JITCompiler::JumpList fastSlow);
2638 void compileStringEquality(Node*);
2639 void compileStringIdentEquality(Node*);
2640 void compileStringToUntypedEquality(Node*, Edge stringEdge, Edge untypedEdge);
2641 void compileStringIdentToNotStringVarEquality(Node*, Edge stringEdge, Edge notStringVarEdge);
2642 void compileStringZeroLength(Node*);
2643 void compileMiscStrictEq(Node*);
2645 void compileSymbolEquality(Node*);
2646 void compilePeepHoleSymbolEquality(Node*, Node* branchNode);
2647 void compileSymbolUntypedEquality(Node*, Edge symbolEdge, Edge untypedEdge);
2649 void emitObjectOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2650 void emitStringBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2651 void emitStringOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2652 void emitBranch(Node*);
2654 struct StringSwitchCase {
2655 StringSwitchCase() { }
2657 StringSwitchCase(StringImpl* string, BasicBlock* target)
2663 bool operator<(const StringSwitchCase& other) const
2665 return stringLessThan(*string, *other.string);
2672 void emitSwitchIntJump(SwitchData*, GPRReg value, GPRReg scratch);
2673 void emitSwitchImm(Node*, SwitchData*);
2674 void emitSwitchCharStringJump(SwitchData*, GPRReg value, GPRReg scratch);
2675 void emitSwitchChar(Node*, SwitchData*);
2676 void emitBinarySwitchStringRecurse(
2677 SwitchData*, const Vector<StringSwitchCase>&, unsigned numChecked,
2678 unsigned begin, unsigned end, GPRReg buffer, GPRReg length, GPRReg temp,
2679 unsigned alreadyCheckedLength, bool checkedExactLength);
2680 void emitSwitchStringOnString(SwitchData*, GPRReg string);
2681 void emitSwitchString(Node*, SwitchData*);
2682 void emitSwitch(Node*);
2684 void compileToStringOrCallStringConstructorOnCell(Node*);
2685 void compileNewStringObject(Node*);
2687 void compileNewTypedArray(Node*);
2689 void compileInt32Compare(Node*, MacroAssembler::RelationalCondition);
2690 void compileInt52Compare(Node*, MacroAssembler::RelationalCondition);
2691 void compileBooleanCompare(Node*, MacroAssembler::RelationalCondition);
2692 void compileDoubleCompare(Node*, MacroAssembler::DoubleCondition);
2693 void compileStringCompare(Node*, MacroAssembler::RelationalCondition);
2694 void compileStringIdentCompare(Node*, MacroAssembler::RelationalCondition);
2696 bool compileStrictEq(Node*);
2698 void compileAllocatePropertyStorage(Node*);
2699 void compileReallocatePropertyStorage(Node*);
2700 void compileNukeStructureAndSetButterfly(Node*);
2701 void compileGetButterfly(Node*);
2702 void compileCallDOMGetter(Node*);
2703 void compileCallDOM(Node*);
2704 void compileCheckDOM(Node*);
2706 #if USE(JSVALUE32_64)
2707 template<typename BaseOperandType, typename PropertyOperandType, typename ValueOperandType, typename TagType>
2708 void compileContiguousPutByVal(Node*, BaseOperandType&, PropertyOperandType&, ValueOperandType&, GPRReg valuePayloadReg, TagType valueTag);
2710 void compileDoublePutByVal(Node*, SpeculateCellOperand& base, SpeculateStrictInt32Operand& property);
2711 bool putByValWillNeedExtraRegister(ArrayMode arrayMode)
2713 return arrayMode.mayStoreToHole();
2715 GPRReg temporaryRegisterForPutByVal(GPRTemporary&, ArrayMode);
2716 GPRReg temporaryRegisterForPutByVal(GPRTemporary& temporary, Node* node)
2718 return temporaryRegisterForPutByVal(temporary, node->arrayMode());
2721 void compileGetCharCodeAt(Node*);
2722 void compileGetByValOnString(Node*);
2723 void compileFromCharCode(Node*);
2725 void compileGetByValOnDirectArguments(Node*);
2726 void compileGetByValOnScopedArguments(Node*);
2728 void compileGetScope(Node*);
2729 void compileSkipScope(Node*);
2730 void compileGetGlobalObject(Node*);
2732 void compileGetArrayLength(Node*);
2734 void compileCheckTypeInfoFlags(Node*);
2735 void compileCheckStringIdent(Node*);
2737 void compileParseInt(Node*);
2739 void compileValueRep(Node*);
2740 void compileDoubleRep(Node*);
2742 void compileValueToInt32(Node*);
2743 void compileUInt32ToNumber(Node*);
2744 void compileDoubleAsInt32(Node*);
2746 template<typename SnippetGenerator, J_JITOperation_EJJ slowPathFunction>
2747 void emitUntypedBitOp(Node*);
2748 void compileBitwiseOp(Node*);
2750 void emitUntypedRightShiftBitOp(Node*);
2751 void compileShiftOp(Node*);
2753 template <typename Generator, typename RepatchingFunction, typename NonRepatchingFunction>
2754 void compileMathIC(Node*, JITBinaryMathIC<Generator>*, bool needsScratchGPRReg, bool needsScratchFPRReg, RepatchingFunction, NonRepatchingFunction);
2755 template <typename Generator, typename RepatchingFunction, typename NonRepatchingFunction>
2756 void compileMathIC(Node*, JITUnaryMathIC<Generator>*, bool needsScratchGPRReg, RepatchingFunction, NonRepatchingFunction);
2758 void compileArithDoubleUnaryOp(Node*, double (*doubleFunction)(double), double (*operation)(ExecState*, EncodedJSValue));
2759 void compileValueAdd(Node*);
2760 void compileArithAdd(Node*);
2761 void compileMakeRope(Node*);
2762 void compileArithAbs(Node*);
2763 void compileArithClz32(Node*);
2764 void compileArithCos(Node*);
2765 void compileArithTan(Node*);
2766 void compileArithSub(Node*);
2767 void compileArithNegate(Node*);
2768 void compileArithMul(Node*);
2769 void compileArithDiv(Node*);
2770 void compileArithFRound(Node*);
2771 void compileArithMod(Node*);
2772 void compileArithPow(Node*);
2773 void compileArithRounding(Node*);
2774 void compileArithRandom(Node*);
2775 void compileArithSin(Node*);
2776 void compileArithSqrt(Node*);
2777 void compileArithLog(Node*);
2778 void compileConstantStoragePointer(Node*);
2779 void compileGetIndexedPropertyStorage(Node*);
2780 JITCompiler::Jump jumpForTypedArrayOutOfBounds(Node*, GPRReg baseGPR, GPRReg indexGPR);
2781 JITCompiler::Jump jumpForTypedArrayIsNeuteredIfOutOfBounds(Node*, GPRReg baseGPR, JITCompiler::Jump outOfBounds);
2782 void emitTypedArrayBoundsCheck(Node*, GPRReg baseGPR, GPRReg indexGPR);
2783 void compileGetTypedArrayByteOffset(Node*);
2784 void compileGetByValOnIntTypedArray(Node*, TypedArrayType);
2785 void compilePutByValForIntTypedArray(GPRReg base, GPRReg property, Node*, TypedArrayType);
2786 void compileGetByValOnFloatTypedArray(Node*, TypedArrayType);
2787 void compilePutByValForFloatTypedArray(GPRReg base, GPRReg property, Node*, TypedArrayType);
2788 template <typename ClassType> void compileNewFunctionCommon(GPRReg, RegisteredStructure, GPRReg, GPRReg, GPRReg, MacroAssembler::JumpList&, size_t, FunctionExecutable*, ptrdiff_t, ptrdiff_t, ptrdiff_t);
2789 void compileNewFunction(Node*);
2790 void compileSetFunctionName(Node*);
2791 void compileForwardVarargs(Node*);
2792 void compileCreateActivation(Node*);
2793 void compileCreateDirectArguments(Node*);
2794 void compileGetFromArguments(Node*);
2795 void compilePutToArguments(Node*);
2796 void compileGetArgument(Node*);
2797 void compileCreateScopedArguments(Node*);
2798 void compileCreateClonedArguments(Node*);
2799 void compileCreateRest(Node*);
2800 void compileSpread(Node*);
2801 void compileNewArrayWithSpread(Node*);
2802 void compileGetRestLength(Node*);
2803 void compileArraySlice(Node*);
2804 void compileNotifyWrite(Node*);
2805 bool compileRegExpExec(Node*);
2806 void compileIsObjectOrNull(Node*);
2807 void compileIsFunction(Node*);
2808 void compileTypeOf(Node*);
2809 void compileCheckStructure(Node*, GPRReg cellGPR, GPRReg tempGPR);
2810 void compileCheckStructure(Node*);
2811 void compilePutAccessorById(Node*);
2812 void compilePutGetterSetterById(Node*);
2813 void compilePutAccessorByVal(Node*);
2814 void compileGetRegExpObjectLastIndex(Node*);
2815 void compileSetRegExpObjectLastIndex(Node*);
2816 void compileLazyJSConstant(Node*);
2817 void compileMaterializeNewObject(Node*);
2818 void compileRecordRegExpCachedResult(Node*);
2819 void compileCallObjectConstructor(Node*);
2820 void compileResolveScope(Node*);
2821 void compileGetDynamicVar(Node*);
2822 void compilePutDynamicVar(Node*);
2823 void compileCompareEqPtr(Node*);
2824 void compileDefineDataProperty(Node*);
2825 void compileDefineAccessorProperty(Node*);
2826 void compileToLowerCase(Node*);
2828 void moveTrueTo(GPRReg);
2829 void moveFalseTo(GPRReg);
2830 void blessBoolean(GPRReg);
2832 // Allocator for a cell of a specific size.
2833 template <typename StructureType> // StructureType can be GPR or ImmPtr.
2834 void emitAllocateJSCell(
2835 GPRReg resultGPR, MarkedAllocator* allocator, GPRReg allocatorGPR, StructureType structure,
2836 GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
2838 m_jit.emitAllocateJSCell(resultGPR, allocator, allocatorGPR, structure, scratchGPR, slowPath);
2841 // Allocator for an object of a specific size.
2842 template <typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2843 void emitAllocateJSObject(
2844 GPRReg resultGPR, MarkedAllocator* allocator, GPRReg allocatorGPR, StructureType structure,
2845 StorageType storage, GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
2847 m_jit.emitAllocateJSObject(
2848 resultGPR, allocator, allocatorGPR, structure, storage, scratchGPR, slowPath);
2851 template <typename ClassType, typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2852 void emitAllocateJSObjectWithKnownSize(
2853 GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1,
2854 GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath, size_t size)
2856 m_jit.emitAllocateJSObjectWithKnownSize<ClassType>(resultGPR, structure, storage, scratchGPR1, scratchGPR2, slowPath, size);
2859 // Convenience allocator for a built-in object.
2860 template <typename ClassType, typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2861 void emitAllocateJSObject(GPRReg resultGPR, StructureType structure, StorageType storage,
2862 GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2864 m_jit.emitAllocateJSObject<ClassType>(resultGPR, structure, storage, scratchGPR1, scratchGPR2, slowPath);
2867 template <typename ClassType, typename StructureType> // StructureType and StorageType can be GPR or ImmPtr.
2868 void emitAllocateVariableSizedJSObject(GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2870 m_jit.emitAllocateVariableSizedJSObject<ClassType>(resultGPR, structure, allocationSize, scratchGPR1, scratchGPR2, slowPath);
2873 template<typename ClassType>
2874 void emitAllocateDestructibleObject(GPRReg resultGPR, RegisteredStructure structure,
2875 GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2877 m_jit.emitAllocateDestructibleObject<ClassType>(resultGPR, structure.get(), scratchGPR1, scratchGPR2, slowPath);
2880 void emitAllocateRawObject(GPRReg resultGPR, RegisteredStructure, GPRReg storageGPR, unsigned numElements, unsigned vectorLength);
2882 void emitGetLength(InlineCallFrame*, GPRReg lengthGPR, bool includeThis = false);
2883 void emitGetLength(CodeOrigin, GPRReg lengthGPR, bool includeThis = false);
2884 void emitGetCallee(CodeOrigin, GPRReg calleeGPR);
2885 void emitGetArgumentStart(CodeOrigin, GPRReg startGPR);
2887 // Generate an OSR exit fuzz check. Returns Jump() if OSR exit fuzz is not enabled, or if
2888 // it's in training mode.
2889 MacroAssembler::Jump emitOSRExitFuzzCheck();
2891 // Add a speculation check.
2892 void speculationCheck(ExitKind, JSValueSource, Node*, MacroAssembler::Jump jumpToFail);
2893 void speculationCheck(ExitKind, JSValueSource, Node*, const MacroAssembler::JumpList& jumpsToFail);
2895 // Add a speculation check without additional recovery, and with a promise to supply a jump later.
2896 OSRExitJumpPlaceholder speculationCheck(ExitKind, JSValueSource, Node*);
2897 OSRExitJumpPlaceholder speculationCheck(ExitKind, JSValueSource, Edge);
2898 void speculationCheck(ExitKind, JSValueSource, Edge, MacroAssembler::Jump jumpToFail);
2899 void speculationCheck(ExitKind, JSValueSource, Edge, const MacroAssembler::JumpList& jumpsToFail);
2900 // Add a speculation check with additional recovery.
2901 void speculationCheck(ExitKind, JSValueSource, Node*, MacroAssembler::Jump jumpToFail, const SpeculationRecovery&);
2902 void speculationCheck(ExitKind, JSValueSource, Edge, MacroAssembler::Jump jumpToFail, const SpeculationRecovery&);
2904 void emitInvalidationPoint(Node*);
2906 void unreachable(Node*);
2908 // Called when we statically determine that a speculation will fail.
2909 void terminateSpeculativeExecution(ExitKind, JSValueRegs, Node*);
2910 void terminateSpeculativeExecution(ExitKind, JSValueRegs, Edge);
2912 // Helpers for performing type checks on an edge stored in the given registers.
2913 bool needsTypeCheck(Edge edge, SpeculatedType typesPassedThrough) { return m_interpreter.needsTypeCheck(edge, typesPassedThrough); }
2914 void typeCheck(JSValueSource, Edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail, ExitKind = BadType);
2916 void speculateCellTypeWithoutTypeFiltering(Edge, GPRReg cellGPR, JSType);
2917 void speculateCellType(Edge, GPRReg cellGPR, SpeculatedType, JSType);
2919 void speculateInt32(Edge);
2921 void convertAnyInt(Edge, GPRReg resultGPR);
2922 void speculateAnyInt(Edge);
2923 void speculateDoubleRepAnyInt(Edge);
2924 #endif // USE(JSVALUE64)
2925 void speculateNumber(Edge);
2926 void speculateRealNumber(Edge);
2927 void speculateDoubleRepReal(Edge);
2928 void speculateBoolean(Edge);
2929 void speculateCell(Edge);
2930 void speculateCellOrOther(Edge);
2931 void speculateObject(Edge);
2932 void speculateArray(Edge, GPRReg cell);
2933 void speculateArray(Edge);
2934 void speculateFunction(Edge);
2935 void speculateFinalObject(Edge);
2936 void speculateRegExpObject(Edge, GPRReg cell);
2937 void speculateRegExpObject(Edge);
2938 void speculateProxyObject(Edge, GPRReg cell);
2939 void speculateProxyObject(Edge);
2940 void speculateDerivedArray(Edge, GPRReg cell);
2941 void speculateDerivedArray(Edge);
2942 void speculateMapObject(Edge);
2943 void speculateMapObject(Edge, GPRReg cell);
2944 void speculateSetObject(Edge);
2945 void speculateSetObject(Edge, GPRReg cell);
2946 void speculateObjectOrOther(Edge);
2947 void speculateString(Edge edge, GPRReg cell);
2948 void speculateStringIdentAndLoadStorage(Edge edge, GPRReg string, GPRReg storage);
2949 void speculateStringIdent(Edge edge, GPRReg string);
2950 void speculateStringIdent(Edge);
2951 void speculateString(Edge);
2952 void speculateStringOrOther(Edge, JSValueRegs, GPRReg scratch);
2953 void speculateStringOrOther(Edge);
2954 void speculateNotStringVar(Edge);
2955 template<typename StructureLocationType>
2956 void speculateStringObjectForStructure(Edge, StructureLocationType);
2957 void speculateStringObject(Edge, GPRReg);
2958 void speculateStringObject(Edge);
2959 void speculateStringOrStringObject(Edge);
2960 void speculateSymbol(Edge, GPRReg cell);
2961 void speculateSymbol(Edge);
2962 void speculateNotCell(Edge, JSValueRegs);
2963 void speculateNotCell(Edge);
2964 void speculateOther(Edge);
2965 void speculateMisc(Edge, JSValueRegs);
2966 void speculateMisc(Edge);
2967 void speculate(Node*, Edge);
2969 JITCompiler::Jump jumpSlowForUnwantedArrayMode(GPRReg tempWithIndexingTypeReg, ArrayMode, IndexingType);
2970 JITCompiler::JumpList jumpSlowForUnwantedArrayMode(GPRReg tempWithIndexingTypeReg, ArrayMode);
2971 void checkArray(Node*);
2972 void arrayify(Node*, GPRReg baseReg, GPRReg propertyReg);
2973 void arrayify(Node*);
2975 template<bool strict>
2976 GPRReg fillSpeculateInt32Internal(Edge, DataFormat& returnFormat);
2978 // It is possible, during speculative generation, to reach a situation in which we
2979 // can statically determine a speculation will fail (for example, when two nodes
2980 // will make conflicting speculations about the same operand). In such cases this
2981 // flag is cleared, indicating no further code generation should take place.
2984 void recordSetLocal(
2985 VirtualRegister bytecodeReg, VirtualRegister machineReg, DataFormat format)
2987 m_stream->appendAndLog(VariableEvent::setLocal(bytecodeReg, machineReg, format));
2990 void recordSetLocal(DataFormat format)
2992 VariableAccessData* variable = m_currentNode->variableAccessData();
2993 recordSetLocal(variable->local(), variable->machineLocal(), format);
2996 GenerationInfo& generationInfoFromVirtualRegister(VirtualRegister virtualRegister)
2998 return m_generationInfo[virtualRegister.toLocal()];
3001 GenerationInfo& generationInfo(Node* node)
3003 return generationInfoFromVirtualRegister(node->virtualRegister());
3006 GenerationInfo& generationInfo(Edge edge)
3008 return generationInfo(edge.node());
3011 // The JIT, while also provides MacroAssembler functionality.
3014 // The current node being generated.
3015 BasicBlock* m_block;
3016 Node* m_currentNode;
3017 NodeType m_lastGeneratedNode;
3018 unsigned m_indexInBlock;
3019 // Virtual and physical register maps.
3020 Vector<GenerationInfo, 32> m_generationInfo;
3021 RegisterBank<GPRInfo> m_gprs;
3022 RegisterBank<FPRInfo> m_fprs;
3024 Vector<MacroAssembler::Label> m_osrEntryHeads;
3026 struct BranchRecord {
3027 BranchRecord(MacroAssembler::Jump jump, BasicBlock* destination)
3029 , destination(destination)
3033 MacroAssembler::Jump jump;
3034 BasicBlock* destination;
3036 Vector<BranchRecord, 8> m_branches;
3038 NodeOrigin m_origin;
3040 InPlaceAbstractState m_state;
3041 AbstractInterpreter<InPlaceAbstractState> m_interpreter;
3043 VariableEventStream* m_stream;
3044 MinifiedGraph* m_minifiedGraph;
3046 Vector<std::unique_ptr<SlowPathGenerator>, 8> m_slowPathGenerators;
3047 struct SlowPathLambda {
3048 std::function<void()> generator;
3050 unsigned streamIndex;
3052 Vector<SlowPathLambda> m_slowPathLambdas;
3053 Vector<SilentRegisterSavePlan> m_plans;
3054 std::optional<unsigned> m_outOfLineStreamIndex;
3058 // === Operand types ===
3060 // These classes are used to lock the operands to a node into machine
3061 // registers. These classes implement of pattern of locking a value
3062 // into register at the point of construction only if it is already in
3063 // registers, and otherwise loading it lazily at the point it is first
3064 // used. We do so in order to attempt to avoid spilling one operand
3065 // in order to make space available for another.
3067 class JSValueOperand {
3069 explicit JSValueOperand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3073 , m_gprOrInvalid(InvalidGPRReg)
3074 #elif USE(JSVALUE32_64)
3081 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == UntypedUse);
3083 if (jit->isFilled(node()))
3085 #elif USE(JSVALUE32_64)
3086 m_register.pair.tagGPR = InvalidGPRReg;
3087 m_register.pair.payloadGPR = InvalidGPRReg;
3088 if (jit->isFilled(node()))
3093 explicit JSValueOperand(JSValueOperand&& other)
3094 : m_jit(other.m_jit)
3095 , m_edge(other.m_edge)
3098 m_gprOrInvalid = other.m_gprOrInvalid;
3099 #elif USE(JSVALUE32_64)
3100 m_register.pair.tagGPR = InvalidGPRReg;
3101 m_register.pair.payloadGPR = InvalidGPRReg;
3102 m_isDouble = other.m_isDouble;
3106 m_register.fpr = other.m_register.fpr;
3108 m_register.pair = other.m_register.pair;
3111 other.m_edge = Edge();
3113 other.m_gprOrInvalid = InvalidGPRReg;
3114 #elif USE(JSVALUE32_64)
3115 other.m_isDouble = false;
3124 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3125 m_jit->unlock(m_gprOrInvalid);
3126 #elif USE(JSVALUE32_64)
3128 ASSERT(m_register.fpr != InvalidFPRReg);
3129 m_jit->unlock(m_register.fpr);
3131 ASSERT(m_register.pair.tagGPR != InvalidGPRReg && m_register.pair.payloadGPR != InvalidGPRReg);
3132 m_jit->unlock(m_register.pair.tagGPR);
3133 m_jit->unlock(m_register.pair.payloadGPR);
3145 return edge().node();
3151 if (m_gprOrInvalid == InvalidGPRReg)
3152 m_gprOrInvalid = m_jit->fillJSValue(m_edge);
3153 return m_gprOrInvalid;
3155 JSValueRegs jsValueRegs()
3157 return JSValueRegs(gpr());
3159 #elif USE(JSVALUE32_64)
3160 bool isDouble() { return m_isDouble; }
3164 if (m_register.pair.tagGPR == InvalidGPRReg && m_register.pair.payloadGPR == InvalidGPRReg)
3165 m_isDouble = !m_jit->fillJSValue(m_edge, m_register.pair.tagGPR, m_register.pair.payloadGPR, m_register.fpr);
3171 ASSERT(!m_isDouble);
3172 return m_register.pair.tagGPR;
3178 ASSERT(!m_isDouble);
3179 return m_register.pair.payloadGPR;
3182 JSValueRegs jsValueRegs()
3184 return JSValueRegs(tagGPR(), payloadGPR());
3187 GPRReg gpr(WhichValueWord which)
3189 return jsValueRegs().gpr(which);
3196 return m_register.fpr;
3206 SpeculativeJIT* m_jit;
3209 GPRReg m_gprOrInvalid;
3210 #elif USE(JSVALUE32_64)
3222 class StorageOperand {
3224 explicit StorageOperand(SpeculativeJIT* jit, Edge edge)
3227 , m_gprOrInvalid(InvalidGPRReg)
3230 ASSERT(edge.useKind() == UntypedUse || edge.useKind() == KnownCellUse);
3231 if (jit->isFilled(node()))
3237 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3238 m_jit->unlock(m_gprOrInvalid);
3248 return edge().node();
3253 if (m_gprOrInvalid == InvalidGPRReg)
3254 m_gprOrInvalid = m_jit->fillStorage(edge());
3255 return m_gprOrInvalid;
3264 SpeculativeJIT* m_jit;
3266 GPRReg m_gprOrInvalid;
3270 // === Temporaries ===
3272 // These classes are used to allocate temporary registers.
3273 // A mechanism is provided to attempt to reuse the registers
3274 // currently allocated to child nodes whose value is consumed
3275 // by, and not live after, this operation.
3277 enum ReuseTag { Reuse };