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.
26 #ifndef DFGSpeculativeJIT_h
27 #define DFGSpeculativeJIT_h
31 #include "DFGAbstractInterpreter.h"
32 #include "DFGGenerationInfo.h"
33 #include "DFGInPlaceAbstractState.h"
34 #include "DFGJITCompiler.h"
35 #include "DFGOSRExit.h"
36 #include "DFGOSRExitJumpPlaceholder.h"
37 #include "DFGSilentRegisterSavePlan.h"
38 #include "DFGValueSource.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 inline GPRReg extractResult(GPRReg result) { return result; }
63 inline GPRReg extractResult(JSValueRegs result) { return result.gpr(); }
65 inline JSValueRegs extractResult(JSValueRegs result) { return result; }
67 inline NoResultTag extractResult(NoResultTag) { return NoResult; }
69 // === SpeculativeJIT ===
71 // The SpeculativeJIT is used to generate a fast, but potentially
72 // incomplete code path for the dataflow. When code generating
73 // we may make assumptions about operand types, dynamically check,
74 // and bail-out to an alternate code path if these checks fail.
75 // Importantly, the speculative code path cannot be reentered once
76 // a speculative check has failed. This allows the SpeculativeJIT
77 // to propagate type information (including information that has
78 // only speculatively been asserted) through the dataflow.
79 class SpeculativeJIT {
80 WTF_MAKE_FAST_ALLOCATED;
82 friend struct OSRExit;
84 typedef JITCompiler::TrustedImm32 TrustedImm32;
85 typedef JITCompiler::Imm32 Imm32;
86 typedef JITCompiler::TrustedImmPtr TrustedImmPtr;
87 typedef JITCompiler::ImmPtr ImmPtr;
88 typedef JITCompiler::TrustedImm64 TrustedImm64;
89 typedef JITCompiler::Imm64 Imm64;
91 // These constants are used to set priorities for spill order for
92 // the register allocator.
95 SpillOrderConstant = 1, // no spill, and cheap fill
96 SpillOrderSpilled = 2, // no spill
97 SpillOrderJS = 4, // needs spill
98 SpillOrderCell = 4, // needs spill
99 SpillOrderStorage = 4, // needs spill
100 SpillOrderInteger = 5, // needs spill and box
101 SpillOrderBoolean = 5, // needs spill and box
102 SpillOrderDouble = 6, // needs spill and convert
104 #elif USE(JSVALUE32_64)
106 SpillOrderConstant = 1, // no spill, and cheap fill
107 SpillOrderSpilled = 2, // no spill
108 SpillOrderJS = 4, // needs spill
109 SpillOrderStorage = 4, // needs spill
110 SpillOrderDouble = 4, // needs spill
111 SpillOrderInteger = 5, // needs spill and box
112 SpillOrderCell = 5, // needs spill and box
113 SpillOrderBoolean = 5, // needs spill and box
117 enum UseChildrenMode { CallUseChildren, UseChildrenCalledExplicitly };
120 SpeculativeJIT(JITCompiler&);
125 void createOSREntries();
126 void linkOSREntries(LinkBuffer&);
128 BasicBlock* nextBlock()
130 for (BlockIndex resultIndex = m_block->index + 1; ; resultIndex++) {
131 if (resultIndex >= m_jit.graph().numBlocks())
133 if (BasicBlock* result = m_jit.graph().block(resultIndex))
139 GPRReg fillJSValue(Edge);
140 #elif USE(JSVALUE32_64)
141 bool fillJSValue(Edge, GPRReg&, GPRReg&, FPRReg&);
143 GPRReg fillStorage(Edge);
145 // lock and unlock GPR & FPR registers.
146 void lock(GPRReg reg)
150 void lock(FPRReg reg)
154 void unlock(GPRReg reg)
158 void unlock(FPRReg reg)
163 // Used to check whether a child node is on its last use,
164 // and its machine registers may be reused.
165 bool canReuse(Node* node)
167 return generationInfo(node).useCount() == 1;
169 bool canReuse(Node* nodeA, Node* nodeB)
171 return nodeA == nodeB && generationInfo(nodeA).useCount() == 2;
173 bool canReuse(Edge nodeUse)
175 return canReuse(nodeUse.node());
177 GPRReg reuse(GPRReg reg)
182 FPRReg reuse(FPRReg reg)
188 // Allocate a gpr/fpr.
191 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION)
192 m_jit.addRegisterAllocationAtOffset(m_jit.debugOffset());
194 VirtualRegister spillMe;
195 GPRReg gpr = m_gprs.allocate(spillMe);
196 if (spillMe.isValid()) {
197 #if USE(JSVALUE32_64)
198 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe);
199 if ((info.registerFormat() & DataFormatJS))
200 m_gprs.release(info.tagGPR() == gpr ? info.payloadGPR() : info.tagGPR());
206 GPRReg allocate(GPRReg specific)
208 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION)
209 m_jit.addRegisterAllocationAtOffset(m_jit.debugOffset());
211 VirtualRegister spillMe = m_gprs.allocateSpecific(specific);
212 if (spillMe.isValid()) {
213 #if USE(JSVALUE32_64)
214 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe);
215 RELEASE_ASSERT(info.registerFormat() != DataFormatJSDouble);
216 if ((info.registerFormat() & DataFormatJS))
217 m_gprs.release(info.tagGPR() == specific ? info.payloadGPR() : info.tagGPR());
225 return m_gprs.tryAllocate();
229 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION)
230 m_jit.addRegisterAllocationAtOffset(m_jit.debugOffset());
232 VirtualRegister spillMe;
233 FPRReg fpr = m_fprs.allocate(spillMe);
234 if (spillMe.isValid())
239 // Check whether a VirtualRegsiter is currently in a machine register.
240 // We use this when filling operands to fill those that are already in
241 // machine registers first (by locking VirtualRegsiters that are already
242 // in machine register before filling those that are not we attempt to
243 // avoid spilling values we will need immediately).
244 bool isFilled(Node* node)
246 return generationInfo(node).registerFormat() != DataFormatNone;
248 bool isFilledDouble(Node* node)
250 return generationInfo(node).registerFormat() == DataFormatDouble;
253 // Called on an operand once it has been consumed by a parent node.
256 if (!node->hasResult())
258 GenerationInfo& info = generationInfo(node);
260 // use() returns true when the value becomes dead, and any
261 // associated resources may be freed.
262 if (!info.use(*m_stream))
265 // Release the associated machine registers.
266 DataFormat registerFormat = info.registerFormat();
268 if (registerFormat == DataFormatDouble)
269 m_fprs.release(info.fpr());
270 else if (registerFormat != DataFormatNone)
271 m_gprs.release(info.gpr());
272 #elif USE(JSVALUE32_64)
273 if (registerFormat == DataFormatDouble)
274 m_fprs.release(info.fpr());
275 else if (registerFormat & DataFormatJS) {
276 m_gprs.release(info.tagGPR());
277 m_gprs.release(info.payloadGPR());
278 } else if (registerFormat != DataFormatNone)
279 m_gprs.release(info.gpr());
282 void use(Edge nodeUse)
287 RegisterSet usedRegisters();
289 bool masqueradesAsUndefinedWatchpointIsStillValid(const CodeOrigin& codeOrigin)
291 return m_jit.graph().masqueradesAsUndefinedWatchpointIsStillValid(codeOrigin);
293 bool masqueradesAsUndefinedWatchpointIsStillValid()
295 return masqueradesAsUndefinedWatchpointIsStillValid(m_currentNode->origin.semantic);
298 void storeToWriteBarrierBuffer(GPRReg cell, GPRReg scratch1, GPRReg scratch2);
300 void writeBarrier(GPRReg owner, GPRReg scratch1, GPRReg scratch2);
302 void writeBarrier(GPRReg owner, GPRReg value, Edge valueUse, GPRReg scratch1, GPRReg scratch2);
304 void compileStoreBarrier(Node*);
306 static GPRReg selectScratchGPR(GPRReg preserve1 = InvalidGPRReg, GPRReg preserve2 = InvalidGPRReg, GPRReg preserve3 = InvalidGPRReg, GPRReg preserve4 = InvalidGPRReg)
308 return AssemblyHelpers::selectScratchGPR(preserve1, preserve2, preserve3, preserve4);
311 // Called by the speculative operand types, below, to fill operand to
312 // machine registers, implicitly generating speculation checks as needed.
313 GPRReg fillSpeculateInt32(Edge, DataFormat& returnFormat);
314 GPRReg fillSpeculateInt32Strict(Edge);
315 GPRReg fillSpeculateInt52(Edge, DataFormat desiredFormat);
316 FPRReg fillSpeculateDouble(Edge);
317 GPRReg fillSpeculateCell(Edge);
318 GPRReg fillSpeculateBoolean(Edge);
319 GeneratedOperandType checkGeneratedTypeForToInt32(Node*);
321 void addSlowPathGenerator(std::unique_ptr<SlowPathGenerator>);
322 void addSlowPathGenerator(std::function<void()>);
323 void runSlowPathGenerators(PCToCodeOriginMapBuilder&);
326 void noticeOSRBirth(Node*);
327 void bail(AbortReason);
328 void compileCurrentBlock();
330 void checkArgumentTypes();
332 void clearGenerationInfo();
334 // These methods are used when generating 'unexpected'
335 // calls out from JIT code to C++ helper routines -
336 // they spill all live values to the appropriate
337 // slots in the JSStack without changing any state
338 // in the GenerationInfo.
339 SilentRegisterSavePlan silentSavePlanForGPR(VirtualRegister spillMe, GPRReg source);
340 SilentRegisterSavePlan silentSavePlanForFPR(VirtualRegister spillMe, FPRReg source);
341 void silentSpill(const SilentRegisterSavePlan&);
342 void silentFill(const SilentRegisterSavePlan&, GPRReg canTrample);
344 template<typename CollectionType>
345 void silentSpill(const CollectionType& savePlans)
347 for (unsigned i = 0; i < savePlans.size(); ++i)
348 silentSpill(savePlans[i]);
351 template<typename CollectionType>
352 void silentFill(const CollectionType& savePlans, GPRReg exclude = InvalidGPRReg)
354 GPRReg canTrample = SpeculativeJIT::pickCanTrample(exclude);
355 for (unsigned i = savePlans.size(); i--;)
356 silentFill(savePlans[i], canTrample);
359 template<typename CollectionType>
360 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, GPRReg exclude, GPRReg exclude2 = InvalidGPRReg, FPRReg fprExclude = InvalidFPRReg)
362 ASSERT(plans.isEmpty());
363 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
364 GPRReg gpr = iter.regID();
365 if (iter.name().isValid() && gpr != exclude && gpr != exclude2) {
366 SilentRegisterSavePlan plan = silentSavePlanForGPR(iter.name(), gpr);
372 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
373 if (iter.name().isValid() && iter.regID() != fprExclude) {
374 SilentRegisterSavePlan plan = silentSavePlanForFPR(iter.name(), iter.regID());
381 template<typename CollectionType>
382 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, NoResultTag)
384 silentSpillAllRegistersImpl(doSpill, plans, InvalidGPRReg, InvalidGPRReg, InvalidFPRReg);
386 template<typename CollectionType>
387 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, FPRReg exclude)
389 silentSpillAllRegistersImpl(doSpill, plans, InvalidGPRReg, InvalidGPRReg, exclude);
391 template<typename CollectionType>
392 void silentSpillAllRegistersImpl(bool doSpill, CollectionType& plans, JSValueRegs exclude)
394 #if USE(JSVALUE32_64)
395 silentSpillAllRegistersImpl(doSpill, plans, exclude.tagGPR(), exclude.payloadGPR());
397 silentSpillAllRegistersImpl(doSpill, plans, exclude.gpr());
401 void silentSpillAllRegisters(GPRReg exclude, GPRReg exclude2 = InvalidGPRReg, FPRReg fprExclude = InvalidFPRReg)
403 silentSpillAllRegistersImpl(true, m_plans, exclude, exclude2, fprExclude);
405 void silentSpillAllRegisters(FPRReg exclude)
407 silentSpillAllRegisters(InvalidGPRReg, InvalidGPRReg, exclude);
409 void silentSpillAllRegisters(JSValueRegs exclude)
412 silentSpillAllRegisters(exclude.payloadGPR());
414 silentSpillAllRegisters(exclude.payloadGPR(), exclude.tagGPR());
418 static GPRReg pickCanTrample(GPRReg exclude)
420 GPRReg result = GPRInfo::regT0;
421 if (result == exclude)
422 result = GPRInfo::regT1;
425 static GPRReg pickCanTrample(FPRReg)
427 return GPRInfo::regT0;
429 static GPRReg pickCanTrample(NoResultTag)
431 return GPRInfo::regT0;
435 static GPRReg pickCanTrample(JSValueRegs exclude)
437 return pickCanTrample(exclude.payloadGPR());
440 static GPRReg pickCanTrample(JSValueRegs exclude)
442 GPRReg result = GPRInfo::regT0;
443 if (result == exclude.tagGPR()) {
444 result = GPRInfo::regT1;
445 if (result == exclude.payloadGPR())
446 result = GPRInfo::regT2;
447 } else if (result == exclude.payloadGPR()) {
448 result = GPRInfo::regT1;
449 if (result == exclude.tagGPR())
450 result = GPRInfo::regT2;
456 template<typename RegisterType>
457 void silentFillAllRegisters(RegisterType exclude)
459 GPRReg canTrample = pickCanTrample(exclude);
461 while (!m_plans.isEmpty()) {
462 SilentRegisterSavePlan& plan = m_plans.last();
463 silentFill(plan, canTrample);
464 m_plans.removeLast();
468 // These methods convert between doubles, and doubles boxed and JSValues.
470 GPRReg boxDouble(FPRReg fpr, GPRReg gpr)
472 return m_jit.boxDouble(fpr, gpr);
474 FPRReg unboxDouble(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
476 return m_jit.unboxDouble(gpr, resultGPR, fpr);
478 GPRReg boxDouble(FPRReg fpr)
480 return boxDouble(fpr, allocate());
483 void boxInt52(GPRReg sourceGPR, GPRReg targetGPR, DataFormat);
484 #elif USE(JSVALUE32_64)
485 void boxDouble(FPRReg fpr, GPRReg tagGPR, GPRReg payloadGPR)
487 m_jit.boxDouble(fpr, tagGPR, payloadGPR);
489 void unboxDouble(GPRReg tagGPR, GPRReg payloadGPR, FPRReg fpr, FPRReg scratchFPR)
491 m_jit.unboxDouble(tagGPR, payloadGPR, fpr, scratchFPR);
494 void boxDouble(FPRReg fpr, JSValueRegs regs)
496 m_jit.boxDouble(fpr, regs);
499 // Spill a VirtualRegister to the JSStack.
500 void spill(VirtualRegister spillMe)
502 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe);
504 #if USE(JSVALUE32_64)
505 if (info.registerFormat() == DataFormatNone) // it has been spilled. JS values which have two GPRs can reach here
508 // Check the GenerationInfo to see if this value need writing
509 // to the JSStack - if not, mark it as spilled & return.
510 if (!info.needsSpill()) {
511 info.setSpilled(*m_stream, spillMe);
515 DataFormat spillFormat = info.registerFormat();
516 switch (spillFormat) {
517 case DataFormatStorage: {
518 // This is special, since it's not a JS value - as in it's not visible to JS
520 m_jit.storePtr(info.gpr(), JITCompiler::addressFor(spillMe));
521 info.spill(*m_stream, spillMe, DataFormatStorage);
525 case DataFormatInt32: {
526 m_jit.store32(info.gpr(), JITCompiler::payloadFor(spillMe));
527 info.spill(*m_stream, spillMe, DataFormatInt32);
532 case DataFormatDouble: {
533 m_jit.storeDouble(info.fpr(), JITCompiler::addressFor(spillMe));
534 info.spill(*m_stream, spillMe, DataFormatDouble);
538 case DataFormatInt52:
539 case DataFormatStrictInt52: {
540 m_jit.store64(info.gpr(), JITCompiler::addressFor(spillMe));
541 info.spill(*m_stream, spillMe, spillFormat);
546 // The following code handles JSValues, int32s, and cells.
547 RELEASE_ASSERT(spillFormat == DataFormatCell || spillFormat & DataFormatJS);
549 GPRReg reg = info.gpr();
550 // We need to box int32 and cell values ...
551 // but on JSVALUE64 boxing a cell is a no-op!
552 if (spillFormat == DataFormatInt32)
553 m_jit.or64(GPRInfo::tagTypeNumberRegister, reg);
555 // Spill the value, and record it as spilled in its boxed form.
556 m_jit.store64(reg, JITCompiler::addressFor(spillMe));
557 info.spill(*m_stream, spillMe, (DataFormat)(spillFormat | DataFormatJS));
559 #elif USE(JSVALUE32_64)
561 case DataFormatBoolean: {
562 m_jit.store32(info.gpr(), JITCompiler::payloadFor(spillMe));
563 info.spill(*m_stream, spillMe, spillFormat);
567 case DataFormatDouble: {
568 // On JSVALUE32_64 boxing a double is a no-op.
569 m_jit.storeDouble(info.fpr(), JITCompiler::addressFor(spillMe));
570 info.spill(*m_stream, spillMe, DataFormatDouble);
575 // The following code handles JSValues.
576 RELEASE_ASSERT(spillFormat & DataFormatJS);
577 m_jit.store32(info.tagGPR(), JITCompiler::tagFor(spillMe));
578 m_jit.store32(info.payloadGPR(), JITCompiler::payloadFor(spillMe));
579 info.spill(*m_stream, spillMe, spillFormat);
585 bool isKnownInteger(Node* node) { return m_state.forNode(node).isType(SpecInt32Only); }
586 bool isKnownCell(Node* node) { return m_state.forNode(node).isType(SpecCell); }
588 bool isKnownNotInteger(Node* node) { return !(m_state.forNode(node).m_type & SpecInt32Only); }
589 bool isKnownNotNumber(Node* node) { return !(m_state.forNode(node).m_type & SpecFullNumber); }
590 bool isKnownNotCell(Node* node) { return !(m_state.forNode(node).m_type & SpecCell); }
591 bool isKnownNotOther(Node* node) { return !(m_state.forNode(node).m_type & SpecOther); }
593 UniquedStringImpl* identifierUID(unsigned index)
595 return m_jit.graph().identifiers()[index];
598 // Spill all VirtualRegisters back to the JSStack.
599 void flushRegisters()
601 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
602 if (iter.name().isValid()) {
607 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
608 if (iter.name().isValid()) {
615 // Used to ASSERT flushRegisters() has been called prior to
616 // calling out from JIT code to a C helper function.
619 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
620 if (iter.name().isValid())
623 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
624 if (iter.name().isValid())
631 static MacroAssembler::Imm64 valueOfJSConstantAsImm64(Node* node)
633 return MacroAssembler::Imm64(JSValue::encode(node->asJSValue()));
637 // Helper functions to enable code sharing in implementations of bit/shift ops.
638 void bitOp(NodeType op, int32_t imm, GPRReg op1, GPRReg result)
642 m_jit.and32(Imm32(imm), op1, result);
645 m_jit.or32(Imm32(imm), op1, result);
648 m_jit.xor32(Imm32(imm), op1, result);
651 RELEASE_ASSERT_NOT_REACHED();
654 void bitOp(NodeType op, GPRReg op1, GPRReg op2, GPRReg result)
658 m_jit.and32(op1, op2, result);
661 m_jit.or32(op1, op2, result);
664 m_jit.xor32(op1, op2, result);
667 RELEASE_ASSERT_NOT_REACHED();
670 void shiftOp(NodeType op, GPRReg op1, int32_t shiftAmount, GPRReg result)
674 m_jit.rshift32(op1, Imm32(shiftAmount), result);
677 m_jit.lshift32(op1, Imm32(shiftAmount), result);
680 m_jit.urshift32(op1, Imm32(shiftAmount), result);
683 RELEASE_ASSERT_NOT_REACHED();
686 void shiftOp(NodeType op, GPRReg op1, GPRReg shiftAmount, GPRReg result)
690 m_jit.rshift32(op1, shiftAmount, result);
693 m_jit.lshift32(op1, shiftAmount, result);
696 m_jit.urshift32(op1, shiftAmount, result);
699 RELEASE_ASSERT_NOT_REACHED();
703 // Returns the index of the branch node if peephole is okay, UINT_MAX otherwise.
704 unsigned detectPeepHoleBranch()
706 // Check that no intervening nodes will be generated.
707 for (unsigned index = m_indexInBlock + 1; index < m_block->size() - 1; ++index) {
708 Node* node = m_block->at(index);
709 if (!node->shouldGenerate())
711 // Check if it's a Phantom that can be safely ignored.
712 if (node->op() == Phantom && !node->child1())
717 // Check if the lastNode is a branch on this node.
718 Node* lastNode = m_block->terminal();
719 return lastNode->op() == Branch && lastNode->child1() == m_currentNode ? m_block->size() - 1 : UINT_MAX;
722 void compileMovHint(Node*);
723 void compileMovHintAndCheck(Node*);
725 void cachedGetById(CodeOrigin, JSValueRegs base, JSValueRegs result, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill, AccessType = AccessType::Get);
728 void cachedGetById(CodeOrigin, GPRReg baseGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill, AccessType = AccessType::Get);
729 void cachedPutById(CodeOrigin, GPRReg base, GPRReg value, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill);
730 #elif USE(JSVALUE32_64)
731 void cachedGetById(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill, AccessType = AccessType::Get);
732 void cachedPutById(CodeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill);
735 void compileDeleteById(Node*);
736 void compileDeleteByVal(Node*);
737 void compileTryGetById(Node*);
738 void compileIn(Node*);
740 void compileBaseValueStoreBarrier(Edge& baseEdge, Edge& valueEdge);
742 void nonSpeculativeNonPeepholeCompareNullOrUndefined(Edge operand);
743 void nonSpeculativePeepholeBranchNullOrUndefined(Edge operand, Node* branchNode);
745 void nonSpeculativePeepholeBranch(Node*, Node* branchNode, MacroAssembler::RelationalCondition, S_JITOperation_EJJ helperFunction);
746 void nonSpeculativeNonPeepholeCompare(Node*, MacroAssembler::RelationalCondition, S_JITOperation_EJJ helperFunction);
747 bool nonSpeculativeCompare(Node*, MacroAssembler::RelationalCondition, S_JITOperation_EJJ helperFunction);
749 void nonSpeculativePeepholeStrictEq(Node*, Node* branchNode, bool invert = false);
750 void nonSpeculativeNonPeepholeStrictEq(Node*, bool invert = false);
751 bool nonSpeculativeStrictEq(Node*, bool invert = false);
753 void compileInstanceOfForObject(Node*, GPRReg valueReg, GPRReg prototypeReg, GPRReg scratchAndResultReg, GPRReg scratch2Reg);
754 void compileInstanceOf(Node*);
755 void compileInstanceOfCustom(Node*);
757 void compileIsJSArray(Node*);
758 void compileIsRegExpObject(Node*);
759 void compileIsTypedArrayView(Node*);
761 void emitCall(Node*);
763 // Called once a node has completed code generation but prior to setting
764 // its result, to free up its children. (This must happen prior to setting
765 // the nodes result, since the node may have the same VirtualRegister as
766 // a child, and as such will use the same GeneratioInfo).
767 void useChildren(Node*);
769 // These method called to initialize the the GenerationInfo
770 // to describe the result of an operation.
771 void int32Result(GPRReg reg, Node* node, DataFormat format = DataFormatInt32, UseChildrenMode mode = CallUseChildren)
773 if (mode == CallUseChildren)
776 VirtualRegister virtualRegister = node->virtualRegister();
777 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
779 if (format == DataFormatInt32) {
780 m_jit.jitAssertIsInt32(reg);
781 m_gprs.retain(reg, virtualRegister, SpillOrderInteger);
782 info.initInt32(node, node->refCount(), reg);
785 RELEASE_ASSERT(format == DataFormatJSInt32);
786 m_jit.jitAssertIsJSInt32(reg);
787 m_gprs.retain(reg, virtualRegister, SpillOrderJS);
788 info.initJSValue(node, node->refCount(), reg, format);
789 #elif USE(JSVALUE32_64)
790 RELEASE_ASSERT_NOT_REACHED();
794 void int32Result(GPRReg reg, Node* node, UseChildrenMode mode)
796 int32Result(reg, node, DataFormatInt32, mode);
798 void int52Result(GPRReg reg, Node* node, DataFormat format, UseChildrenMode mode = CallUseChildren)
800 if (mode == CallUseChildren)
803 VirtualRegister virtualRegister = node->virtualRegister();
804 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
806 m_gprs.retain(reg, virtualRegister, SpillOrderJS);
807 info.initInt52(node, node->refCount(), reg, format);
809 void int52Result(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
811 int52Result(reg, node, DataFormatInt52, mode);
813 void strictInt52Result(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
815 int52Result(reg, node, DataFormatStrictInt52, mode);
817 void noResult(Node* node, UseChildrenMode mode = CallUseChildren)
819 if (mode == UseChildrenCalledExplicitly)
823 void cellResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
825 if (mode == CallUseChildren)
828 VirtualRegister virtualRegister = node->virtualRegister();
829 m_gprs.retain(reg, virtualRegister, SpillOrderCell);
830 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
831 info.initCell(node, node->refCount(), reg);
833 void blessedBooleanResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
836 jsValueResult(reg, node, DataFormatJSBoolean, mode);
838 booleanResult(reg, node, mode);
841 void unblessedBooleanResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
846 blessedBooleanResult(reg, node, mode);
849 void jsValueResult(GPRReg reg, Node* node, DataFormat format = DataFormatJS, UseChildrenMode mode = CallUseChildren)
851 if (format == DataFormatJSInt32)
852 m_jit.jitAssertIsJSInt32(reg);
854 if (mode == CallUseChildren)
857 VirtualRegister virtualRegister = node->virtualRegister();
858 m_gprs.retain(reg, virtualRegister, SpillOrderJS);
859 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
860 info.initJSValue(node, node->refCount(), reg, format);
862 void jsValueResult(GPRReg reg, Node* node, UseChildrenMode mode)
864 jsValueResult(reg, node, DataFormatJS, mode);
866 #elif USE(JSVALUE32_64)
867 void booleanResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
869 if (mode == CallUseChildren)
872 VirtualRegister virtualRegister = node->virtualRegister();
873 m_gprs.retain(reg, virtualRegister, SpillOrderBoolean);
874 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
875 info.initBoolean(node, node->refCount(), reg);
877 void jsValueResult(GPRReg tag, GPRReg payload, Node* node, DataFormat format = DataFormatJS, UseChildrenMode mode = CallUseChildren)
879 if (mode == CallUseChildren)
882 VirtualRegister virtualRegister = node->virtualRegister();
883 m_gprs.retain(tag, virtualRegister, SpillOrderJS);
884 m_gprs.retain(payload, virtualRegister, SpillOrderJS);
885 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
886 info.initJSValue(node, node->refCount(), tag, payload, format);
888 void jsValueResult(GPRReg tag, GPRReg payload, Node* node, UseChildrenMode mode)
890 jsValueResult(tag, payload, node, DataFormatJS, mode);
893 void jsValueResult(JSValueRegs regs, Node* node, DataFormat format = DataFormatJS, UseChildrenMode mode = CallUseChildren)
896 jsValueResult(regs.gpr(), node, format, mode);
898 jsValueResult(regs.tagGPR(), regs.payloadGPR(), node, format, mode);
901 void storageResult(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
903 if (mode == CallUseChildren)
906 VirtualRegister virtualRegister = node->virtualRegister();
907 m_gprs.retain(reg, virtualRegister, SpillOrderStorage);
908 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
909 info.initStorage(node, node->refCount(), reg);
911 void doubleResult(FPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren)
913 if (mode == CallUseChildren)
916 VirtualRegister virtualRegister = node->virtualRegister();
917 m_fprs.retain(reg, virtualRegister, SpillOrderDouble);
918 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister);
919 info.initDouble(node, node->refCount(), reg);
921 void initConstantInfo(Node* node)
923 ASSERT(node->hasConstant());
924 generationInfo(node).initConstant(node, node->refCount());
927 // These methods add calls to C++ helper functions.
928 // These methods are broadly value representation specific (i.e.
929 // deal with the fact that a JSValue may be passed in one or two
930 // machine registers, and delegate the calling convention specific
931 // decision as to how to fill the regsiters to setupArguments* methods.
933 JITCompiler::Call callOperation(V_JITOperation_E operation)
935 m_jit.setupArgumentsExecState();
936 return appendCall(operation);
938 JITCompiler::Call callOperation(P_JITOperation_E operation, GPRReg result)
940 m_jit.setupArgumentsExecState();
941 return appendCallSetResult(operation, result);
943 JITCompiler::Call callOperation(P_JITOperation_EC operation, GPRReg result, GPRReg cell)
945 m_jit.setupArgumentsWithExecState(cell);
946 return appendCallSetResult(operation, result);
948 JITCompiler::Call callOperation(P_JITOperation_EO operation, GPRReg result, GPRReg object)
950 m_jit.setupArgumentsWithExecState(object);
951 return appendCallSetResult(operation, result);
953 JITCompiler::Call callOperation(P_JITOperation_EOS operation, GPRReg result, GPRReg object, size_t size)
955 m_jit.setupArgumentsWithExecState(object, TrustedImmPtr(size));
956 return appendCallSetResult(operation, result);
958 JITCompiler::Call callOperation(P_JITOperation_EOZ operation, GPRReg result, GPRReg object, int32_t size)
960 m_jit.setupArgumentsWithExecState(object, TrustedImmPtr(size));
961 return appendCallSetResult(operation, result);
963 JITCompiler::Call callOperation(C_JITOperation_EOZ operation, GPRReg result, GPRReg object, int32_t size)
965 m_jit.setupArgumentsWithExecState(object, TrustedImmPtr(static_cast<size_t>(size)));
966 return appendCallSetResult(operation, result);
968 JITCompiler::Call callOperation(P_JITOperation_EPS operation, GPRReg result, GPRReg old, size_t size)
970 m_jit.setupArgumentsWithExecState(old, TrustedImmPtr(size));
971 return appendCallSetResult(operation, result);
973 JITCompiler::Call callOperation(P_JITOperation_ES operation, GPRReg result, size_t size)
975 m_jit.setupArgumentsWithExecState(TrustedImmPtr(size));
976 return appendCallSetResult(operation, result);
978 JITCompiler::Call callOperation(P_JITOperation_ESJss operation, GPRReg result, size_t index, GPRReg arg1)
980 m_jit.setupArgumentsWithExecState(TrustedImmPtr(index), arg1);
981 return appendCallSetResult(operation, result);
983 JITCompiler::Call callOperation(P_JITOperation_ESt operation, GPRReg result, Structure* structure)
985 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure));
986 return appendCallSetResult(operation, result);
988 JITCompiler::Call callOperation(P_JITOperation_EStZ operation, GPRReg result, Structure* structure, GPRReg arg2)
990 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2);
991 return appendCallSetResult(operation, result);
993 JITCompiler::Call callOperation(P_JITOperation_EStZ operation, GPRReg result, Structure* structure, size_t arg2)
995 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(arg2));
996 return appendCallSetResult(operation, result);
998 JITCompiler::Call callOperation(P_JITOperation_EStZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1000 m_jit.setupArgumentsWithExecState(arg1, arg2);
1001 return appendCallSetResult(operation, result);
1003 JITCompiler::Call callOperation(P_JITOperation_EStPS operation, GPRReg result, Structure* structure, void* pointer, size_t size)
1005 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImmPtr(pointer), TrustedImmPtr(size));
1006 return appendCallSetResult(operation, result);
1008 JITCompiler::Call callOperation(P_JITOperation_EStSS operation, GPRReg result, Structure* structure, size_t index, size_t size)
1010 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImmPtr(index), TrustedImmPtr(size));
1011 return appendCallSetResult(operation, result);
1013 JITCompiler::Call callOperation(C_JITOperation_E operation, GPRReg result)
1015 m_jit.setupArgumentsExecState();
1016 return appendCallSetResult(operation, result);
1018 JITCompiler::Call callOperation(C_JITOperation_EC operation, GPRReg result, GPRReg arg1)
1020 m_jit.setupArgumentsWithExecState(arg1);
1021 return appendCallSetResult(operation, result);
1023 JITCompiler::Call callOperation(C_JITOperation_EC operation, GPRReg result, JSCell* cell)
1025 m_jit.setupArgumentsWithExecState(TrustedImmPtr(cell));
1026 return appendCallSetResult(operation, result);
1028 JITCompiler::Call callOperation(C_JITOperation_ECZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1030 m_jit.setupArgumentsWithExecState(arg1, arg2);
1031 return appendCallSetResult(operation, result);
1033 JITCompiler::Call callOperation(C_JITOperation_ECZC operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1035 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1036 return appendCallSetResult(operation, result);
1038 JITCompiler::Call callOperation(C_JITOperation_EJscC operation, GPRReg result, GPRReg arg1, JSCell* cell)
1040 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
1041 return appendCallSetResult(operation, result);
1043 JITCompiler::Call callOperation(C_JITOperation_EIcf operation, GPRReg result, InlineCallFrame* inlineCallFrame)
1045 m_jit.setupArgumentsWithExecState(TrustedImmPtr(inlineCallFrame));
1046 return appendCallSetResult(operation, result);
1048 JITCompiler::Call callOperation(C_JITOperation_ESt operation, GPRReg result, Structure* structure)
1050 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure));
1051 return appendCallSetResult(operation, result);
1055 JITCompiler::Call callOperation(C_JITOperation_EStJscSymtabJ operation, GPRReg result, Structure* structure, GPRReg scope, SymbolTable* table, TrustedImm64 initialValue)
1057 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), scope, TrustedImmPtr(table), initialValue);
1058 return appendCallSetResult(operation, result);
1061 JITCompiler::Call callOperation(C_JITOperation_EStJscSymtabJ operation, GPRReg result, Structure* structure, GPRReg scope, SymbolTable* table, TrustedImm32 tag, TrustedImm32 payload)
1063 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), scope, TrustedImmPtr(table), payload, tag);
1064 return appendCallSetResult(operation, result);
1067 JITCompiler::Call callOperation(C_JITOperation_EStZ operation, GPRReg result, Structure* structure, unsigned knownLength)
1069 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(knownLength));
1070 return appendCallSetResult(operation, result);
1072 JITCompiler::Call callOperation(C_JITOperation_EStZZ operation, GPRReg result, Structure* structure, unsigned knownLength, unsigned minCapacity)
1074 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), TrustedImm32(knownLength), TrustedImm32(minCapacity));
1075 return appendCallSetResult(operation, result);
1077 JITCompiler::Call callOperation(C_JITOperation_EStZ operation, GPRReg result, Structure* structure, GPRReg length)
1079 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), length);
1080 return appendCallSetResult(operation, result);
1082 JITCompiler::Call callOperation(C_JITOperation_EStZZ operation, GPRReg result, Structure* structure, GPRReg length, unsigned minCapacity)
1084 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), length, TrustedImm32(minCapacity));
1085 return appendCallSetResult(operation, result);
1087 JITCompiler::Call callOperation(C_JITOperation_EJssSt operation, GPRReg result, GPRReg arg1, Structure* structure)
1089 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(structure));
1090 return appendCallSetResult(operation, result);
1092 JITCompiler::Call callOperation(C_JITOperation_EJssJss operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1094 m_jit.setupArgumentsWithExecState(arg1, arg2);
1095 return appendCallSetResult(operation, result);
1097 JITCompiler::Call callOperation(C_JITOperation_B_EJssJss operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1099 m_jit.setupArgumentsWithExecState(arg1, arg2);
1100 return appendCallSetResult(operation, result);
1102 JITCompiler::Call callOperation(C_JITOperation_TT operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1104 m_jit.setupArguments(arg1, arg2);
1105 return appendCallSetResult(operation, result);
1107 JITCompiler::Call callOperation(C_JITOperation_EJssJssJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1109 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1110 return appendCallSetResult(operation, result);
1113 JITCompiler::Call callOperation(S_JITOperation_ECC operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1115 m_jit.setupArgumentsWithExecState(arg1, arg2);
1116 return appendCallSetResult(operation, result);
1119 JITCompiler::Call callOperation(S_JITOperation_EGC operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg2)
1121 m_jit.setupArgumentsWithExecState(TrustedImmPtr(globalObject), arg2);
1122 return appendCallSetResult(operation, result);
1125 JITCompiler::Call callOperation(C_JITOperation_EGC operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg2)
1127 m_jit.setupArgumentsWithExecState(TrustedImmPtr(globalObject), arg2);
1128 return appendCallSetResult(operation, result);
1131 JITCompiler::Call callOperation(Jss_JITOperation_EZ operation, GPRReg result, GPRReg arg1)
1133 m_jit.setupArgumentsWithExecState(arg1);
1134 return appendCallSetResult(operation, result);
1137 JITCompiler::Call callOperation(V_JITOperation_EC operation, GPRReg arg1)
1139 m_jit.setupArgumentsWithExecState(arg1);
1140 return appendCall(operation);
1143 JITCompiler::Call callOperation(V_JITOperation_EC operation, JSCell* arg1)
1145 m_jit.setupArgumentsWithExecState(TrustedImmPtr(arg1));
1146 return appendCall(operation);
1149 JITCompiler::Call callOperation(V_JITOperation_ECIcf operation, GPRReg arg1, InlineCallFrame* inlineCallFrame)
1151 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(inlineCallFrame));
1152 return appendCall(operation);
1154 JITCompiler::Call callOperation(V_JITOperation_ECCIcf operation, GPRReg arg1, GPRReg arg2, InlineCallFrame* inlineCallFrame)
1156 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(inlineCallFrame));
1157 return appendCall(operation);
1160 JITCompiler::Call callOperation(V_JITOperation_ECZ operation, GPRReg arg1, int arg2)
1162 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2));
1163 return appendCall(operation);
1165 JITCompiler::Call callOperation(V_JITOperation_ECC operation, GPRReg arg1, GPRReg arg2)
1167 m_jit.setupArgumentsWithExecState(arg1, arg2);
1168 return appendCall(operation);
1170 JITCompiler::Call callOperation(V_JITOperation_ECC operation, GPRReg arg1, JSCell* arg2)
1172 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(arg2));
1173 return appendCall(operation);
1175 JITCompiler::Call callOperation(V_JITOperation_ECC operation, JSCell* arg1, GPRReg arg2)
1177 m_jit.setupArgumentsWithExecState(TrustedImmPtr(arg1), arg2);
1178 return appendCall(operation);
1181 JITCompiler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb operation, void* pointer)
1183 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
1184 return appendCallWithCallFrameRollbackOnException(operation);
1187 JITCompiler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E operation, GPRReg result)
1189 m_jit.setupArgumentsExecState();
1190 return appendCallWithCallFrameRollbackOnExceptionSetResult(operation, result);
1192 JITCompiler::Call callOperation(Z_JITOperation_EC operation, GPRReg result, GPRReg arg1)
1194 m_jit.setupArgumentsWithExecState(arg1);
1195 return appendCallSetResult(operation, result);
1198 JITCompiler::Call callOperation(V_JITOperation_ECIZC operation, GPRReg regOp1, UniquedStringImpl* identOp2, int32_t op3, GPRReg regOp4)
1200 m_jit.setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4);
1201 return appendCall(operation);
1204 template<typename FunctionType, typename... Args>
1205 JITCompiler::Call callOperation(FunctionType operation, NoResultTag, Args... args)
1207 return callOperation(operation, args...);
1210 JITCompiler::Call callOperation(D_JITOperation_ZZ operation, FPRReg result, GPRReg arg1, GPRReg arg2)
1212 m_jit.setupArguments(arg1, arg2);
1213 return appendCallSetResult(operation, result);
1215 JITCompiler::Call callOperation(D_JITOperation_D operation, FPRReg result, FPRReg arg1)
1217 m_jit.setupArguments(arg1);
1218 return appendCallSetResult(operation, result);
1220 JITCompiler::Call callOperation(D_JITOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
1222 m_jit.setupArguments(arg1, arg2);
1223 return appendCallSetResult(operation, result);
1225 JITCompiler::Call callOperation(T_JITOperation_EJss operation, GPRReg result, GPRReg arg1)
1227 m_jit.setupArgumentsWithExecState(arg1);
1228 return appendCallSetResult(operation, result);
1230 JITCompiler::Call callOperation(C_JITOperation_EJscZ operation, GPRReg result, GPRReg arg1, int32_t arg2)
1232 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2));
1233 return appendCallSetResult(operation, result);
1235 JITCompiler::Call callOperation(C_JITOperation_EZ operation, GPRReg result, GPRReg arg1)
1237 m_jit.setupArgumentsWithExecState(arg1);
1238 return appendCallSetResult(operation, result);
1240 JITCompiler::Call callOperation(C_JITOperation_EZ operation, GPRReg result, int32_t arg1)
1242 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
1243 return appendCallSetResult(operation, result);
1246 JITCompiler::Call callOperation(J_JITOperation_EJscC operation, GPRReg result, GPRReg arg1, JSCell* cell)
1248 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
1249 return appendCallSetResult(operation, result);
1252 JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg result, GPRReg arg1, JSCell* cell, GPRReg arg2)
1254 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell), arg2);
1255 return appendCallSetResult(operation, result);
1258 JITCompiler::Call callOperation(J_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1260 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1261 return appendCallSetResult(operation, result);
1264 JITCompiler::Call callOperation(J_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1266 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1267 return appendCallSetResult(operation, result);
1270 JITCompiler::Call callOperation(V_JITOperation_EWs operation, WatchpointSet* watchpointSet)
1272 m_jit.setupArgumentsWithExecState(TrustedImmPtr(watchpointSet));
1273 return appendCall(operation);
1276 JITCompiler::Call callOperation(V_JITOperation_ECRUiUi operation, GPRReg arg1, GPRReg arg2, Imm32 arg3, GPRReg arg4)
1278 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3.asTrustedImm32(), arg4);
1279 return appendCall(operation);
1282 JITCompiler::Call callOperation(C_JITOperation_EJscI operation, GPRReg result, GPRReg arg1, UniquedStringImpl* impl)
1284 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl));
1285 return appendCallSetResult(operation, result);
1291 JITCompiler::Call callOperation(J_JITOperation_EJJJaic operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, JITAddIC* addIC)
1293 m_jit.setupArgumentsWithExecState(arg1.gpr(), arg2.gpr(), TrustedImmPtr(addIC));
1294 return appendCallSetResult(operation, result.gpr());
1297 JITCompiler::Call callOperation(J_JITOperation_EJJI operation, GPRReg result, GPRReg arg1, GPRReg arg2, UniquedStringImpl* uid)
1299 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(uid));
1300 return appendCallSetResult(operation, result);
1302 JITCompiler::Call callOperation(V_JITOperation_EJJJI operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, UniquedStringImpl* uid)
1304 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, TrustedImmPtr(uid));
1305 return appendCall(operation);
1307 JITCompiler::Call callOperation(V_JITOperation_EJJJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4)
1309 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3, arg4);
1310 return appendCall(operation);
1312 JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, GPRReg arg2, UniquedStringImpl* impl, unsigned value)
1314 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(impl), TrustedImm32(value));
1315 return appendCall(operation);
1317 JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, GPRReg result, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
1319 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
1320 return appendCallSetResult(operation, result);
1322 JITCompiler::Call callOperation(J_JITOperation_E operation, GPRReg result)
1324 m_jit.setupArgumentsExecState();
1325 return appendCallSetResult(operation, result);
1327 JITCompiler::Call callOperation(J_JITOperation_EP operation, GPRReg result, void* pointer)
1329 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
1330 return appendCallSetResult(operation, result);
1332 JITCompiler::Call callOperation(Z_JITOperation_D operation, GPRReg result, FPRReg arg1)
1334 m_jit.setupArguments(arg1);
1335 JITCompiler::Call call = m_jit.appendCall(operation);
1336 m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, result);
1339 JITCompiler::Call callOperation(Q_JITOperation_J operation, GPRReg result, GPRReg value)
1341 m_jit.setupArguments(value);
1342 return appendCallSetResult(operation, result);
1344 JITCompiler::Call callOperation(Q_JITOperation_D operation, GPRReg result, FPRReg value)
1346 m_jit.setupArguments(value);
1347 return appendCallSetResult(operation, result);
1349 JITCompiler::Call callOperation(J_JITOperation_EI operation, GPRReg result, UniquedStringImpl* uid)
1351 m_jit.setupArgumentsWithExecState(TrustedImmPtr(uid));
1352 return appendCallSetResult(operation, result);
1354 JITCompiler::Call callOperation(J_JITOperation_EA operation, GPRReg result, GPRReg arg1)
1356 m_jit.setupArgumentsWithExecState(arg1);
1357 return appendCallSetResult(operation, result);
1359 JITCompiler::Call callOperation(J_JITOperation_EAZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1361 m_jit.setupArgumentsWithExecState(arg1, arg2);
1362 return appendCallSetResult(operation, result);
1364 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1366 m_jit.setupArgumentsWithExecState(arg1, arg2);
1367 return appendCallSetResult(operation, result);
1369 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1371 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1372 return appendCallSetResult(operation, result);
1374 JITCompiler::Call callOperation(J_JITOperation_EJssZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1376 m_jit.setupArgumentsWithExecState(arg1, arg2);
1377 return appendCallSetResult(operation, result);
1379 JITCompiler::Call callOperation(J_JITOperation_EPS operation, GPRReg result, void* pointer, size_t size)
1381 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer), TrustedImmPtr(size));
1382 return appendCallSetResult(operation, result);
1384 JITCompiler::Call callOperation(J_JITOperation_ESS operation, GPRReg result, int startConstant, int numConstants)
1386 m_jit.setupArgumentsWithExecState(TrustedImm32(startConstant), TrustedImm32(numConstants));
1387 return appendCallSetResult(operation, result);
1389 JITCompiler::Call callOperation(J_JITOperation_EPP operation, GPRReg result, GPRReg arg1, void* pointer)
1391 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(pointer));
1392 return appendCallSetResult(operation, result);
1394 JITCompiler::Call callOperation(J_JITOperation_EC operation, GPRReg result, JSCell* cell)
1396 m_jit.setupArgumentsWithExecState(TrustedImmPtr(cell));
1397 return appendCallSetResult(operation, result);
1399 JITCompiler::Call callOperation(J_JITOperation_ECZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1401 m_jit.setupArgumentsWithExecState(arg1, arg2);
1402 return appendCallSetResult(operation, result);
1404 JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, GPRReg result, StructureStubInfo* stubInfo, GPRReg arg1, const UniquedStringImpl* uid)
1406 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
1407 return appendCallSetResult(operation, result);
1409 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, GPRReg result, StructureStubInfo* stubInfo, GPRReg arg1, UniquedStringImpl* uid)
1411 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
1412 return appendCallSetResult(operation, result);
1414 JITCompiler::Call callOperation(J_JITOperation_EDA operation, GPRReg result, FPRReg arg1, GPRReg arg2)
1416 m_jit.setupArgumentsWithExecState(arg1, arg2);
1417 return appendCallSetResult(operation, result);
1419 JITCompiler::Call callOperation(J_JITOperation_EJC operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1421 m_jit.setupArgumentsWithExecState(arg1, arg2);
1422 return appendCallSetResult(operation, result);
1424 JITCompiler::Call callOperation(J_JITOperation_EJZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1426 m_jit.setupArgumentsWithExecState(arg1, arg2);
1427 return appendCallSetResult(operation, result);
1429 JITCompiler::Call callOperation(J_JITOperation_EJA operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1431 m_jit.setupArgumentsWithExecState(arg1, arg2);
1432 return appendCallSetResult(operation, result);
1434 JITCompiler::Call callOperation(J_JITOperation_EP operation, GPRReg result, GPRReg arg1)
1436 m_jit.setupArgumentsWithExecState(arg1);
1437 return appendCallSetResult(operation, result);
1439 JITCompiler::Call callOperation(J_JITOperation_EZ operation, GPRReg result, GPRReg arg1)
1441 m_jit.setupArgumentsWithExecState(arg1);
1442 return appendCallSetResult(operation, result);
1444 JITCompiler::Call callOperation(J_JITOperation_EZ operation, GPRReg result, int32_t arg1)
1446 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
1447 return appendCallSetResult(operation, result);
1449 JITCompiler::Call callOperation(J_JITOperation_EZZ operation, GPRReg result, int32_t arg1, GPRReg arg2)
1451 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2);
1452 return appendCallSetResult(operation, result);
1454 JITCompiler::Call callOperation(J_JITOperation_EZIcfZ operation, GPRReg result, int32_t arg1, InlineCallFrame* inlineCallFrame, GPRReg arg2)
1456 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), TrustedImmPtr(inlineCallFrame), arg2);
1457 return appendCallSetResult(operation, result);
1460 JITCompiler::Call callOperation(P_JITOperation_EJS operation, GPRReg result, GPRReg value, size_t index)
1462 m_jit.setupArgumentsWithExecState(value, TrustedImmPtr(index));
1463 return appendCallSetResult(operation, result);
1466 JITCompiler::Call callOperation(P_JITOperation_EStJ operation, GPRReg result, Structure* structure, GPRReg arg2)
1468 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2);
1469 return appendCallSetResult(operation, result);
1472 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg1)
1474 m_jit.setupArgumentsWithExecState(TrustedImmPtr(globalObject), arg1);
1475 return appendCallSetResult(operation, result);
1478 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, JSValueRegs arg1)
1480 return callOperation(operation, result, globalObject, arg1.gpr());
1483 JITCompiler::Call callOperation(C_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
1485 m_jit.setupArgumentsWithExecState(arg1);
1486 return appendCallSetResult(operation, result);
1488 JITCompiler::Call callOperation(C_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1490 m_jit.setupArgumentsWithExecState(arg1, arg2);
1491 return appendCallSetResult(operation, result);
1493 JITCompiler::Call callOperation(C_JITOperation_EJJC operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1495 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1496 return appendCallSetResult(operation, result);
1498 JITCompiler::Call callOperation(C_JITOperation_EJJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1500 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1501 return appendCallSetResult(operation, result);
1503 JITCompiler::Call callOperation(C_JITOperation_EJZ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1505 m_jit.setupArgumentsWithExecState(arg1, arg2);
1506 return appendCallSetResult(operation, result);
1508 JITCompiler::Call callOperation(C_JITOperation_EJZC operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1510 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1511 return appendCallSetResult(operation, result);
1513 JITCompiler::Call callOperation(S_JITOperation_J operation, GPRReg result, GPRReg arg1)
1515 m_jit.setupArguments(arg1);
1516 return appendCallSetResult(operation, result);
1518 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
1520 m_jit.setupArgumentsWithExecState(arg1);
1521 return appendCallSetResult(operation, result);
1523 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1525 return callOperation(operation, result, arg1.gpr());
1527 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
1529 return callOperation(operation, result.payloadGPR(), arg1.payloadGPR());
1531 JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1533 return callOperation(operation, result, arg1.payloadGPR());
1535 JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
1537 m_jit.setupArgumentsWithExecState(arg1);
1538 return appendCallSetResult(operation, result);
1540 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, GPRReg arg1, UniquedStringImpl* uid)
1542 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(uid));
1543 return appendCallSetResult(operation, result);
1545 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, JSValueRegs arg1, UniquedStringImpl* uid)
1547 return callOperation(operation, result, arg1.gpr(), uid);
1549 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1551 m_jit.setupArgumentsWithExecState(arg1, arg2);
1552 return appendCallSetResult(operation, result);
1554 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
1556 return callOperation(operation, result, arg1.gpr(), arg2.gpr());
1558 JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1560 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1561 return appendCallSetResult(operation, result);
1563 JITCompiler::Call callOperation(S_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1565 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1566 return appendCallSetResult(operation, result);
1568 JITCompiler::Call callOperation(S_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1570 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1571 return appendCallSetResult(operation, result);
1574 JITCompiler::Call callOperation(J_JITOperation_EPP operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1576 m_jit.setupArgumentsWithExecState(arg1, arg2);
1577 return appendCallSetResult(operation, result);
1579 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1581 m_jit.setupArgumentsWithExecState(arg1, arg2);
1582 return appendCallSetResult(operation, result);
1584 JITCompiler::Call callOperation(J_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1586 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1587 return appendCallSetResult(operation, result);
1589 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, GPRReg arg1, int32_t imm)
1591 m_jit.setupArgumentsWithExecState(arg1, MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm))));
1592 return appendCallSetResult(operation, result);
1594 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg result, int32_t imm, GPRReg arg2)
1596 m_jit.setupArgumentsWithExecState(MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(imm))), arg2);
1597 return appendCallSetResult(operation, result);
1599 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2)
1601 return callOperation(operation, result.payloadGPR(), arg1.payloadGPR(), arg2.payloadGPR());
1603 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1605 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1606 return appendCallSetResult(operation, result);
1608 JITCompiler::Call callOperation(J_JITOperation_ECC operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1610 m_jit.setupArgumentsWithExecState(arg1, arg2);
1611 return appendCallSetResult(operation, result);
1613 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
1615 m_jit.setupArgumentsWithExecState(arg1, arg2);
1616 return appendCallSetResult(operation, result);
1618 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2)
1620 m_jit.setupArgumentsWithExecState(arg1, arg2.gpr());
1621 return appendCallSetResult(operation, result);
1624 JITCompiler::Call callOperation(V_JITOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3)
1626 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1627 return appendCall(operation);
1629 JITCompiler::Call callOperation(V_JITOperation_EJ operation, GPRReg arg1)
1631 m_jit.setupArgumentsWithExecState(arg1);
1632 return appendCall(operation);
1634 JITCompiler::Call callOperation(V_JITOperation_EJPP operation, GPRReg arg1, GPRReg arg2, void* pointer)
1636 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(pointer));
1637 return appendCall(operation);
1639 JITCompiler::Call callOperation(V_JITOperation_ESsiJJI operation, StructureStubInfo* stubInfo, GPRReg arg1, GPRReg arg2, UniquedStringImpl* uid)
1641 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, arg2, TrustedImmPtr(uid));
1642 return appendCall(operation);
1644 JITCompiler::Call callOperation(V_JITOperation_EJJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1646 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1647 return appendCall(operation);
1649 JITCompiler::Call callOperation(V_JITOperation_EPZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1651 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1652 return appendCall(operation);
1655 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1657 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1658 return appendCall(operation);
1660 JITCompiler::Call callOperation(V_JITOperation_ECJ operation, GPRReg arg1, JSValueRegs arg2)
1662 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR());
1663 return appendCall(operation);
1665 JITCompiler::Call callOperation(V_JITOperation_ECJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1667 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1668 return appendCall(operation);
1671 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, GPRReg arg1, unsigned arg2, unsigned arg3)
1673 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2), TrustedImm32(arg3));
1674 return appendCallSetResult(operation, result);
1676 JITCompiler::Call callOperation(F_JITOperation_EFJZZ operation, GPRReg result, GPRReg arg1, GPRReg arg2, unsigned arg3, GPRReg arg4)
1678 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImm32(arg3), arg4);
1679 return appendCallSetResult(operation, result);
1682 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1684 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1685 return appendCallSetResult(operation, result);
1687 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, JSValueRegs arg1, GPRReg arg2, JSValueRegs arg3)
1689 return callOperation(operation, result, arg1.payloadGPR(), arg2, arg3.payloadGPR());
1692 JITCompiler::Call callOperation(Z_JITOperation_EJZ operation, GPRReg result, GPRReg arg1, unsigned arg2)
1694 m_jit.setupArgumentsWithExecState(arg1, TrustedImm32(arg2));
1695 return appendCallSetResult(operation, result);
1697 JITCompiler::Call callOperation(V_JITOperation_EZJZZZ operation, unsigned arg1, GPRReg arg2, unsigned arg3, GPRReg arg4, unsigned arg5)
1699 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2, TrustedImm32(arg3), arg4, TrustedImm32(arg5));
1700 return appendCall(operation);
1702 JITCompiler::Call callOperation(V_JITOperation_ECJZC operation, GPRReg regOp1, GPRReg regOp2, int32_t op3, GPRReg regOp4)
1704 m_jit.setupArgumentsWithExecState(regOp1, regOp2, TrustedImm32(op3), regOp4);
1705 return appendCall(operation);
1707 JITCompiler::Call callOperation(V_JITOperation_ECIZJJ operation, GPRReg regOp1, UniquedStringImpl* identOp2, int32_t op3, GPRReg regOp4, GPRReg regOp5)
1709 m_jit.setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4, regOp5);
1710 return appendCall(operation);
1712 #else // USE(JSVALUE32_64)
1714 JITCompiler::Call callOperation(J_JITOperation_EJJJaic operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, JITAddIC* addIC)
1716 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), TrustedImmPtr(addIC));
1717 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1720 JITCompiler::Call callOperation(J_JITOperation_EJJI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, UniquedStringImpl* uid)
1722 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, TrustedImmPtr(uid));
1723 return appendCallSetResult(operation, resultPayload, resultTag);
1725 JITCompiler::Call callOperation(V_JITOperation_EJJJI operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload, UniquedStringImpl* uid)
1727 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, arg3Payload, arg3Tag, TrustedImmPtr(uid));
1728 return appendCall(operation);
1730 JITCompiler::Call callOperation(V_JITOperation_EJJJJ operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload, GPRReg arg4Tag, GPRReg arg4Payload)
1732 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, arg3Payload, arg3Tag, arg4Payload, arg4Tag);
1733 return appendCall(operation);
1736 JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, UniquedStringImpl* impl, unsigned value)
1738 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, TrustedImmPtr(impl), TrustedImm32(value));
1739 return appendCall(operation);
1741 JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
1743 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
1744 return appendCallSetResult(operation, resultPayload, resultTag);
1746 JITCompiler::Call callOperation(D_JITOperation_G operation, FPRReg result, JSGlobalObject* globalObject)
1748 m_jit.setupArguments(TrustedImmPtr(globalObject));
1749 return appendCallSetResult(operation, result);
1751 JITCompiler::Call callOperation(Z_JITOperation_D operation, GPRReg result, FPRReg arg1)
1753 prepareForExternalCall();
1754 m_jit.setupArguments(arg1);
1755 JITCompiler::Call call = m_jit.appendCall(operation);
1756 m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, result);
1759 JITCompiler::Call callOperation(J_JITOperation_E operation, GPRReg resultTag, GPRReg resultPayload)
1761 m_jit.setupArgumentsExecState();
1762 return appendCallSetResult(operation, resultPayload, resultTag);
1764 JITCompiler::Call callOperation(J_JITOperation_EP operation, GPRReg resultTag, GPRReg resultPayload, void* pointer)
1766 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
1767 return appendCallSetResult(operation, resultPayload, resultTag);
1769 JITCompiler::Call callOperation(J_JITOperation_EPP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, void* pointer)
1771 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(pointer));
1772 return appendCallSetResult(operation, resultPayload, resultTag);
1774 JITCompiler::Call callOperation(J_JITOperation_EP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1)
1776 m_jit.setupArgumentsWithExecState(arg1);
1777 return appendCallSetResult(operation, resultPayload, resultTag);
1779 JITCompiler::Call callOperation(J_JITOperation_EI operation, GPRReg resultTag, GPRReg resultPayload, UniquedStringImpl* uid)
1781 m_jit.setupArgumentsWithExecState(TrustedImmPtr(uid));
1782 return appendCallSetResult(operation, resultPayload, resultTag);
1784 JITCompiler::Call callOperation(J_JITOperation_EA operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1)
1786 m_jit.setupArgumentsWithExecState(arg1);
1787 return appendCallSetResult(operation, resultPayload, resultTag);
1789 JITCompiler::Call callOperation(J_JITOperation_EAZ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2)
1791 m_jit.setupArgumentsWithExecState(arg1, arg2);
1792 return appendCallSetResult(operation, resultPayload, resultTag);
1794 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
1796 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1.tagGPR(), arg1.payloadGPR());
1798 JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg resultPayload, GPRReg resultTag, GPRReg arg1)
1800 m_jit.setupArgumentsWithExecState(arg1);
1801 return appendCallSetResult(operation, resultPayload, resultTag);
1803 JITCompiler::Call callOperation(J_JITOperation_EJC operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
1805 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
1806 return appendCallSetResult(operation, resultPayload, resultTag);
1808 JITCompiler::Call callOperation(J_JITOperation_EJssZ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2)
1810 m_jit.setupArgumentsWithExecState(arg1, arg2);
1811 return appendCallSetResult(operation, resultPayload, resultTag);
1813 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2)
1815 m_jit.setupArgumentsWithExecState(arg1, arg2);
1816 return appendCallSetResult(operation, resultPayload, resultTag);
1818 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1820 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1821 return appendCallSetResult(operation, resultPayload, resultTag);
1823 JITCompiler::Call callOperation(J_JITOperation_EPS operation, GPRReg resultTag, GPRReg resultPayload, void* pointer, size_t size)
1825 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer), TrustedImmPtr(size));
1826 return appendCallSetResult(operation, resultPayload, resultTag);
1828 JITCompiler::Call callOperation(J_JITOperation_ESS operation, GPRReg resultTag, GPRReg resultPayload, int startConstant, int numConstants)
1830 m_jit.setupArgumentsWithExecState(TrustedImm32(startConstant), TrustedImm32(numConstants));
1831 return appendCallSetResult(operation, resultPayload, resultTag);
1833 JITCompiler::Call callOperation(J_JITOperation_EJP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, void* pointer)
1835 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(pointer));
1836 return appendCallSetResult(operation, resultPayload, resultTag);
1838 JITCompiler::Call callOperation(J_JITOperation_EJP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
1840 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
1841 return appendCallSetResult(operation, resultPayload, resultTag);
1844 JITCompiler::Call callOperation(J_JITOperation_EC operation, GPRReg resultTag, GPRReg resultPayload, JSCell* cell)
1846 m_jit.setupArgumentsWithExecState(TrustedImmPtr(cell));
1847 return appendCallSetResult(operation, resultPayload, resultTag);
1849 JITCompiler::Call callOperation(J_JITOperation_ECZ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2)
1851 m_jit.setupArgumentsWithExecState(arg1, arg2);
1852 return appendCallSetResult(operation, resultPayload, resultTag);
1854 JITCompiler::Call callOperation(J_JITOperation_EJscC operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, JSCell* cell)
1856 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
1857 return appendCallSetResult(operation, resultPayload, resultTag);
1859 JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg result, GPRReg arg1, JSCell* cell, GPRReg arg2Tag, GPRReg arg2Payload)
1861 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell), EABI_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
1862 return appendCallSetResult(operation, result);
1864 JITCompiler::Call callOperation(J_JITOperation_EGReoJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
1866 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
1867 return appendCallSetResult(operation, resultPayload, resultTag);
1869 JITCompiler::Call callOperation(J_JITOperation_EGReoJss operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1871 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1872 return appendCallSetResult(operation, resultPayload, resultTag);
1874 JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, GPRReg resultTag, GPRReg resultPayload, StructureStubInfo* stubInfo, GPRReg arg1, const UniquedStringImpl* uid)
1876 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
1877 return appendCallSetResult(operation, resultPayload, resultTag);
1879 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, GPRReg resultTag, GPRReg resultPayload, StructureStubInfo* stubInfo, GPRReg arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
1881 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, arg1Tag, TrustedImmPtr(uid));
1882 return appendCallSetResult(operation, resultPayload, resultTag);
1884 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, GPRReg resultTag, GPRReg resultPayload, StructureStubInfo* stubInfo, int32_t arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
1886 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, TrustedImm32(arg1Tag), TrustedImmPtr(uid));
1887 return appendCallSetResult(operation, resultPayload, resultTag);
1889 JITCompiler::Call callOperation(J_JITOperation_EDA operation, GPRReg resultTag, GPRReg resultPayload, FPRReg arg1, GPRReg arg2)
1891 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1, arg2);
1892 return appendCallSetResult(operation, resultPayload, resultTag);
1894 JITCompiler::Call callOperation(J_JITOperation_EJA operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
1896 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
1897 return appendCallSetResult(operation, resultPayload, resultTag);
1899 JITCompiler::Call callOperation(J_JITOperation_EJA operation, GPRReg resultTag, GPRReg resultPayload, TrustedImm32 arg1Tag, GPRReg arg1Payload, GPRReg arg2)
1901 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
1902 return appendCallSetResult(operation, resultPayload, resultTag);
1904 JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload)
1906 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag);
1907 return appendCallSetResult(operation, resultPayload, resultTag);
1909 JITCompiler::Call callOperation(J_JITOperation_EZ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1)
1911 m_jit.setupArgumentsWithExecState(arg1);
1912 return appendCallSetResult(operation, resultPayload, resultTag);
1914 JITCompiler::Call callOperation(J_JITOperation_EZ operation, GPRReg resultTag, GPRReg resultPayload, int32_t arg1)
1916 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
1917 return appendCallSetResult(operation, resultPayload, resultTag);
1919 JITCompiler::Call callOperation(J_JITOperation_EZIcfZ operation, GPRReg resultTag, GPRReg resultPayload, int32_t arg1, InlineCallFrame* inlineCallFrame, GPRReg arg2)
1921 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), TrustedImmPtr(inlineCallFrame), arg2);
1922 return appendCallSetResult(operation, resultPayload, resultTag);
1924 JITCompiler::Call callOperation(J_JITOperation_EZZ operation, GPRReg resultTag, GPRReg resultPayload, int32_t arg1, GPRReg arg2)
1926 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2);
1927 return appendCallSetResult(operation, resultPayload, resultTag);
1930 JITCompiler::Call callOperation(P_JITOperation_EJS operation, GPRReg result, JSValueRegs value, size_t index)
1932 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG value.payloadGPR(), value.tagGPR(), TrustedImmPtr(index));
1933 return appendCallSetResult(operation, result);
1936 JITCompiler::Call callOperation(P_JITOperation_EStJ operation, GPRReg result, Structure* structure, GPRReg arg2Tag, GPRReg arg2Payload)
1938 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2Payload, arg2Tag);
1939 return appendCallSetResult(operation, result);
1942 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, GPRReg arg1Tag, GPRReg arg1Payload)
1944 m_jit.setupArgumentsWithExecState(TrustedImmPtr(globalObject), arg1Payload, arg1Tag);
1945 return appendCallSetResult(operation, result);
1948 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, JSValueRegs arg1)
1950 return callOperation(operation, result, globalObject, arg1.tagGPR(), arg1.payloadGPR());
1953 JITCompiler::Call callOperation(C_JITOperation_EJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload)
1955 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag);
1956 return appendCallSetResult(operation, result);
1959 JITCompiler::Call callOperation(C_JITOperation_EJJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload)
1961 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag);
1962 return appendCallSetResult(operation, result);
1965 JITCompiler::Call callOperation(C_JITOperation_EJJJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
1967 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, arg3Payload, arg3Tag);
1968 return appendCallSetResult(operation, result);
1971 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload)
1973 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag);
1974 return appendCallSetResult(operation, result);
1977 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1979 return callOperation(operation, result, arg1.tagGPR(), arg1.payloadGPR());
1982 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
1984 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(uid));
1985 return appendCallSetResult(operation, result);
1988 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, JSValueRegs arg1Regs, UniquedStringImpl* uid)
1990 return callOperation(operation, result, arg1Regs.tagGPR(), arg1Regs.payloadGPR(), uid);
1993 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload)
1995 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
1996 return appendCallSetResult(operation, result);
1999 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
2001 return callOperation(operation, result, arg1.tagGPR(), arg1.payloadGPR(), arg2.tagGPR(), arg2.payloadGPR());
2004 JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
2006 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2007 return appendCallSetResult(operation, result);
2009 JITCompiler::Call callOperation(S_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
2011 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2012 return appendCallSetResult(operation, result);
2014 JITCompiler::Call callOperation(S_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
2016 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
2017 return appendCallSetResult(operation, result);
2019 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload)
2021 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
2022 return appendCallSetResult(operation, resultPayload, resultTag);
2024 JITCompiler::Call callOperation(J_JITOperation_EGJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
2026 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2027 return appendCallSetResult(operation, resultPayload, resultTag);
2029 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, MacroAssembler::TrustedImm32 imm)
2031 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG imm, TrustedImm32(JSValue::Int32Tag));
2032 return appendCallSetResult(operation, resultPayload, resultTag);
2034 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, MacroAssembler::TrustedImm32 imm, GPRReg arg2Tag, GPRReg arg2Payload)
2036 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG imm, TrustedImm32(JSValue::Int32Tag), SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
2037 return appendCallSetResult(operation, resultPayload, resultTag);
2039 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2)
2041 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1.tagGPR(), arg1.payloadGPR(), arg2.tagGPR(), arg2.payloadGPR());
2043 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
2045 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, arg3Payload, arg3Tag);
2046 return appendCallSetResult(operation, resultPayload, resultTag);
2049 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload)
2051 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag);
2052 return appendCallSetResult(operation, resultPayload, resultTag);
2054 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2Payload)
2056 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, MacroAssembler::TrustedImm32(JSValue::CellTag));
2057 return appendCallSetResult(operation, resultPayload, resultTag);
2059 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, JSValueRegs result, GPRReg arg1, JSValueRegs arg2)
2061 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
2062 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2064 JITCompiler::Call callOperation(J_JITOperation_ECC operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2)
2066 m_jit.setupArgumentsWithExecState(arg1, arg2);
2067 return appendCallSetResult(operation, resultPayload, resultTag);
2070 JITCompiler::Call callOperation(V_JITOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3)
2072 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3);
2073 return appendCall(operation);
2076 JITCompiler::Call callOperation(V_JITOperation_EJ operation, GPRReg arg1Tag, GPRReg arg1Payload)
2078 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag);
2079 return appendCall(operation);
2082 JITCompiler::Call callOperation(V_JITOperation_EJPP operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2, void* pointer)
2084 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2, TrustedImmPtr(pointer));
2085 return appendCall(operation);
2087 JITCompiler::Call callOperation(V_JITOperation_ESsiJJI operation, StructureStubInfo* stubInfo, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Payload, UniquedStringImpl* uid)
2089 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, arg1Tag, arg2Payload, TrustedImm32(JSValue::CellTag), TrustedImmPtr(uid));
2090 return appendCall(operation);
2092 JITCompiler::Call callOperation(V_JITOperation_ECJ operation, GPRReg arg1, JSValueRegs arg2)
2094 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
2095 return appendCall(operation);
2097 JITCompiler::Call callOperation(V_JITOperation_ECJJ operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
2099 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, arg3Payload, arg3Tag);
2100 return appendCall(operation);
2103 JITCompiler::Call callOperation(V_JITOperation_EPZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
2105 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2106 return appendCall(operation);
2109 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
2111 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2112 return appendCall(operation);
2114 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, TrustedImm32 arg3Tag, GPRReg arg3Payload)
2116 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2117 return appendCall(operation);
2120 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
2122 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2123 return appendCallSetResult(operation, result);
2125 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, JSValueRegs arg1, GPRReg arg2, JSValueRegs arg3)
2127 return callOperation(operation, result, arg1.tagGPR(), arg1.payloadGPR(), arg2, arg3.tagGPR(), arg3.payloadGPR());
2130 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, unsigned arg2, unsigned arg3)
2132 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImm32(arg2), TrustedImm32(arg3));
2133 return appendCallSetResult(operation, result);
2135 JITCompiler::Call callOperation(F_JITOperation_EFJZZ operation, GPRReg result, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, unsigned arg3, GPRReg arg4)
2137 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, TrustedImm32(arg3), arg4);
2138 return appendCallSetResult(operation, result);
2140 JITCompiler::Call callOperation(Z_JITOperation_EJZ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, unsigned arg2)
2142 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImm32(arg2));
2143 return appendCallSetResult(operation, result);
2145 JITCompiler::Call callOperation(V_JITOperation_EZJZZZ operation, unsigned arg1, GPRReg arg2Tag, GPRReg arg2Payload, unsigned arg3, GPRReg arg4, unsigned arg5)
2147 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2Payload, arg2Tag, TrustedImm32(arg3), arg4, TrustedImm32(arg5));
2148 return appendCall(operation);
2150 JITCompiler::Call callOperation(V_JITOperation_ECJZC operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, int32_t arg3, GPRReg arg4)
2152 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, TrustedImm32(arg3), arg4);
2153 return appendCall(operation);
2155 JITCompiler::Call callOperation(V_JITOperation_ECIZCC operation, GPRReg arg1, UniquedStringImpl* identOp2, int32_t op3, GPRReg arg4, GPRReg arg5)
2157 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(identOp2), TrustedImm32(op3), arg4, arg5);
2158 return appendCall(operation);
2161 template<typename FunctionType>
2162 JITCompiler::Call callOperation(
2163 FunctionType operation, JSValueRegs result)
2165 return callOperation(operation, result.tagGPR(), result.payloadGPR());
2167 template<typename FunctionType, typename ArgumentType1>
2168 JITCompiler::Call callOperation(
2169 FunctionType operation, JSValueRegs result, ArgumentType1 arg1)
2171 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1);
2173 template<typename FunctionType, typename ArgumentType1, typename ArgumentType2>
2174 JITCompiler::Call callOperation(
2175 FunctionType operation, JSValueRegs result, ArgumentType1 arg1, ArgumentType2 arg2)
2177 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1, arg2);
2180 typename FunctionType, typename ArgumentType1, typename ArgumentType2,
2181 typename ArgumentType3>
2182 JITCompiler::Call callOperation(
2183 FunctionType operation, JSValueRegs result, ArgumentType1 arg1, ArgumentType2 arg2,
2186 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1, arg2, arg3);
2189 typename FunctionType, typename ArgumentType1, typename ArgumentType2,
2190 typename ArgumentType3, typename ArgumentType4>
2191 JITCompiler::Call callOperation(
2192 FunctionType operation, JSValueRegs result, ArgumentType1 arg1, ArgumentType2 arg2,
2193 ArgumentType3 arg3, ArgumentType4 arg4)
2195 return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1, arg2, arg3, arg4);
2198 typename FunctionType, typename ArgumentType1, typename ArgumentType2,
2199 typename ArgumentType3, typename ArgumentType4, typename ArgumentType5>
2200 JITCompiler::Call callOperation(
2201 FunctionType operation, JSValueRegs result, ArgumentType1 arg1, ArgumentType2 arg2,
2202 ArgumentType3 arg3, ArgumentType4 arg4, ArgumentType5 arg5)
2204 return callOperation(
2205 operation, result.tagGPR(), result.payloadGPR(), arg1, arg2, arg3, arg4, arg5);
2207 #endif // USE(JSVALUE32_64)
2209 #if !defined(NDEBUG) && !CPU(ARM) && !CPU(MIPS) && !CPU(SH4)
2210 void prepareForExternalCall()
2212 // We're about to call out to a "native" helper function. The helper
2213 // function is expected to set topCallFrame itself with the ExecState
2214 // that is passed to it.
2216 // We explicitly trash topCallFrame here so that we'll know if some of
2217 // the helper functions are not setting topCallFrame when they should
2218 // be doing so. Note: the previous value in topcallFrame was not valid
2219 // anyway since it was not being updated by JIT'ed code by design.
2221 for (unsigned i = 0; i < sizeof(void*) / 4; i++)
2222 m_jit.store32(TrustedImm32(0xbadbeef), reinterpret_cast<char*>(&m_jit.vm()->topCallFrame) + i * 4);
2225 void prepareForExternalCall() { }
2228 // These methods add call instructions, optionally setting results, and optionally rolling back the call frame on an exception.
2229 JITCompiler::Call appendCall(const FunctionPtr& function)
2231 prepareForExternalCall();
2232 m_jit.emitStoreCodeOrigin(m_currentNode->origin.semantic);
2233 return m_jit.appendCall(function);
2235 JITCompiler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr& function)
2237 JITCompiler::Call call = appendCall(function);
2238 m_jit.exceptionCheckWithCallFrameRollback();
2241 JITCompiler::Call appendCallWithCallFrameRollbackOnExceptionSetResult(const FunctionPtr& function, GPRReg result)
2243 JITCompiler::Call call = appendCallWithCallFrameRollbackOnException(function);
2244 if ((result != InvalidGPRReg) && (result != GPRInfo::returnValueGPR))
2245 m_jit.move(GPRInfo::returnValueGPR, result);
2248 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result)
2250 JITCompiler::Call call = appendCall(function);
2251 if (result != InvalidGPRReg)
2252 m_jit.move(GPRInfo::returnValueGPR, result);
2255 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result1, GPRReg result2)
2257 JITCompiler::Call call = appendCall(function);
2258 m_jit.setupResults(result1, result2);
2262 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2264 JITCompiler::Call call = appendCall(function);
2265 if (result != InvalidFPRReg) {
2266 m_jit.assembler().fstpl(0, JITCompiler::stackPointerRegister);
2267 m_jit.loadDouble(JITCompiler::stackPointerRegister, result);
2271 #elif CPU(ARM) && !CPU(ARM_HARDFP)
2272 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2274 JITCompiler::Call call = appendCall(function);
2275 if (result != InvalidFPRReg)
2276 m_jit.assembler().vmov(result, GPRInfo::returnValueGPR, GPRInfo::returnValueGPR2);
2279 #else // CPU(X86_64) || (CPU(ARM) && CPU(ARM_HARDFP)) || CPU(ARM64) || CPU(MIPS) || CPU(SH4)
2280 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2282 JITCompiler::Call call = appendCall(function);
2283 if (result != InvalidFPRReg)
2284 m_jit.moveDouble(FPRInfo::returnValueFPR, result);
2289 void branchDouble(JITCompiler::DoubleCondition cond, FPRReg left, FPRReg right, BasicBlock* destination)
2291 return addBranch(m_jit.branchDouble(cond, left, right), destination);
2294 void branchDoubleNonZero(FPRReg value, FPRReg scratch, BasicBlock* destination)
2296 return addBranch(m_jit.branchDoubleNonZero(value, scratch), destination);
2299 template<typename T, typename U>
2300 void branch32(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2302 return addBranch(m_jit.branch32(cond, left, right), destination);
2305 template<typename T, typename U>
2306 void branchTest32(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2308 return addBranch(m_jit.branchTest32(cond, value, mask), destination);
2311 template<typename T>
2312 void branchTest32(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2314 return addBranch(m_jit.branchTest32(cond, value), destination);
2318 template<typename T, typename U>
2319 void branch64(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2321 return addBranch(m_jit.branch64(cond, left, right), destination);
2325 template<typename T, typename U>
2326 void branch8(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2328 return addBranch(m_jit.branch8(cond, left, right), destination);
2331 template<typename T, typename U>
2332 void branchPtr(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2334 return addBranch(m_jit.branchPtr(cond, left, right), destination);
2337 template<typename T, typename U>
2338 void branchTestPtr(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2340 return addBranch(m_jit.branchTestPtr(cond, value, mask), destination);
2343 template<typename T>
2344 void branchTestPtr(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2346 return addBranch(m_jit.branchTestPtr(cond, value), destination);
2349 template<typename T, typename U>
2350 void branchTest8(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2352 return addBranch(m_jit.branchTest8(cond, value, mask), destination);
2355 template<typename T>
2356 void branchTest8(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2358 return addBranch(m_jit.branchTest8(cond, value), destination);
2361 enum FallThroughMode {
2365 void jump(BasicBlock* destination, FallThroughMode fallThroughMode = AtFallThroughPoint)
2367 if (destination == nextBlock()
2368 && fallThroughMode == AtFallThroughPoint)
2370 addBranch(m_jit.jump(), destination);
2373 void addBranch(const MacroAssembler::Jump& jump, BasicBlock* destination)
2375 m_branches.append(BranchRecord(jump, destination));
2377 void addBranch(const MacroAssembler::JumpList& jump, BasicBlock* destination);
2379 void linkBranches();
2381 void dump(const char* label = 0);
2383 bool betterUseStrictInt52(Node* node)
2385 return !generationInfo(node).isInt52();
2387 bool betterUseStrictInt52(Edge edge)
2389 return betterUseStrictInt52(edge.node());
2392 bool compare(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_JITOperation_EJJ);
2393 bool compilePeepHoleBranch(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_JITOperation_EJJ);
2394 void compilePeepHoleInt32Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2395 void compilePeepHoleInt52Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2396 void compilePeepHoleBooleanBranch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2397 void compilePeepHoleDoubleBranch(Node*, Node* branchNode, JITCompiler::DoubleCondition);
2398 void compilePeepHoleObjectEquality(Node*, Node* branchNode);
2399 void compilePeepHoleObjectStrictEquality(Edge objectChild, Edge otherChild, Node* branchNode);
2400 void compilePeepHoleObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild, Node* branchNode);
2401 void compileObjectEquality(Node*);
2402 void compileObjectStrictEquality(Edge objectChild, Edge otherChild);
2403 void compileObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild);
2404 void compileObjectOrOtherLogicalNot(Edge value);
2405 void compileLogicalNot(Node*);
2406 void compileLogicalNotStringOrOther(Node*);
2407 void compileStringEquality(
2408 Node*, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR,
2409 GPRReg leftTempGPR, GPRReg rightTempGPR, GPRReg leftTemp2GPR,
2410 GPRReg rightTemp2GPR, JITCompiler::JumpList fastTrue,
2411 JITCompiler::JumpList fastSlow);
2412 void compileStringEquality(Node*);
2413 void compileStringIdentEquality(Node*);
2414 void compileStringToUntypedEquality(Node*, Edge stringEdge, Edge untypedEdge);
2415 void compileStringIdentToNotStringVarEquality(Node*, Edge stringEdge, Edge notStringVarEdge);
2416 void compileStringZeroLength(Node*);
2417 void compileMiscStrictEq(Node*);
2419 template<typename Functor>
2420 void extractStringImplFromBinarySymbols(Edge leftSymbolEdge, Edge rightSymbolEdge, const Functor&);
2421 void compileSymbolEquality(Node*);
2422 void compilePeepHoleSymbolEquality(Node*, Node* branchNode);
2423 void compileSymbolUntypedEquality(Node*, Edge symbolEdge, Edge untypedEdge);
2425 void emitObjectOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2426 void emitStringBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2427 void emitStringOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2428 void emitBranch(Node*);
2430 struct StringSwitchCase {
2431 StringSwitchCase() { }
2433 StringSwitchCase(StringImpl* string, BasicBlock* target)
2439 bool operator<(const StringSwitchCase& other) const
2441 return stringLessThan(*string, *other.string);
2448 void emitSwitchIntJump(SwitchData*, GPRReg value, GPRReg scratch);
2449 void emitSwitchImm(Node*, SwitchData*);
2450 void emitSwitchCharStringJump(SwitchData*, GPRReg value, GPRReg scratch);
2451 void emitSwitchChar(Node*, SwitchData*);
2452 void emitBinarySwitchStringRecurse(
2453 SwitchData*, const Vector<StringSwitchCase>&, unsigned numChecked,
2454 unsigned begin, unsigned end, GPRReg buffer, GPRReg length, GPRReg temp,
2455 unsigned alreadyCheckedLength, bool checkedExactLength);
2456 void emitSwitchStringOnString(SwitchData*, GPRReg string);
2457 void emitSwitchString(Node*, SwitchData*);
2458 void emitSwitch(Node*);
2460 void compileToStringOrCallStringConstructorOnCell(Node*);
2461 void compileNewStringObject(Node*);
2463 void compileNewTypedArray(Node*);
2465 void compileInt32Compare(Node*, MacroAssembler::RelationalCondition);
2466 void compileInt52Compare(Node*, MacroAssembler::RelationalCondition);
2467 void compileBooleanCompare(Node*, MacroAssembler::RelationalCondition);
2468 void compileDoubleCompare(Node*, MacroAssembler::DoubleCondition);
2469 void compileStringCompare(Node*, MacroAssembler::RelationalCondition);
2470 void compileStringIdentCompare(Node*, MacroAssembler::RelationalCondition);
2472 bool compileStrictEq(Node*);
2474 void compileAllocatePropertyStorage(Node*);
2475 void compileReallocatePropertyStorage(Node*);
2476 void compileGetButterfly(Node*);
2478 #if USE(JSVALUE32_64)
2479 template<typename BaseOperandType, typename PropertyOperandType, typename ValueOperandType, typename TagType>
2480 void compileContiguousPutByVal(Node*, BaseOperandType&, PropertyOperandType&, ValueOperandType&, GPRReg valuePayloadReg, TagType valueTag);
2482 void compileDoublePutByVal(Node*, SpeculateCellOperand& base, SpeculateStrictInt32Operand& property);
2483 bool putByValWillNeedExtraRegister(ArrayMode arrayMode)
2485 return arrayMode.mayStoreToHole();
2487 GPRReg temporaryRegisterForPutByVal(GPRTemporary&, ArrayMode);
2488 GPRReg temporaryRegisterForPutByVal(GPRTemporary& temporary, Node* node)
2490 return temporaryRegisterForPutByVal(temporary, node->arrayMode());
2493 void compileGetCharCodeAt(Node*);
2494 void compileGetByValOnString(Node*);
2495 void compileFromCharCode(Node*);
2497 void compileGetByValOnDirectArguments(Node*);
2498 void compileGetByValOnScopedArguments(Node*);
2500 void compileGetScope(Node*);
2501 void compileSkipScope(Node*);
2502 void compileGetGlobalObject(Node*);
2504 void compileGetArrayLength(Node*);
2506 void compileCheckTypeInfoFlags(Node*);
2507 void compileCheckIdent(Node*);
2509 void compileValueRep(Node*);
2510 void compileDoubleRep(Node*);
2512 void compileValueToInt32(Node*);
2513 void compileUInt32ToNumber(Node*);
2514 void compileDoubleAsInt32(Node*);
2516 template<typename SnippetGenerator, J_JITOperation_EJJ slowPathFunction>
2517 void emitUntypedBitOp(Node*);
2518 void compileBitwiseOp(Node*);
2520 void emitUntypedRightShiftBitOp(Node*);
2521 void compileShiftOp(Node*);
2523 void compileValueAdd(Node*);
2524 void compileArithAdd(Node*);
2525 void compileMakeRope(Node*);
2526 void compileArithClz32(Node*);
2527 void compileArithSub(Node*);
2528 void compileArithNegate(Node*);
2529 void compileArithMul(Node*);
2530 void compileArithDiv(Node*);
2531 void compileArithMod(Node*);
2532 void compileArithPow(Node*);
2533 void compileArithRounding(Node*);
2534 void compileArithRandom(Node*);
2535 void compileArithSqrt(Node*);
2536 void compileArithLog(Node*);
2537 void compileConstantStoragePointer(Node*);
2538 void compileGetIndexedPropertyStorage(Node*);
2539 JITCompiler::Jump jumpForTypedArrayOutOfBounds(Node*, GPRReg baseGPR, GPRReg indexGPR);
2540 JITCompiler::Jump jumpForTypedArrayIsNeuteredIfOutOfBounds(Node*, GPRReg baseGPR, JITCompiler::Jump outOfBounds);
2541 void emitTypedArrayBoundsCheck(Node*, GPRReg baseGPR, GPRReg indexGPR);
2542 void compileGetTypedArrayByteOffset(Node*);
2543 void compileGetByValOnIntTypedArray(Node*, TypedArrayType);
2544 void compilePutByValForIntTypedArray(GPRReg base, GPRReg property, Node*, TypedArrayType);
2545 void compileGetByValOnFloatTypedArray(Node*, TypedArrayType);
2546 void compilePutByValForFloatTypedArray(GPRReg base, GPRReg property, Node*, TypedArrayType);
2547 template <typename ClassType> void compileNewFunctionCommon(GPRReg, Structure*, GPRReg, GPRReg, GPRReg, MacroAssembler::JumpList&, size_t, FunctionExecutable*, ptrdiff_t, ptrdiff_t, ptrdiff_t);
2548 void compileNewFunction(Node*);
2549 void compileSetFunctionName(Node*);
2550 void compileForwardVarargs(Node*);
2551 void compileCreateActivation(Node*);
2552 void compileCreateDirectArguments(Node*);
2553 void compileGetFromArguments(Node*);
2554 void compilePutToArguments(Node*);
2555 void compileCreateScopedArguments(Node*);
2556 void compileCreateClonedArguments(Node*);
2557 void compileCopyRest(Node*);
2558 void compileGetRestLength(Node*);
2559 void compileNotifyWrite(Node*);
2560 bool compileRegExpExec(Node*);
2561 void compileIsObjectOrNull(Node*);
2562 void compileIsFunction(Node*);
2563 void compileTypeOf(Node*);
2564 void compileCheckStructure(Node*, GPRReg cellGPR, GPRReg tempGPR);
2565 void compileCheckStructure(Node*);
2566 void compilePutAccessorById(Node*);
2567 void compilePutGetterSetterById(Node*);
2568 void compilePutAccessorByVal(Node*);
2569 void compileGetRegExpObjectLastIndex(Node*);
2570 void compileSetRegExpObjectLastIndex(Node*);
2571 void compileLazyJSConstant(Node*);
2572 void compileMaterializeNewObject(Node*);
2573 void compileRecordRegExpCachedResult(Node*);
2574 void compileCallObjectConstructor(Node*);
2575 void compileResolveScope(Node*);
2576 void compileGetDynamicVar(Node*);
2577 void compilePutDynamicVar(Node*);
2578 void compileCompareEqPtr(Node*);
2580 void moveTrueTo(GPRReg);
2581 void moveFalseTo(GPRReg);
2582 void blessBoolean(GPRReg);
2584 // size can be an immediate or a register, and must be in bytes. If size is a register,
2585 // it must be a different register than resultGPR. Emits code that place a pointer to
2586 // the end of the allocation. The returned jump is the jump to the slow path.
2587 template<typename SizeType>
2588 MacroAssembler::Jump emitAllocateBasicStorage(SizeType size, GPRReg resultGPR)
2590 CopiedAllocator* copiedAllocator = &m_jit.vm()->heap.storageAllocator();
2592 // It's invalid to allocate zero bytes in CopiedSpace.
2594 m_jit.move(size, resultGPR);
2595 MacroAssembler::Jump nonZeroSize = m_jit.branchTest32(MacroAssembler::NonZero, resultGPR);
2596 m_jit.abortWithReason(DFGBasicStorageAllocatorZeroSize);
2597 nonZeroSize.link(&m_jit);
2600 m_jit.loadPtr(&copiedAllocator->m_currentRemaining, resultGPR);
2601 MacroAssembler::Jump slowPath = m_jit.branchSubPtr(JITCompiler::Signed, size, resultGPR);
2602 m_jit.storePtr(resultGPR, &copiedAllocator->m_currentRemaining);
2603 m_jit.negPtr(resultGPR);
2604 m_jit.addPtr(JITCompiler::AbsoluteAddress(&copiedAllocator->m_currentPayloadEnd), resultGPR);
2609 // Allocator for a cell of a specific size.
2610 template <typename StructureType> // StructureType can be GPR or ImmPtr.
2611 void emitAllocateJSCell(GPRReg resultGPR, GPRReg allocatorGPR, StructureType structure,
2612 GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
2614 if (Options::forceGCSlowPaths())
2615 slowPath.append(m_jit.jump());
2617 m_jit.loadPtr(MacroAssembler::Address(allocatorGPR, MarkedAllocator::offsetOfFreeListHead()), resultGPR);
2618 slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, resultGPR));
2621 // The object is half-allocated: we have what we know is a fresh object, but
2622 // it's still on the GC's free list.
2623 m_jit.loadPtr(MacroAssembler::Address(resultGPR), scratchGPR);
2624 m_jit.storePtr(scratchGPR, MacroAssembler::Address(allocatorGPR, MarkedAllocator::offsetOfFreeListHead()));
2626 // Initialize the object's Structure.
2627 m_jit.emitStoreStructureWithTypeInfo(structure, resultGPR, scratchGPR);
2630 // Allocator for an object of a specific size.
2631 template <typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2632 void emitAllocateJSObject(GPRReg resultGPR, GPRReg allocatorGPR, StructureType structure,
2633 StorageType storage, GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
2635 emitAllocateJSCell(resultGPR, allocatorGPR, structure, scratchGPR, slowPath);
2637 // Initialize the object's property storage pointer.
2638 m_jit.storePtr(storage, MacroAssembler::Address(resultGPR, JSObject::butterflyOffset()));
2641 template <typename ClassType, typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2642 void emitAllocateJSObjectWithKnownSize(
2643 GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1,
2644 GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath, size_t size)
2646 MarkedAllocator* allocator = &m_jit.vm()->heap.allocatorForObjectOfType<ClassType>(size);
2647 m_jit.move(TrustedImmPtr(allocator), scratchGPR1);
2648 emitAllocateJSObject(resultGPR, scratchGPR1, structure, storage, scratchGPR2, slowPath);
2651 // Convenience allocator for a built-in object.
2652 template <typename ClassType, typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2653 void emitAllocateJSObject(GPRReg resultGPR, StructureType structure, StorageType storage,
2654 GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2656 emitAllocateJSObjectWithKnownSize<ClassType>(
2657 resultGPR, structure, storage, scratchGPR1, scratchGPR2, slowPath,
2658 ClassType::allocationSize(0));
2661 template <typename ClassType, typename StructureType> // StructureType and StorageType can be GPR or ImmPtr.
2662 void emitAllocateVariableSizedJSObject(GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2664 static_assert(!(MarkedSpace::preciseStep & (MarkedSpace::preciseStep - 1)), "MarkedSpace::preciseStep must be a power of two.");
2665 static_assert(!(MarkedSpace::impreciseStep & (MarkedSpace::impreciseStep - 1)), "MarkedSpace::impreciseStep must be a power of two.");
2667 MarkedSpace::Subspace& subspace = m_jit.vm()->heap.subspaceForObjectOfType<ClassType>();
2668 m_jit.add32(TrustedImm32(MarkedSpace::preciseStep - 1), allocationSize);
2669 MacroAssembler::Jump notSmall = m_jit.branch32(MacroAssembler::AboveOrEqual, allocationSize, TrustedImm32(MarkedSpace::preciseCutoff));
2670 m_jit.rshift32(allocationSize, TrustedImm32(getLSBSet(MarkedSpace::preciseStep)), scratchGPR1);
2671 m_jit.mul32(TrustedImm32(sizeof(MarkedAllocator)), scratchGPR1, scratchGPR1);
2672 m_jit.addPtr(MacroAssembler::TrustedImmPtr(&subspace.preciseAllocators[0]), scratchGPR1);
2674 MacroAssembler::Jump selectedSmallSpace = m_jit.jump();
2675 notSmall.link(&m_jit);
2676 slowPath.append(m_jit.branch32(MacroAssembler::AboveOrEqual, allocationSize, TrustedImm32(MarkedSpace::impreciseCutoff)));
2677 m_jit.rshift32(allocationSize, TrustedImm32(getLSBSet(MarkedSpace::impreciseStep)), scratchGPR1);
2678 m_jit.mul32(TrustedImm32(sizeof(MarkedAllocator)), scratchGPR1, scratchGPR1);
2679 m_jit.addPtr(MacroAssembler::TrustedImmPtr(&subspace.impreciseAllocators[0]), scratchGPR1);
2681 selectedSmallSpace.link(&m_jit);
2683 emitAllocateJSObject(resultGPR, scratchGPR1, structure, TrustedImmPtr(0), scratchGPR2, slowPath);
2686 template <typename T>
2687 void emitAllocateDestructibleObject(GPRReg resultGPR, Structure* structure,
2688 GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2690 emitAllocateJSObject<T>(resultGPR, TrustedImmPtr(structure), TrustedImmPtr(0), scratchGPR1, scratchGPR2, slowPath);
2691 m_jit.storePtr(TrustedImmPtr(structure->classInfo()), MacroAssembler::Address(resultGPR, JSDestructibleObject::classInfoOffset()));
2694 void emitAllocateRawObject(GPRReg resultGPR, Structure*, GPRReg storageGPR, unsigned numElements, unsigned vectorLength);
2696 void emitGetLength(InlineCallFrame*, GPRReg lengthGPR, bool includeThis = false);
2697 void emitGetLength(CodeOrigin, GPRReg lengthGPR, bool includeThis = false);
2698 void emitGetCallee(CodeOrigin, GPRReg calleeGPR);
2699 void emitGetArgumentStart(CodeOrigin, GPRReg startGPR);
2701 // Generate an OSR exit fuzz check. Returns Jump() if OSR exit fuzz is not enabled, or if
2702 // it's in training mode.
2703 MacroAssembler::Jump emitOSRExitFuzzCheck();
2705 // Add a speculation check.
2706 void speculationCheck(ExitKind, JSValueSource, Node*, MacroAssembler::Jump jumpToFail);
2707 void speculationCheck(ExitKind, JSValueSource, Node*, const MacroAssembler::JumpList& jumpsToFail);
2709 // Add a speculation check without additional recovery, and with a promise to supply a jump later.
2710 OSRExitJumpPlaceholder speculationCheck(ExitKind, JSValueSource, Node*);
2711 OSRExitJumpPlaceholder speculationCheck(ExitKind, JSValueSource, Edge);
2712 void speculationCheck(ExitKind, JSValueSource, Edge, MacroAssembler::Jump jumpToFail);
2713 void speculationCheck(ExitKind, JSValueSource, Edge, const MacroAssembler::JumpList& jumpsToFail);
2714 // Add a speculation check with additional recovery.
2715 void speculationCheck(ExitKind, JSValueSource, Node*, MacroAssembler::Jump jumpToFail, const SpeculationRecovery&);
2716 void speculationCheck(ExitKind, JSValueSource, Edge, MacroAssembler::Jump jumpToFail, const SpeculationRecovery&);
2718 void emitInvalidationPoint(Node*);
2720 void unreachable(Node*);
2722 // Called when we statically determine that a speculation will fail.
2723 void terminateSpeculativeExecution(ExitKind, JSValueRegs, Node*);
2724 void terminateSpeculativeExecution(ExitKind, JSValueRegs, Edge);
2726 // Helpers for performing type checks on an edge stored in the given registers.
2727 bool needsTypeCheck(Edge edge, SpeculatedType typesPassedThrough) { return m_interpreter.needsTypeCheck(edge, typesPassedThrough); }
2728 void typeCheck(JSValueSource, Edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail, ExitKind = BadType);
2730 void speculateCellTypeWithoutTypeFiltering(Edge, GPRReg cellGPR, JSType);
2731 void speculateCellType(Edge, GPRReg cellGPR, SpeculatedType, JSType);
2733 void speculateInt32(Edge);
2735 void convertAnyInt(Edge, GPRReg resultGPR);
2736 void speculateAnyInt(Edge);
2737 void speculateDoubleRepAnyInt(Edge);
2738 #endif // USE(JSVALUE64)
2739 void speculateNumber(Edge);
2740 void speculateRealNumber(Edge);
2741 void speculateDoubleRepReal(Edge);
2742 void speculateBoolean(Edge);
2743 void speculateCell(Edge);
2744 void speculateCellOrOther(Edge);
2745 void speculateObject(Edge);
2746 void speculateFunction(Edge);
2747 void speculateFinalObject(Edge);
2748 void speculateRegExpObject(Edge, GPRReg cell);
2749 void speculateRegExpObject(Edge);
2750 void speculateObjectOrOther(Edge);
2751 void speculateString(Edge edge, GPRReg cell);
2752 void speculateStringIdentAndLoadStorage(Edge edge, GPRReg string, GPRReg storage);
2753 void speculateStringIdent(Edge edge, GPRReg string);
2754 void speculateStringIdent(Edge);
2755 void speculateString(Edge);
2756 void speculateStringOrOther(Edge, JSValueRegs, GPRReg scratch);
2757 void speculateStringOrOther(Edge);
2758 void speculateNotStringVar(Edge);
2759 template<typename StructureLocationType>
2760 void speculateStringObjectForStructure(Edge, StructureLocationType);
2761 void speculateStringObject(Edge, GPRReg);
2762 void speculateStringObject(Edge);
2763 void speculateStringOrStringObject(Edge);
2764 void speculateSymbol(Edge, GPRReg cell);
2765 void speculateSymbol(Edge);
2766 void speculateNotCell(Edge);
2767 void speculateOther(Edge);
2768 void speculateMisc(Edge, JSValueRegs);
2769 void speculateMisc(Edge);
2770 void speculate(Node*, Edge);
2772 JITCompiler::Jump jumpSlowForUnwantedArrayMode(GPRReg tempWithIndexingTypeReg, ArrayMode, IndexingType);
2773 JITCompiler::JumpList jumpSlowForUnwantedArrayMode(GPRReg tempWithIndexingTypeReg, ArrayMode);
2774 void checkArray(Node*);
2775 void arrayify(Node*, GPRReg baseReg, GPRReg propertyReg);
2776 void arrayify(Node*);
2778 template<bool strict>
2779 GPRReg fillSpeculateInt32Internal(Edge, DataFormat& returnFormat);
2781 // It is possible, during speculative generation, to reach a situation in which we
2782 // can statically determine a speculation will fail (for example, when two nodes
2783 // will make conflicting speculations about the same operand). In such cases this
2784 // flag is cleared, indicating no further code generation should take place.
2787 void recordSetLocal(
2788 VirtualRegister bytecodeReg, VirtualRegister machineReg, DataFormat format)
2790 m_stream->appendAndLog(VariableEvent::setLocal(bytecodeReg, machineReg, format));
2793 void recordSetLocal(DataFormat format)
2795 VariableAccessData* variable = m_currentNode->variableAccessData();
2796 recordSetLocal(variable->local(), variable->machineLocal(), format);
2799 GenerationInfo& generationInfoFromVirtualRegister(VirtualRegister virtualRegister)
2801 return m_generationInfo[virtualRegister.toLocal()];
2804 GenerationInfo& generationInfo(Node* node)
2806 return generationInfoFromVirtualRegister(node->virtualRegister());
2809 GenerationInfo& generationInfo(Edge edge)
2811 return generationInfo(edge.node());
2814 // The JIT, while also provides MacroAssembler functionality.
2817 // The current node being generated.
2818 BasicBlock* m_block;
2819 Node* m_currentNode;
2820 NodeType m_lastGeneratedNode;
2821 unsigned m_indexInBlock;
2822 // Virtual and physical register maps.
2823 Vector<GenerationInfo, 32> m_generationInfo;
2824 RegisterBank<GPRInfo> m_gprs;
2825 RegisterBank<FPRInfo> m_fprs;
2827 Vector<MacroAssembler::Label> m_osrEntryHeads;
2829 struct BranchRecord {
2830 BranchRecord(MacroAssembler::Jump jump, BasicBlock* destination)
2832 , destination(destination)
2836 MacroAssembler::Jump jump;
2837 BasicBlock* destination;
2839 Vector<BranchRecord, 8> m_branches;
2841 NodeOrigin m_origin;
2843 InPlaceAbstractState m_state;
2844 AbstractInterpreter<InPlaceAbstractState> m_interpreter;
2846 VariableEventStream* m_stream;
2847 MinifiedGraph* m_minifiedGraph;
2849 Vector<std::unique_ptr<SlowPathGenerator>, 8> m_slowPathGenerators;
2850 struct SlowPathLambda {
2851 std::function<void()> generator;
2853 unsigned streamIndex;
2855 Vector<SlowPathLambda> m_slowPathLambdas;
2856 Vector<SilentRegisterSavePlan> m_plans;
2857 Optional<unsigned> m_outOfLineStreamIndex;
2861 // === Operand types ===
2863 // These classes are used to lock the operands to a node into machine
2864 // registers. These classes implement of pattern of locking a value
2865 // into register at the point of construction only if it is already in
2866 // registers, and otherwise loading it lazily at the point it is first
2867 // used. We do so in order to attempt to avoid spilling one operand
2868 // in order to make space available for another.
2870 class JSValueOperand {
2872 explicit JSValueOperand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
2876 , m_gprOrInvalid(InvalidGPRReg)
2877 #elif USE(JSVALUE32_64)
2884 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == UntypedUse);
2886 if (jit->isFilled(node()))
2888 #elif USE(JSVALUE32_64)
2889 m_register.pair.tagGPR = InvalidGPRReg;
2890 m_register.pair.payloadGPR = InvalidGPRReg;
2891 if (jit->isFilled(node()))
2896 explicit JSValueOperand(JSValueOperand&& other)
2897 : m_jit(other.m_jit)
2898 , m_edge(other.m_edge)
2901 m_gprOrInvalid = other.m_gprOrInvalid;
2902 #elif USE(JSVALUE32_64)
2903 m_register.pair.tagGPR = InvalidGPRReg;
2904 m_register.pair.payloadGPR = InvalidGPRReg;
2905 m_isDouble = other.m_isDouble;
2909 m_register.fpr = other.m_register.fpr;
2911 m_register.pair = other.m_register.pair;
2914 other.m_edge = Edge();
2916 other.m_gprOrInvalid = InvalidGPRReg;
2917 #elif USE(JSVALUE32_64)
2918 other.m_isDouble = false;
2927 ASSERT(m_gprOrInvalid != InvalidGPRReg);
2928 m_jit->unlock(m_gprOrInvalid);
2929 #elif USE(JSVALUE32_64)
2931 ASSERT(m_register.fpr != InvalidFPRReg);
2932 m_jit->unlock(m_register.fpr);
2934 ASSERT(m_register.pair.tagGPR != InvalidGPRReg && m_register.pair.payloadGPR != InvalidGPRReg);
2935 m_jit->unlock(m_register.pair.tagGPR);
2936 m_jit->unlock(m_register.pair.payloadGPR);
2948 return edge().node();
2954 if (m_gprOrInvalid == InvalidGPRReg)
2955 m_gprOrInvalid = m_jit->fillJSValue(m_edge);
2956 return m_gprOrInvalid;
2958 JSValueRegs jsValueRegs()
2960 return JSValueRegs(gpr());
2962 #elif USE(JSVALUE32_64)
2963 bool isDouble() { return m_isDouble; }
2967 if (m_register.pair.tagGPR == InvalidGPRReg && m_register.pair.payloadGPR == InvalidGPRReg)
2968 m_isDouble = !m_jit->fillJSValue(m_edge, m_register.pair.tagGPR, m_register.pair.payloadGPR, m_register.fpr);
2974 ASSERT(!m_isDouble);
2975 return m_register.pair.tagGPR;
2981 ASSERT(!m_isDouble);
2982 return m_register.pair.payloadGPR;
2985 JSValueRegs jsValueRegs()
2987 return JSValueRegs(tagGPR(), payloadGPR());
2990 GPRReg gpr(WhichValueWord which)
2992 return jsValueRegs().gpr(which);
2999 return m_register.fpr;
3009 SpeculativeJIT* m_jit;
3012 GPRReg m_gprOrInvalid;
3013 #elif USE(JSVALUE32_64)
3025 class StorageOperand {
3027 explicit StorageOperand(SpeculativeJIT* jit, Edge edge)
3030 , m_gprOrInvalid(InvalidGPRReg)
3033 ASSERT(edge.useKind() == UntypedUse || edge.useKind() == KnownCellUse);
3034 if (jit->isFilled(node()))
3040 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3041 m_jit->unlock(m_gprOrInvalid);
3051 return edge().node();
3056 if (m_gprOrInvalid == InvalidGPRReg)
3057 m_gprOrInvalid = m_jit->fillStorage(edge());
3058 return m_gprOrInvalid;
3067 SpeculativeJIT* m_jit;
3069 GPRReg m_gprOrInvalid;
3073 // === Temporaries ===
3075 // These classes are used to allocate temporary registers.
3076 // A mechanism is provided to attempt to reuse the registers
3077 // currently allocated to child nodes whose value is consumed
3078 // by, and not live after, this operation.
3080 enum ReuseTag { Reuse };
3082 class GPRTemporary {
3085 GPRTemporary(SpeculativeJIT*);
3086 GPRTemporary(SpeculativeJIT*, GPRReg specific);
3087 template<typename T>
3088 GPRTemporary(SpeculativeJIT* jit, ReuseTag, T& operand)
3090 , m_gpr(InvalidGPRReg)
3092 if (m_jit->canReuse(operand.node()))
3093 m_gpr = m_jit->reuse(operand.gpr());
3095 m_gpr = m_jit->allocate();
3097 template<typename T1, typename T2>
3098 GPRTemporary(SpeculativeJIT* jit, ReuseTag, T1& op1, T2& op2)
3100 , m_gpr(InvalidGPRReg)
3102 if (m_jit->canReuse(op1.node()))
3103 m_gpr = m_jit->reuse(op1.gpr());
3104 else if (m_jit->canReuse(op2.node()))
3105 m_gpr = m_jit->reuse(op2.gpr());
3106 else if (m_jit->canReuse(op1.node(), op2.node()) && op1.gpr() == op2.gpr())
3107 m_gpr = m_jit->reuse(op1.gpr());
3109 m_gpr = m_jit->allocate();
3111 #if USE(JSVALUE32_64)
3112 GPRTemporary(SpeculativeJIT*, ReuseTag, JSValueOperand&, WhichValueWord);
3115 GPRTemporary(GPRTemporary& other) = delete;
3117 GPRTemporary& operator=(GPRTemporary&& other)
3120 ASSERT(m_gpr == InvalidGPRReg);
3121 std::swap(m_jit, other.m_jit);
3122 std::swap(m_gpr, other.m_gpr);
3126 void adopt(GPRTemporary&);
3130 if (m_jit && m_gpr != InvalidGPRReg)
3131 m_jit->unlock(gpr());
3140 SpeculativeJIT* m_jit;
3144 class JSValueRegsTemporary {
3146 JSValueRegsTemporary();
3147 JSValueRegsTemporary(SpeculativeJIT*);
3148 template<typename T>
3149 JSValueRegsTemporary(SpeculativeJIT*, ReuseTag, T& operand, WhichValueWord resultRegWord = PayloadWord);
3150 JSValueRegsTemporary(SpeculativeJIT*, ReuseTag, JSValueOperand&);
3151 ~JSValueRegsTemporary();
3159 GPRTemporary m_payloadGPR;
3160 GPRTemporary m_tagGPR;
3164 class FPRTemporary {
3166 FPRTemporary(SpeculativeJIT*);
3167 FPRTemporary(SpeculativeJIT*, SpeculateDoubleOperand&);
3168 FPRTemporary(SpeculativeJIT*, SpeculateDoubleOperand&, SpeculateDoubleOperand&);
3169 #if USE(JSVALUE32_64)
3170 FPRTemporary(SpeculativeJIT*, JSValueOperand&);
3175 m_jit->unlock(fpr());
3180 ASSERT(m_fpr != InvalidFPRReg);
3185 FPRTemporary(SpeculativeJIT* jit, FPRReg lockedFPR)
3192 SpeculativeJIT* m_jit;
3199 // These classes lock the result of a call to a C++ helper function.
3201 class GPRFlushedCallResult : public GPRTemporary {
3203 GPRFlushedCallResult(SpeculativeJIT* jit)
3204 : GPRTemporary(jit, GPRInfo::returnValueGPR)
3209 #if USE(JSVALUE32_64)
3210 class GPRFlushedCallResult2 : public GPRTemporary {
3212 GPRFlushedCallResult2(SpeculativeJIT* jit)
3213 : GPRTemporary(jit, GPRInfo::returnValueGPR2)
3219 class FPRResult : public FPRTemporary {
3221 FPRResult(SpeculativeJIT* jit)
3222 : FPRTemporary(jit, lockedResult(jit))
3227 static FPRReg lockedResult(SpeculativeJIT* jit)
3229 jit->lock(FPRInfo::returnValueFPR);
3230 return FPRInfo::returnValueFPR;
3235 // === Speculative Operand types ===
3237 // SpeculateInt32Operand, SpeculateStrictInt32Operand and SpeculateCellOperand.
3239 // These are used to lock the operands to a node into machine registers within the
3240 // SpeculativeJIT. The classes operate like those above, however these will
3241 // perform a speculative check for a more restrictive type than we can statically
3242 // determine the operand to have. If the operand does not have the requested type,
3243 // a bail-out to the non-speculative path will be taken.
3245 class SpeculateInt32Operand {
3247 explicit SpeculateInt32Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3250 , m_gprOrInvalid(InvalidGPRReg)
3252 , m_format(DataFormatNone)
3256 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || (edge.useKind() == Int32Use || edge.useKind() == KnownInt32Use));
3257 if (jit->isFilled(node()))
3261 ~SpeculateInt32Operand()
3263 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3264 m_jit->unlock(m_gprOrInvalid);
3274 return edge().node();
3279 gpr(); // m_format is set when m_gpr is locked.
3280 ASSERT(m_format == DataFormatInt32 || m_format == DataFormatJSInt32);
3286 if (m_gprOrInvalid == InvalidGPRReg)
3287 m_gprOrInvalid = m_jit->fillSpeculateInt32(edge(), m_format);
3288 return m_gprOrInvalid;
3297 SpeculativeJIT* m_jit;
3299 GPRReg m_gprOrInvalid;
3300 DataFormat m_format;
3303 class SpeculateStrictInt32Operand {
3305 explicit SpeculateStrictInt32Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3308 , m_gprOrInvalid(InvalidGPRReg)
3311 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || (edge.useKind() == Int32Use || edge.useKind() == KnownInt32Use));
3312 if (jit->isFilled(node()))
3316 ~SpeculateStrictInt32Operand()
3318 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3319 m_jit->unlock(m_gprOrInvalid);
3329 return edge().node();
3334 if (m_gprOrInvalid == InvalidGPRReg)
3335 m_gprOrInvalid = m_jit->fillSpeculateInt32Strict(edge());
3336 return m_gprOrInvalid;
3345 SpeculativeJIT* m_jit;
3347 GPRReg m_gprOrInvalid;
3350 // Gives you a canonical Int52 (i.e. it's left-shifted by 16, low bits zero).
3351 class SpeculateInt52Operand {
3353 explicit SpeculateInt52Operand(SpeculativeJIT* jit, Edge edge)
3356 , m_gprOrInvalid(InvalidGPRReg)
3358 RELEASE_ASSERT(edge.useKind() == Int52RepUse);
3359 if (jit->isFilled(node()))
3363 ~SpeculateInt52Operand()
3365 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3366 m_jit->unlock(m_gprOrInvalid);
3376 return edge().node();
3381 if (m_gprOrInvalid == InvalidGPRReg)
3382 m_gprOrInvalid = m_jit->fillSpeculateInt52(edge(), DataFormatInt52);
3383 return m_gprOrInvalid;
3392 SpeculativeJIT* m_jit;
3394 GPRReg m_gprOrInvalid;
3397 // Gives you a strict Int52 (i.e. the payload is in the low 48 bits, high 16 bits are sign-extended).
3398 class SpeculateStrictInt52Operand {
3400 explicit SpeculateStrictInt52Operand(SpeculativeJIT* jit, Edge edge)
3403 , m_gprOrInvalid(InvalidGPRReg)
3405 RELEASE_ASSERT(edge.useKind() == Int52RepUse);
3406 if (jit->isFilled(node()))
3410 ~SpeculateStrictInt52Operand()
3412 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3413 m_jit->unlock(m_gprOrInvalid);
3423 return edge().node();
3428 if (m_gprOrInvalid == InvalidGPRReg)
3429 m_gprOrInvalid = m_jit->fillSpeculateInt52(edge(), DataFormatStrictInt52);
3430 return m_gprOrInvalid;
3439 SpeculativeJIT* m_jit;
3441 GPRReg m_gprOrInvalid;
3444 enum OppositeShiftTag { OppositeShift };
3446 class SpeculateWhicheverInt52Operand {
3448 explicit SpeculateWhicheverInt52Operand(SpeculativeJIT* jit, Edge edge)
3451 , m_gprOrInvalid(InvalidGPRReg)
3452 , m_strict(jit->betterUseStrictInt52(edge))
3454 RELEASE_ASSERT(edge.useKind() == Int52RepUse);
3455 if (jit->isFilled(node()))
3459 explicit SpeculateWhicheverInt52Operand(SpeculativeJIT* jit, Edge edge, const SpeculateWhicheverInt52Operand& other)
3462 , m_gprOrInvalid(InvalidGPRReg)
3463 , m_strict(other.m_strict)
3465 RELEASE_ASSERT(edge.useKind() == Int52RepUse);
3466 if (jit->isFilled(node()))
3470 explicit SpeculateWhicheverInt52Operand(SpeculativeJIT* jit, Edge edge, OppositeShiftTag, const SpeculateWhicheverInt52Operand& other)
3473 , m_gprOrInvalid(InvalidGPRReg)
3474 , m_strict(!other.m_strict)
3476 RELEASE_ASSERT(edge.useKind() == Int52RepUse);
3477 if (jit->isFilled(node()))
3481 ~SpeculateWhicheverInt52Operand()
3483 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3484 m_jit->unlock(m_gprOrInvalid);
3494 return edge().node();
3499 if (m_gprOrInvalid == InvalidGPRReg) {
3500 m_gprOrInvalid = m_jit->fillSpeculateInt52(
3501 edge(), m_strict ? DataFormatStrictInt52 : DataFormatInt52);
3503 return m_gprOrInvalid;
3511 DataFormat format() const
3513 return m_strict ? DataFormatStrictInt52 : DataFormatInt52;
3517 SpeculativeJIT* m_jit;
3519 GPRReg m_gprOrInvalid;
3523 class SpeculateDoubleOperand {
3525 explicit SpeculateDoubleOperand(SpeculativeJIT* jit, Edge edge)
3528 , m_fprOrInvalid(InvalidFPRReg)
3531 RELEASE_ASSERT(isDouble(edge.useKind()));
3532 if (jit->isFilled(node()))
3536 ~SpeculateDoubleOperand()
3538 ASSERT(m_fprOrInvalid != InvalidFPRReg);
3539 m_jit->unlock(m_fprOrInvalid);
3549 return edge().node();
3554 if (m_fprOrInvalid == InvalidFPRReg)
3555 m_fprOrInvalid = m_jit->fillSpeculateDouble(edge());
3556 return m_fprOrInvalid;
3565 SpeculativeJIT* m_jit;
3567 FPRReg m_fprOrInvalid;
3570 class SpeculateCellOperand {
3572 explicit SpeculateCellOperand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3575 , m_gprOrInvalid(InvalidGPRReg)
3580 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || isCell(edge.useKind()));
3581 if (jit->isFilled(node()))
3585 ~SpeculateCellOperand()
3589 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3590 m_jit->unlock(m_gprOrInvalid);
3600 return edge().node();
3606 if (m_gprOrInvalid == InvalidGPRReg)
3607 m_gprOrInvalid = m_jit->fillSpeculateCell(edge());
3608 return m_gprOrInvalid;
3618 SpeculativeJIT* m_jit;
3620 GPRReg m_gprOrInvalid;
3623 class SpeculateBooleanOperand {
3625 explicit SpeculateBooleanOperand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3628 , m_gprOrInvalid(InvalidGPRReg)
3631 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == BooleanUse || edge.useKind() == KnownBooleanUse);
3632 if (jit->isFilled(node()))
3636 ~SpeculateBooleanOperand()
3638 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3639 m_jit->unlock(m_gprOrInvalid);
3649 return edge().node();
3654 if (m_gprOrInvalid == InvalidGPRReg)
3655 m_gprOrInvalid = m_jit->fillSpeculateBoolean(edge());
3656 return m_gprOrInvalid;
3665 SpeculativeJIT* m_jit;
3667 GPRReg m_gprOrInvalid;
3670 template<typename StructureLocationType>
3671 void SpeculativeJIT::speculateStringObjectForStructure(Edge edge, StructureLocationType structureLocation)
3673 Structure* stringObjectStructure =
3674 m_jit.globalObjectFor(m_currentNode->origin.semantic)->stringObjectStructure();
3676 if (!m_state.forNode(edge).m_structure.isSubsetOf(StructureSet(stringObjectStructure))) {
3678 NotStringObject, JSValueRegs(), 0,
3679 m_jit.branchStructure(
3680 JITCompiler::NotEqual, structureLocation, stringObjectStructure));
3684 #define DFG_TYPE_CHECK_WITH_EXIT_KIND(exitKind, source, edge, typesPassedThrough, jumpToFail) do { \
3685 JSValueSource _dtc_source = (source); \
3686 Edge _dtc_edge = (edge); \
3687 SpeculatedType _dtc_typesPassedThrough = typesPassedThrough; \
3688 if (!needsTypeCheck(_dtc_edge, _dtc_typesPassedThrough)) \
3690 typeCheck(_dtc_source, _dtc_edge, _dtc_typesPassedThrough, (jumpToFail), exitKind); \
3693 #define DFG_TYPE_CHECK(source, edge, typesPassedThrough, jumpToFail) \
3694 DFG_TYPE_CHECK_WITH_EXIT_KIND(BadType, source, edge, typesPassedThrough, jumpToFail)
3696 } } // namespace JSC::DFG