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, TrustedImmPtr ptr)
1293 m_jit.setupArgumentsWithExecState(arg1.gpr(), arg2.gpr(), ptr);
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, TrustedImmPtr ptr)
1716 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), ptr);
1717 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1720 JITCompiler::Call callOperation(J_JITOperation_EJJI operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, UniquedStringImpl* uid)
1722 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), TrustedImmPtr(uid));
1723 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1725 JITCompiler::Call callOperation(V_JITOperation_EJJJI operation, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3, UniquedStringImpl* uid)
1727 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR(), TrustedImmPtr(uid));
1728 return appendCall(operation);
1730 JITCompiler::Call callOperation(V_JITOperation_EJJJJ operation, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3, JSValueRegs arg4)
1732 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR(), arg4.payloadGPR(), arg4.tagGPR());
1733 return appendCall(operation);
1736 JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, JSValueRegs arg2, UniquedStringImpl* impl, unsigned value)
1738 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), TrustedImmPtr(impl), TrustedImm32(value));
1739 return appendCall(operation);
1741 JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, JSValueRegs result, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
1743 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
1744 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
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, JSValueRegs result)
1761 m_jit.setupArgumentsExecState();
1762 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1764 JITCompiler::Call callOperation(J_JITOperation_EP operation, JSValueRegs result, void* pointer)
1766 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer));
1767 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1769 JITCompiler::Call callOperation(J_JITOperation_EPP operation, JSValueRegs result, GPRReg arg1, void* pointer)
1771 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(pointer));
1772 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1774 JITCompiler::Call callOperation(J_JITOperation_EP operation, JSValueRegs result, GPRReg arg1)
1776 m_jit.setupArgumentsWithExecState(arg1);
1777 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1779 JITCompiler::Call callOperation(J_JITOperation_EI operation, JSValueRegs result, UniquedStringImpl* uid)
1781 m_jit.setupArgumentsWithExecState(TrustedImmPtr(uid));
1782 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1784 JITCompiler::Call callOperation(J_JITOperation_EA operation, JSValueRegs result, GPRReg arg1)
1786 m_jit.setupArgumentsWithExecState(arg1);
1787 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1789 JITCompiler::Call callOperation(J_JITOperation_EAZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
1791 m_jit.setupArgumentsWithExecState(arg1, arg2);
1792 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1794 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, GPRReg arg1)
1796 m_jit.setupArgumentsWithExecState(arg1);
1797 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1799 JITCompiler::Call callOperation(J_JITOperation_EJC operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
1801 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
1802 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1804 JITCompiler::Call callOperation(J_JITOperation_EJssZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
1806 m_jit.setupArgumentsWithExecState(arg1, arg2);
1807 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1809 JITCompiler::Call callOperation(J_JITOperation_EJssReo operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
1811 m_jit.setupArgumentsWithExecState(arg1, arg2);
1812 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1814 JITCompiler::Call callOperation(J_JITOperation_EJssReoJss operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1816 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1817 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1819 JITCompiler::Call callOperation(J_JITOperation_EPS operation, JSValueRegs result, void* pointer, size_t size)
1821 m_jit.setupArgumentsWithExecState(TrustedImmPtr(pointer), TrustedImmPtr(size));
1822 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1824 JITCompiler::Call callOperation(J_JITOperation_ESS operation, JSValueRegs result, int startConstant, int numConstants)
1826 m_jit.setupArgumentsWithExecState(TrustedImm32(startConstant), TrustedImm32(numConstants));
1827 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1829 JITCompiler::Call callOperation(J_JITOperation_EJP operation, JSValueRegs result, JSValueRegs arg1, void* pointer)
1831 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImmPtr(pointer));
1832 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1834 JITCompiler::Call callOperation(J_JITOperation_EJP operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
1836 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
1837 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1840 JITCompiler::Call callOperation(J_JITOperation_EC operation, JSValueRegs result, JSCell* cell)
1842 m_jit.setupArgumentsWithExecState(TrustedImmPtr(cell));
1843 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1845 JITCompiler::Call callOperation(J_JITOperation_ECZ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
1847 m_jit.setupArgumentsWithExecState(arg1, arg2);
1848 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1850 JITCompiler::Call callOperation(J_JITOperation_EJscC operation, JSValueRegs result, GPRReg arg1, JSCell* cell)
1852 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
1853 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1855 JITCompiler::Call callOperation(J_JITOperation_EJscCJ operation, GPRReg result, GPRReg arg1, JSCell* cell, JSValueRegs arg2)
1857 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell), EABI_32BIT_DUMMY_ARG arg2.payloadGPR(), arg2.tagGPR());
1858 return appendCallSetResult(operation, result);
1860 JITCompiler::Call callOperation(J_JITOperation_EGReoJ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
1862 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
1863 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1865 JITCompiler::Call callOperation(J_JITOperation_EGReoJss operation, JSValueRegs result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
1867 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
1868 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1870 JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, JSValueRegs result, StructureStubInfo* stubInfo, GPRReg arg1, const UniquedStringImpl* uid)
1872 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
1873 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1875 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, JSValueRegs result, StructureStubInfo* stubInfo, JSValueRegs arg1, UniquedStringImpl* uid)
1877 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1.payloadGPR(), arg1.tagGPR(), TrustedImmPtr(uid));
1878 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1880 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, JSValueRegs result, StructureStubInfo* stubInfo, int32_t arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
1882 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, TrustedImm32(arg1Tag), TrustedImmPtr(uid));
1883 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1885 JITCompiler::Call callOperation(J_JITOperation_ESsiJI operation, JSValueRegs result, StructureStubInfo* stubInfo, GPRReg arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid)
1887 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, arg1Tag, TrustedImmPtr(uid));
1888 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1890 JITCompiler::Call callOperation(J_JITOperation_EDA operation, JSValueRegs result, FPRReg arg1, GPRReg arg2)
1892 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1, arg2);
1893 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1895 JITCompiler::Call callOperation(J_JITOperation_EJA operation, JSValueRegs result, JSValueRegs arg1, GPRReg arg2)
1897 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2);
1898 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1900 JITCompiler::Call callOperation(J_JITOperation_EJA operation, JSValueRegs result, TrustedImm32 arg1Tag, GPRReg arg1Payload, GPRReg arg2)
1902 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
1903 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1905 JITCompiler::Call callOperation(J_JITOperation_EJA operation, JSValueRegs result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
1907 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2);
1908 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1910 JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
1912 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
1913 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1915 JITCompiler::Call callOperation(J_JITOperation_EZ operation, JSValueRegs result, GPRReg arg1)
1917 m_jit.setupArgumentsWithExecState(arg1);
1918 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1920 JITCompiler::Call callOperation(J_JITOperation_EZ operation, JSValueRegs result, int32_t arg1)
1922 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1));
1923 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1925 JITCompiler::Call callOperation(J_JITOperation_EZIcfZ operation, JSValueRegs result, int32_t arg1, InlineCallFrame* inlineCallFrame, GPRReg arg2)
1927 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), TrustedImmPtr(inlineCallFrame), arg2);
1928 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1930 JITCompiler::Call callOperation(J_JITOperation_EZZ operation, JSValueRegs result, int32_t arg1, GPRReg arg2)
1932 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2);
1933 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
1936 JITCompiler::Call callOperation(P_JITOperation_EJS operation, GPRReg result, JSValueRegs value, size_t index)
1938 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG value.payloadGPR(), value.tagGPR(), TrustedImmPtr(index));
1939 return appendCallSetResult(operation, result);
1942 JITCompiler::Call callOperation(P_JITOperation_EStJ operation, GPRReg result, Structure* structure, JSValueRegs arg2)
1944 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure), arg2.payloadGPR(), arg2.tagGPR());
1945 return appendCallSetResult(operation, result);
1948 JITCompiler::Call callOperation(C_JITOperation_EGJ operation, GPRReg result, JSGlobalObject* globalObject, JSValueRegs arg1)
1950 m_jit.setupArgumentsWithExecState(TrustedImmPtr(globalObject), arg1.payloadGPR(), arg1.tagGPR());
1951 return appendCallSetResult(operation, result);
1954 JITCompiler::Call callOperation(C_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1956 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
1957 return appendCallSetResult(operation, result);
1960 JITCompiler::Call callOperation(C_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
1962 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR());
1963 return appendCallSetResult(operation, result);
1966 JITCompiler::Call callOperation(C_JITOperation_EJJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3)
1968 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
1969 return appendCallSetResult(operation, result);
1972 JITCompiler::Call callOperation(S_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1)
1974 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
1975 return appendCallSetResult(operation, result);
1978 JITCompiler::Call callOperation(S_JITOperation_EJI operation, GPRReg result, JSValueRegs arg1, UniquedStringImpl* uid)
1980 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImmPtr(uid));
1981 return appendCallSetResult(operation, result);
1984 JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
1986 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), SH4_32BIT_DUMMY_ARG arg2.payloadGPR(), arg2.tagGPR());
1987 return appendCallSetResult(operation, result);
1990 JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3)
1992 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), SH4_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
1993 return appendCallSetResult(operation, result);
1995 JITCompiler::Call callOperation(S_JITOperation_EGReoJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
1997 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
1998 return appendCallSetResult(operation, result);
2000 JITCompiler::Call callOperation(S_JITOperation_EGReoJss operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
2002 m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
2003 return appendCallSetResult(operation, result);
2005 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2)
2007 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), SH4_32BIT_DUMMY_ARG arg2.payloadGPR(), arg2.tagGPR());
2008 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2010 JITCompiler::Call callOperation(J_JITOperation_EGJJ operation, JSValueRegs result, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3)
2012 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), SH4_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2013 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2015 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, JSValueRegs arg1, MacroAssembler::TrustedImm32 imm)
2017 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), SH4_32BIT_DUMMY_ARG imm, TrustedImm32(JSValue::Int32Tag));
2018 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2020 JITCompiler::Call callOperation(J_JITOperation_EJJ operation, JSValueRegs result, MacroAssembler::TrustedImm32 imm, JSValueRegs arg2)
2022 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG imm, TrustedImm32(JSValue::Int32Tag), SH4_32BIT_DUMMY_ARG arg2.payloadGPR(), arg2.tagGPR());
2023 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2025 JITCompiler::Call callOperation(J_JITOperation_EJJJ operation, JSValueRegs result, JSValueRegs arg1, JSValueRegs arg2, JSValueRegs arg3)
2027 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2028 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2031 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, JSValueRegs result, GPRReg arg1, JSValueRegs arg2)
2033 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
2034 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2036 JITCompiler::Call callOperation(J_JITOperation_ECJ operation, JSValueRegs result, GPRReg arg1, GPRReg arg2Payload)
2038 m_jit.setupArgumentsWithExecState(arg1, arg2Payload, MacroAssembler::TrustedImm32(JSValue::CellTag));
2039 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2041 JITCompiler::Call callOperation(J_JITOperation_ECC operation, JSValueRegs result, GPRReg arg1, GPRReg arg2)
2043 m_jit.setupArgumentsWithExecState(arg1, arg2);
2044 return appendCallSetResult(operation, result.payloadGPR(), result.tagGPR());
2047 JITCompiler::Call callOperation(V_JITOperation_EOZD operation, GPRReg arg1, GPRReg arg2, FPRReg arg3)
2049 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3);
2050 return appendCall(operation);
2053 JITCompiler::Call callOperation(V_JITOperation_EJ operation, JSValueRegs arg1)
2055 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR());
2056 return appendCall(operation);
2059 JITCompiler::Call callOperation(V_JITOperation_EJPP operation, JSValueRegs arg1, GPRReg arg2, void* pointer)
2061 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2, TrustedImmPtr(pointer));
2062 return appendCall(operation);
2064 JITCompiler::Call callOperation(V_JITOperation_ESsiJJI operation, StructureStubInfo* stubInfo, JSValueRegs arg1, GPRReg arg2Payload, UniquedStringImpl* uid)
2066 m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1.payloadGPR(), arg1.tagGPR(), arg2Payload, TrustedImm32(JSValue::CellTag), TrustedImmPtr(uid));
2067 return appendCall(operation);
2069 JITCompiler::Call callOperation(V_JITOperation_ECJ operation, GPRReg arg1, JSValueRegs arg2)
2071 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR());
2072 return appendCall(operation);
2074 JITCompiler::Call callOperation(V_JITOperation_ECJJ operation, GPRReg arg1, JSValueRegs arg2, JSValueRegs arg3)
2076 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), arg3.payloadGPR(), arg3.tagGPR());
2077 return appendCall(operation);
2080 JITCompiler::Call callOperation(V_JITOperation_EPZJ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
2082 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2083 return appendCall(operation);
2086 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, JSValueRegs arg3)
2088 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2089 return appendCall(operation);
2091 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, TrustedImm32 arg3Tag, GPRReg arg3Payload)
2093 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2094 return appendCall(operation);
2096 JITCompiler::Call callOperation(V_JITOperation_EOZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload)
2098 m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
2099 return appendCall(operation);
2102 JITCompiler::Call callOperation(Z_JITOperation_EJOJ operation, GPRReg result, JSValueRegs arg1, GPRReg arg2, JSValueRegs arg3)
2104 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), arg2, EABI_32BIT_DUMMY_ARG arg3.payloadGPR(), arg3.tagGPR());
2105 return appendCallSetResult(operation, result);
2108 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, JSValueRegs arg1, unsigned arg2, unsigned arg3)
2110 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImm32(arg2), TrustedImm32(arg3));
2111 return appendCallSetResult(operation, result);
2113 JITCompiler::Call callOperation(F_JITOperation_EFJZZ operation, GPRReg result, GPRReg arg1, JSValueRegs arg2, unsigned arg3, GPRReg arg4)
2115 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), TrustedImm32(arg3), arg4);
2116 return appendCallSetResult(operation, result);
2118 JITCompiler::Call callOperation(Z_JITOperation_EJZ operation, GPRReg result, JSValueRegs arg1, unsigned arg2)
2120 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR(), TrustedImm32(arg2));
2121 return appendCallSetResult(operation, result);
2123 JITCompiler::Call callOperation(V_JITOperation_EZJZZZ operation, unsigned arg1, JSValueRegs arg2, unsigned arg3, GPRReg arg4, unsigned arg5)
2125 m_jit.setupArgumentsWithExecState(TrustedImm32(arg1), arg2.payloadGPR(), arg2.tagGPR(), TrustedImm32(arg3), arg4, TrustedImm32(arg5));
2126 return appendCall(operation);
2128 JITCompiler::Call callOperation(V_JITOperation_ECJZC operation, GPRReg arg1, JSValueRegs arg2, int32_t arg3, GPRReg arg4)
2130 m_jit.setupArgumentsWithExecState(arg1, arg2.payloadGPR(), arg2.tagGPR(), TrustedImm32(arg3), arg4);
2131 return appendCall(operation);
2133 JITCompiler::Call callOperation(V_JITOperation_ECIZCC operation, GPRReg arg1, UniquedStringImpl* identOp2, int32_t op3, GPRReg arg4, GPRReg arg5)
2135 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(identOp2), TrustedImm32(op3), arg4, arg5);
2136 return appendCall(operation);
2138 #endif // USE(JSVALUE32_64)
2140 #if !defined(NDEBUG) && !CPU(ARM) && !CPU(MIPS) && !CPU(SH4)
2141 void prepareForExternalCall()
2143 // We're about to call out to a "native" helper function. The helper
2144 // function is expected to set topCallFrame itself with the ExecState
2145 // that is passed to it.
2147 // We explicitly trash topCallFrame here so that we'll know if some of
2148 // the helper functions are not setting topCallFrame when they should
2149 // be doing so. Note: the previous value in topcallFrame was not valid
2150 // anyway since it was not being updated by JIT'ed code by design.
2152 for (unsigned i = 0; i < sizeof(void*) / 4; i++)
2153 m_jit.store32(TrustedImm32(0xbadbeef), reinterpret_cast<char*>(&m_jit.vm()->topCallFrame) + i * 4);
2156 void prepareForExternalCall() { }
2159 // These methods add call instructions, optionally setting results, and optionally rolling back the call frame on an exception.
2160 JITCompiler::Call appendCall(const FunctionPtr& function)
2162 prepareForExternalCall();
2163 m_jit.emitStoreCodeOrigin(m_currentNode->origin.semantic);
2164 return m_jit.appendCall(function);
2166 JITCompiler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr& function)
2168 JITCompiler::Call call = appendCall(function);
2169 m_jit.exceptionCheckWithCallFrameRollback();
2172 JITCompiler::Call appendCallWithCallFrameRollbackOnExceptionSetResult(const FunctionPtr& function, GPRReg result)
2174 JITCompiler::Call call = appendCallWithCallFrameRollbackOnException(function);
2175 if ((result != InvalidGPRReg) && (result != GPRInfo::returnValueGPR))
2176 m_jit.move(GPRInfo::returnValueGPR, result);
2179 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result)
2181 JITCompiler::Call call = appendCall(function);
2182 if (result != InvalidGPRReg)
2183 m_jit.move(GPRInfo::returnValueGPR, result);
2186 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result1, GPRReg result2)
2188 JITCompiler::Call call = appendCall(function);
2189 m_jit.setupResults(result1, result2);
2193 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2195 JITCompiler::Call call = appendCall(function);
2196 if (result != InvalidFPRReg) {
2197 m_jit.assembler().fstpl(0, JITCompiler::stackPointerRegister);
2198 m_jit.loadDouble(JITCompiler::stackPointerRegister, result);
2202 #elif CPU(ARM) && !CPU(ARM_HARDFP)
2203 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2205 JITCompiler::Call call = appendCall(function);
2206 if (result != InvalidFPRReg)
2207 m_jit.assembler().vmov(result, GPRInfo::returnValueGPR, GPRInfo::returnValueGPR2);
2210 #else // CPU(X86_64) || (CPU(ARM) && CPU(ARM_HARDFP)) || CPU(ARM64) || CPU(MIPS) || CPU(SH4)
2211 JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
2213 JITCompiler::Call call = appendCall(function);
2214 if (result != InvalidFPRReg)
2215 m_jit.moveDouble(FPRInfo::returnValueFPR, result);
2220 void branchDouble(JITCompiler::DoubleCondition cond, FPRReg left, FPRReg right, BasicBlock* destination)
2222 return addBranch(m_jit.branchDouble(cond, left, right), destination);
2225 void branchDoubleNonZero(FPRReg value, FPRReg scratch, BasicBlock* destination)
2227 return addBranch(m_jit.branchDoubleNonZero(value, scratch), destination);
2230 template<typename T, typename U>
2231 void branch32(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2233 return addBranch(m_jit.branch32(cond, left, right), destination);
2236 template<typename T, typename U>
2237 void branchTest32(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2239 return addBranch(m_jit.branchTest32(cond, value, mask), destination);
2242 template<typename T>
2243 void branchTest32(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2245 return addBranch(m_jit.branchTest32(cond, value), destination);
2249 template<typename T, typename U>
2250 void branch64(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2252 return addBranch(m_jit.branch64(cond, left, right), destination);
2256 template<typename T, typename U>
2257 void branch8(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2259 return addBranch(m_jit.branch8(cond, left, right), destination);
2262 template<typename T, typename U>
2263 void branchPtr(JITCompiler::RelationalCondition cond, T left, U right, BasicBlock* destination)
2265 return addBranch(m_jit.branchPtr(cond, left, right), destination);
2268 template<typename T, typename U>
2269 void branchTestPtr(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2271 return addBranch(m_jit.branchTestPtr(cond, value, mask), destination);
2274 template<typename T>
2275 void branchTestPtr(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2277 return addBranch(m_jit.branchTestPtr(cond, value), destination);
2280 template<typename T, typename U>
2281 void branchTest8(JITCompiler::ResultCondition cond, T value, U mask, BasicBlock* destination)
2283 return addBranch(m_jit.branchTest8(cond, value, mask), destination);
2286 template<typename T>
2287 void branchTest8(JITCompiler::ResultCondition cond, T value, BasicBlock* destination)
2289 return addBranch(m_jit.branchTest8(cond, value), destination);
2292 enum FallThroughMode {
2296 void jump(BasicBlock* destination, FallThroughMode fallThroughMode = AtFallThroughPoint)
2298 if (destination == nextBlock()
2299 && fallThroughMode == AtFallThroughPoint)
2301 addBranch(m_jit.jump(), destination);
2304 void addBranch(const MacroAssembler::Jump& jump, BasicBlock* destination)
2306 m_branches.append(BranchRecord(jump, destination));
2308 void addBranch(const MacroAssembler::JumpList& jump, BasicBlock* destination);
2310 void linkBranches();
2312 void dump(const char* label = 0);
2314 bool betterUseStrictInt52(Node* node)
2316 return !generationInfo(node).isInt52();
2318 bool betterUseStrictInt52(Edge edge)
2320 return betterUseStrictInt52(edge.node());
2323 bool compare(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_JITOperation_EJJ);
2324 bool compilePeepHoleBranch(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_JITOperation_EJJ);
2325 void compilePeepHoleInt32Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2326 void compilePeepHoleInt52Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2327 void compilePeepHoleBooleanBranch(Node*, Node* branchNode, JITCompiler::RelationalCondition);
2328 void compilePeepHoleDoubleBranch(Node*, Node* branchNode, JITCompiler::DoubleCondition);
2329 void compilePeepHoleObjectEquality(Node*, Node* branchNode);
2330 void compilePeepHoleObjectStrictEquality(Edge objectChild, Edge otherChild, Node* branchNode);
2331 void compilePeepHoleObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild, Node* branchNode);
2332 void compileObjectEquality(Node*);
2333 void compileObjectStrictEquality(Edge objectChild, Edge otherChild);
2334 void compileObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild);
2335 void compileObjectOrOtherLogicalNot(Edge value);
2336 void compileLogicalNot(Node*);
2337 void compileLogicalNotStringOrOther(Node*);
2338 void compileStringEquality(
2339 Node*, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR,
2340 GPRReg leftTempGPR, GPRReg rightTempGPR, GPRReg leftTemp2GPR,
2341 GPRReg rightTemp2GPR, JITCompiler::JumpList fastTrue,
2342 JITCompiler::JumpList fastSlow);
2343 void compileStringEquality(Node*);
2344 void compileStringIdentEquality(Node*);
2345 void compileStringToUntypedEquality(Node*, Edge stringEdge, Edge untypedEdge);
2346 void compileStringIdentToNotStringVarEquality(Node*, Edge stringEdge, Edge notStringVarEdge);
2347 void compileStringZeroLength(Node*);
2348 void compileMiscStrictEq(Node*);
2350 template<typename Functor>
2351 void extractStringImplFromBinarySymbols(Edge leftSymbolEdge, Edge rightSymbolEdge, const Functor&);
2352 void compileSymbolEquality(Node*);
2353 void compilePeepHoleSymbolEquality(Node*, Node* branchNode);
2354 void compileSymbolUntypedEquality(Node*, Edge symbolEdge, Edge untypedEdge);
2356 void emitObjectOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2357 void emitStringBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2358 void emitStringOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken);
2359 void emitBranch(Node*);
2361 struct StringSwitchCase {
2362 StringSwitchCase() { }
2364 StringSwitchCase(StringImpl* string, BasicBlock* target)
2370 bool operator<(const StringSwitchCase& other) const
2372 return stringLessThan(*string, *other.string);
2379 void emitSwitchIntJump(SwitchData*, GPRReg value, GPRReg scratch);
2380 void emitSwitchImm(Node*, SwitchData*);
2381 void emitSwitchCharStringJump(SwitchData*, GPRReg value, GPRReg scratch);
2382 void emitSwitchChar(Node*, SwitchData*);
2383 void emitBinarySwitchStringRecurse(
2384 SwitchData*, const Vector<StringSwitchCase>&, unsigned numChecked,
2385 unsigned begin, unsigned end, GPRReg buffer, GPRReg length, GPRReg temp,
2386 unsigned alreadyCheckedLength, bool checkedExactLength);
2387 void emitSwitchStringOnString(SwitchData*, GPRReg string);
2388 void emitSwitchString(Node*, SwitchData*);
2389 void emitSwitch(Node*);
2391 void compileToStringOrCallStringConstructorOnCell(Node*);
2392 void compileNewStringObject(Node*);
2394 void compileNewTypedArray(Node*);
2396 void compileInt32Compare(Node*, MacroAssembler::RelationalCondition);
2397 void compileInt52Compare(Node*, MacroAssembler::RelationalCondition);
2398 void compileBooleanCompare(Node*, MacroAssembler::RelationalCondition);
2399 void compileDoubleCompare(Node*, MacroAssembler::DoubleCondition);
2400 void compileStringCompare(Node*, MacroAssembler::RelationalCondition);
2401 void compileStringIdentCompare(Node*, MacroAssembler::RelationalCondition);
2403 bool compileStrictEq(Node*);
2405 void compileAllocatePropertyStorage(Node*);
2406 void compileReallocatePropertyStorage(Node*);
2407 void compileGetButterfly(Node*);
2409 #if USE(JSVALUE32_64)
2410 template<typename BaseOperandType, typename PropertyOperandType, typename ValueOperandType, typename TagType>
2411 void compileContiguousPutByVal(Node*, BaseOperandType&, PropertyOperandType&, ValueOperandType&, GPRReg valuePayloadReg, TagType valueTag);
2413 void compileDoublePutByVal(Node*, SpeculateCellOperand& base, SpeculateStrictInt32Operand& property);
2414 bool putByValWillNeedExtraRegister(ArrayMode arrayMode)
2416 return arrayMode.mayStoreToHole();
2418 GPRReg temporaryRegisterForPutByVal(GPRTemporary&, ArrayMode);
2419 GPRReg temporaryRegisterForPutByVal(GPRTemporary& temporary, Node* node)
2421 return temporaryRegisterForPutByVal(temporary, node->arrayMode());
2424 void compileGetCharCodeAt(Node*);
2425 void compileGetByValOnString(Node*);
2426 void compileFromCharCode(Node*);
2428 void compileGetByValOnDirectArguments(Node*);
2429 void compileGetByValOnScopedArguments(Node*);
2431 void compileGetScope(Node*);
2432 void compileSkipScope(Node*);
2433 void compileGetGlobalObject(Node*);
2435 void compileGetArrayLength(Node*);
2437 void compileCheckTypeInfoFlags(Node*);
2438 void compileCheckIdent(Node*);
2440 void compileValueRep(Node*);
2441 void compileDoubleRep(Node*);
2443 void compileValueToInt32(Node*);
2444 void compileUInt32ToNumber(Node*);
2445 void compileDoubleAsInt32(Node*);
2447 template<typename SnippetGenerator, J_JITOperation_EJJ slowPathFunction>
2448 void emitUntypedBitOp(Node*);
2449 void compileBitwiseOp(Node*);
2451 void emitUntypedRightShiftBitOp(Node*);
2452 void compileShiftOp(Node*);
2454 void compileValueAdd(Node*);
2455 void compileArithAdd(Node*);
2456 void compileMakeRope(Node*);
2457 void compileArithClz32(Node*);
2458 void compileArithSub(Node*);
2459 void compileArithNegate(Node*);
2460 void compileArithMul(Node*);
2461 void compileArithDiv(Node*);
2462 void compileArithMod(Node*);
2463 void compileArithPow(Node*);
2464 void compileArithRounding(Node*);
2465 void compileArithRandom(Node*);
2466 void compileArithSqrt(Node*);
2467 void compileArithLog(Node*);
2468 void compileConstantStoragePointer(Node*);
2469 void compileGetIndexedPropertyStorage(Node*);
2470 JITCompiler::Jump jumpForTypedArrayOutOfBounds(Node*, GPRReg baseGPR, GPRReg indexGPR);
2471 JITCompiler::Jump jumpForTypedArrayIsNeuteredIfOutOfBounds(Node*, GPRReg baseGPR, JITCompiler::Jump outOfBounds);
2472 void emitTypedArrayBoundsCheck(Node*, GPRReg baseGPR, GPRReg indexGPR);
2473 void compileGetTypedArrayByteOffset(Node*);
2474 void compileGetByValOnIntTypedArray(Node*, TypedArrayType);
2475 void compilePutByValForIntTypedArray(GPRReg base, GPRReg property, Node*, TypedArrayType);
2476 void compileGetByValOnFloatTypedArray(Node*, TypedArrayType);
2477 void compilePutByValForFloatTypedArray(GPRReg base, GPRReg property, Node*, TypedArrayType);
2478 template <typename ClassType> void compileNewFunctionCommon(GPRReg, Structure*, GPRReg, GPRReg, GPRReg, MacroAssembler::JumpList&, size_t, FunctionExecutable*, ptrdiff_t, ptrdiff_t, ptrdiff_t);
2479 void compileNewFunction(Node*);
2480 void compileSetFunctionName(Node*);
2481 void compileForwardVarargs(Node*);
2482 void compileCreateActivation(Node*);
2483 void compileCreateDirectArguments(Node*);
2484 void compileGetFromArguments(Node*);
2485 void compilePutToArguments(Node*);
2486 void compileCreateScopedArguments(Node*);
2487 void compileCreateClonedArguments(Node*);
2488 void compileCopyRest(Node*);
2489 void compileGetRestLength(Node*);
2490 void compileNotifyWrite(Node*);
2491 bool compileRegExpExec(Node*);
2492 void compileIsObjectOrNull(Node*);
2493 void compileIsFunction(Node*);
2494 void compileTypeOf(Node*);
2495 void compileCheckStructure(Node*, GPRReg cellGPR, GPRReg tempGPR);
2496 void compileCheckStructure(Node*);
2497 void compilePutAccessorById(Node*);
2498 void compilePutGetterSetterById(Node*);
2499 void compilePutAccessorByVal(Node*);
2500 void compileGetRegExpObjectLastIndex(Node*);
2501 void compileSetRegExpObjectLastIndex(Node*);
2502 void compileLazyJSConstant(Node*);
2503 void compileMaterializeNewObject(Node*);
2504 void compileRecordRegExpCachedResult(Node*);
2505 void compileCallObjectConstructor(Node*);
2506 void compileResolveScope(Node*);
2507 void compileGetDynamicVar(Node*);
2508 void compilePutDynamicVar(Node*);
2509 void compileCompareEqPtr(Node*);
2511 void moveTrueTo(GPRReg);
2512 void moveFalseTo(GPRReg);
2513 void blessBoolean(GPRReg);
2515 // size can be an immediate or a register, and must be in bytes. If size is a register,
2516 // it must be a different register than resultGPR. Emits code that place a pointer to
2517 // the end of the allocation. The returned jump is the jump to the slow path.
2518 template<typename SizeType>
2519 MacroAssembler::Jump emitAllocateBasicStorage(SizeType size, GPRReg resultGPR)
2521 CopiedAllocator* copiedAllocator = &m_jit.vm()->heap.storageAllocator();
2523 // It's invalid to allocate zero bytes in CopiedSpace.
2525 m_jit.move(size, resultGPR);
2526 MacroAssembler::Jump nonZeroSize = m_jit.branchTest32(MacroAssembler::NonZero, resultGPR);
2527 m_jit.abortWithReason(DFGBasicStorageAllocatorZeroSize);
2528 nonZeroSize.link(&m_jit);
2531 m_jit.loadPtr(&copiedAllocator->m_currentRemaining, resultGPR);
2532 MacroAssembler::Jump slowPath = m_jit.branchSubPtr(JITCompiler::Signed, size, resultGPR);
2533 m_jit.storePtr(resultGPR, &copiedAllocator->m_currentRemaining);
2534 m_jit.negPtr(resultGPR);
2535 m_jit.addPtr(JITCompiler::AbsoluteAddress(&copiedAllocator->m_currentPayloadEnd), resultGPR);
2540 // Allocator for a cell of a specific size.
2541 template <typename StructureType> // StructureType can be GPR or ImmPtr.
2542 void emitAllocateJSCell(GPRReg resultGPR, GPRReg allocatorGPR, StructureType structure,
2543 GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
2545 if (Options::forceGCSlowPaths())
2546 slowPath.append(m_jit.jump());
2548 m_jit.loadPtr(MacroAssembler::Address(allocatorGPR, MarkedAllocator::offsetOfFreeListHead()), resultGPR);
2549 slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, resultGPR));
2552 // The object is half-allocated: we have what we know is a fresh object, but
2553 // it's still on the GC's free list.
2554 m_jit.loadPtr(MacroAssembler::Address(resultGPR), scratchGPR);
2555 m_jit.storePtr(scratchGPR, MacroAssembler::Address(allocatorGPR, MarkedAllocator::offsetOfFreeListHead()));
2557 // Initialize the object's Structure.
2558 m_jit.emitStoreStructureWithTypeInfo(structure, resultGPR, scratchGPR);
2561 // Allocator for an object of a specific size.
2562 template <typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2563 void emitAllocateJSObject(GPRReg resultGPR, GPRReg allocatorGPR, StructureType structure,
2564 StorageType storage, GPRReg scratchGPR, MacroAssembler::JumpList& slowPath)
2566 emitAllocateJSCell(resultGPR, allocatorGPR, structure, scratchGPR, slowPath);
2568 // Initialize the object's property storage pointer.
2569 m_jit.storePtr(storage, MacroAssembler::Address(resultGPR, JSObject::butterflyOffset()));
2572 template <typename ClassType, typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2573 void emitAllocateJSObjectWithKnownSize(
2574 GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1,
2575 GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath, size_t size)
2577 MarkedAllocator* allocator = &m_jit.vm()->heap.allocatorForObjectOfType<ClassType>(size);
2578 m_jit.move(TrustedImmPtr(allocator), scratchGPR1);
2579 emitAllocateJSObject(resultGPR, scratchGPR1, structure, storage, scratchGPR2, slowPath);
2582 // Convenience allocator for a built-in object.
2583 template <typename ClassType, typename StructureType, typename StorageType> // StructureType and StorageType can be GPR or ImmPtr.
2584 void emitAllocateJSObject(GPRReg resultGPR, StructureType structure, StorageType storage,
2585 GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2587 emitAllocateJSObjectWithKnownSize<ClassType>(
2588 resultGPR, structure, storage, scratchGPR1, scratchGPR2, slowPath,
2589 ClassType::allocationSize(0));
2592 template <typename ClassType, typename StructureType> // StructureType and StorageType can be GPR or ImmPtr.
2593 void emitAllocateVariableSizedJSObject(GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2595 static_assert(!(MarkedSpace::preciseStep & (MarkedSpace::preciseStep - 1)), "MarkedSpace::preciseStep must be a power of two.");
2596 static_assert(!(MarkedSpace::impreciseStep & (MarkedSpace::impreciseStep - 1)), "MarkedSpace::impreciseStep must be a power of two.");
2598 MarkedSpace::Subspace& subspace = m_jit.vm()->heap.subspaceForObjectOfType<ClassType>();
2599 m_jit.add32(TrustedImm32(MarkedSpace::preciseStep - 1), allocationSize);
2600 MacroAssembler::Jump notSmall = m_jit.branch32(MacroAssembler::AboveOrEqual, allocationSize, TrustedImm32(MarkedSpace::preciseCutoff));
2601 m_jit.rshift32(allocationSize, TrustedImm32(getLSBSet(MarkedSpace::preciseStep)), scratchGPR1);
2602 m_jit.mul32(TrustedImm32(sizeof(MarkedAllocator)), scratchGPR1, scratchGPR1);
2603 m_jit.addPtr(MacroAssembler::TrustedImmPtr(&subspace.preciseAllocators[0]), scratchGPR1);
2605 MacroAssembler::Jump selectedSmallSpace = m_jit.jump();
2606 notSmall.link(&m_jit);
2607 slowPath.append(m_jit.branch32(MacroAssembler::AboveOrEqual, allocationSize, TrustedImm32(MarkedSpace::impreciseCutoff)));
2608 m_jit.rshift32(allocationSize, TrustedImm32(getLSBSet(MarkedSpace::impreciseStep)), scratchGPR1);
2609 m_jit.mul32(TrustedImm32(sizeof(MarkedAllocator)), scratchGPR1, scratchGPR1);
2610 m_jit.addPtr(MacroAssembler::TrustedImmPtr(&subspace.impreciseAllocators[0]), scratchGPR1);
2612 selectedSmallSpace.link(&m_jit);
2614 emitAllocateJSObject(resultGPR, scratchGPR1, structure, TrustedImmPtr(0), scratchGPR2, slowPath);
2617 template <typename T>
2618 void emitAllocateDestructibleObject(GPRReg resultGPR, Structure* structure,
2619 GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
2621 emitAllocateJSObject<T>(resultGPR, TrustedImmPtr(structure), TrustedImmPtr(0), scratchGPR1, scratchGPR2, slowPath);
2622 m_jit.storePtr(TrustedImmPtr(structure->classInfo()), MacroAssembler::Address(resultGPR, JSDestructibleObject::classInfoOffset()));
2625 void emitAllocateRawObject(GPRReg resultGPR, Structure*, GPRReg storageGPR, unsigned numElements, unsigned vectorLength);
2627 void emitGetLength(InlineCallFrame*, GPRReg lengthGPR, bool includeThis = false);
2628 void emitGetLength(CodeOrigin, GPRReg lengthGPR, bool includeThis = false);
2629 void emitGetCallee(CodeOrigin, GPRReg calleeGPR);
2630 void emitGetArgumentStart(CodeOrigin, GPRReg startGPR);
2632 // Generate an OSR exit fuzz check. Returns Jump() if OSR exit fuzz is not enabled, or if
2633 // it's in training mode.
2634 MacroAssembler::Jump emitOSRExitFuzzCheck();
2636 // Add a speculation check.
2637 void speculationCheck(ExitKind, JSValueSource, Node*, MacroAssembler::Jump jumpToFail);
2638 void speculationCheck(ExitKind, JSValueSource, Node*, const MacroAssembler::JumpList& jumpsToFail);
2640 // Add a speculation check without additional recovery, and with a promise to supply a jump later.
2641 OSRExitJumpPlaceholder speculationCheck(ExitKind, JSValueSource, Node*);
2642 OSRExitJumpPlaceholder speculationCheck(ExitKind, JSValueSource, Edge);
2643 void speculationCheck(ExitKind, JSValueSource, Edge, MacroAssembler::Jump jumpToFail);
2644 void speculationCheck(ExitKind, JSValueSource, Edge, const MacroAssembler::JumpList& jumpsToFail);
2645 // Add a speculation check with additional recovery.
2646 void speculationCheck(ExitKind, JSValueSource, Node*, MacroAssembler::Jump jumpToFail, const SpeculationRecovery&);
2647 void speculationCheck(ExitKind, JSValueSource, Edge, MacroAssembler::Jump jumpToFail, const SpeculationRecovery&);
2649 void emitInvalidationPoint(Node*);
2651 void unreachable(Node*);
2653 // Called when we statically determine that a speculation will fail.
2654 void terminateSpeculativeExecution(ExitKind, JSValueRegs, Node*);
2655 void terminateSpeculativeExecution(ExitKind, JSValueRegs, Edge);
2657 // Helpers for performing type checks on an edge stored in the given registers.
2658 bool needsTypeCheck(Edge edge, SpeculatedType typesPassedThrough) { return m_interpreter.needsTypeCheck(edge, typesPassedThrough); }
2659 void typeCheck(JSValueSource, Edge, SpeculatedType typesPassedThrough, MacroAssembler::Jump jumpToFail, ExitKind = BadType);
2661 void speculateCellTypeWithoutTypeFiltering(Edge, GPRReg cellGPR, JSType);
2662 void speculateCellType(Edge, GPRReg cellGPR, SpeculatedType, JSType);
2664 void speculateInt32(Edge);
2666 void convertAnyInt(Edge, GPRReg resultGPR);
2667 void speculateAnyInt(Edge);
2668 void speculateDoubleRepAnyInt(Edge);
2669 #endif // USE(JSVALUE64)
2670 void speculateNumber(Edge);
2671 void speculateRealNumber(Edge);
2672 void speculateDoubleRepReal(Edge);
2673 void speculateBoolean(Edge);
2674 void speculateCell(Edge);
2675 void speculateCellOrOther(Edge);
2676 void speculateObject(Edge);
2677 void speculateFunction(Edge);
2678 void speculateFinalObject(Edge);
2679 void speculateRegExpObject(Edge, GPRReg cell);
2680 void speculateRegExpObject(Edge);
2681 void speculateObjectOrOther(Edge);
2682 void speculateString(Edge edge, GPRReg cell);
2683 void speculateStringIdentAndLoadStorage(Edge edge, GPRReg string, GPRReg storage);
2684 void speculateStringIdent(Edge edge, GPRReg string);
2685 void speculateStringIdent(Edge);
2686 void speculateString(Edge);
2687 void speculateStringOrOther(Edge, JSValueRegs, GPRReg scratch);
2688 void speculateStringOrOther(Edge);
2689 void speculateNotStringVar(Edge);
2690 template<typename StructureLocationType>
2691 void speculateStringObjectForStructure(Edge, StructureLocationType);
2692 void speculateStringObject(Edge, GPRReg);
2693 void speculateStringObject(Edge);
2694 void speculateStringOrStringObject(Edge);
2695 void speculateSymbol(Edge, GPRReg cell);
2696 void speculateSymbol(Edge);
2697 void speculateNotCell(Edge);
2698 void speculateOther(Edge);
2699 void speculateMisc(Edge, JSValueRegs);
2700 void speculateMisc(Edge);
2701 void speculate(Node*, Edge);
2703 JITCompiler::Jump jumpSlowForUnwantedArrayMode(GPRReg tempWithIndexingTypeReg, ArrayMode, IndexingType);
2704 JITCompiler::JumpList jumpSlowForUnwantedArrayMode(GPRReg tempWithIndexingTypeReg, ArrayMode);
2705 void checkArray(Node*);
2706 void arrayify(Node*, GPRReg baseReg, GPRReg propertyReg);
2707 void arrayify(Node*);
2709 template<bool strict>
2710 GPRReg fillSpeculateInt32Internal(Edge, DataFormat& returnFormat);
2712 // It is possible, during speculative generation, to reach a situation in which we
2713 // can statically determine a speculation will fail (for example, when two nodes
2714 // will make conflicting speculations about the same operand). In such cases this
2715 // flag is cleared, indicating no further code generation should take place.
2718 void recordSetLocal(
2719 VirtualRegister bytecodeReg, VirtualRegister machineReg, DataFormat format)
2721 m_stream->appendAndLog(VariableEvent::setLocal(bytecodeReg, machineReg, format));
2724 void recordSetLocal(DataFormat format)
2726 VariableAccessData* variable = m_currentNode->variableAccessData();
2727 recordSetLocal(variable->local(), variable->machineLocal(), format);
2730 GenerationInfo& generationInfoFromVirtualRegister(VirtualRegister virtualRegister)
2732 return m_generationInfo[virtualRegister.toLocal()];
2735 GenerationInfo& generationInfo(Node* node)
2737 return generationInfoFromVirtualRegister(node->virtualRegister());
2740 GenerationInfo& generationInfo(Edge edge)
2742 return generationInfo(edge.node());
2745 // The JIT, while also provides MacroAssembler functionality.
2748 // The current node being generated.
2749 BasicBlock* m_block;
2750 Node* m_currentNode;
2751 NodeType m_lastGeneratedNode;
2752 unsigned m_indexInBlock;
2753 // Virtual and physical register maps.
2754 Vector<GenerationInfo, 32> m_generationInfo;
2755 RegisterBank<GPRInfo> m_gprs;
2756 RegisterBank<FPRInfo> m_fprs;
2758 Vector<MacroAssembler::Label> m_osrEntryHeads;
2760 struct BranchRecord {
2761 BranchRecord(MacroAssembler::Jump jump, BasicBlock* destination)
2763 , destination(destination)
2767 MacroAssembler::Jump jump;
2768 BasicBlock* destination;
2770 Vector<BranchRecord, 8> m_branches;
2772 NodeOrigin m_origin;
2774 InPlaceAbstractState m_state;
2775 AbstractInterpreter<InPlaceAbstractState> m_interpreter;
2777 VariableEventStream* m_stream;
2778 MinifiedGraph* m_minifiedGraph;
2780 Vector<std::unique_ptr<SlowPathGenerator>, 8> m_slowPathGenerators;
2781 struct SlowPathLambda {
2782 std::function<void()> generator;
2784 unsigned streamIndex;
2786 Vector<SlowPathLambda> m_slowPathLambdas;
2787 Vector<SilentRegisterSavePlan> m_plans;
2788 Optional<unsigned> m_outOfLineStreamIndex;
2792 // === Operand types ===
2794 // These classes are used to lock the operands to a node into machine
2795 // registers. These classes implement of pattern of locking a value
2796 // into register at the point of construction only if it is already in
2797 // registers, and otherwise loading it lazily at the point it is first
2798 // used. We do so in order to attempt to avoid spilling one operand
2799 // in order to make space available for another.
2801 class JSValueOperand {
2803 explicit JSValueOperand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
2807 , m_gprOrInvalid(InvalidGPRReg)
2808 #elif USE(JSVALUE32_64)
2815 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == UntypedUse);
2817 if (jit->isFilled(node()))
2819 #elif USE(JSVALUE32_64)
2820 m_register.pair.tagGPR = InvalidGPRReg;
2821 m_register.pair.payloadGPR = InvalidGPRReg;
2822 if (jit->isFilled(node()))
2827 explicit JSValueOperand(JSValueOperand&& other)
2828 : m_jit(other.m_jit)
2829 , m_edge(other.m_edge)
2832 m_gprOrInvalid = other.m_gprOrInvalid;
2833 #elif USE(JSVALUE32_64)
2834 m_register.pair.tagGPR = InvalidGPRReg;
2835 m_register.pair.payloadGPR = InvalidGPRReg;
2836 m_isDouble = other.m_isDouble;
2840 m_register.fpr = other.m_register.fpr;
2842 m_register.pair = other.m_register.pair;
2845 other.m_edge = Edge();
2847 other.m_gprOrInvalid = InvalidGPRReg;
2848 #elif USE(JSVALUE32_64)
2849 other.m_isDouble = false;
2858 ASSERT(m_gprOrInvalid != InvalidGPRReg);
2859 m_jit->unlock(m_gprOrInvalid);
2860 #elif USE(JSVALUE32_64)
2862 ASSERT(m_register.fpr != InvalidFPRReg);
2863 m_jit->unlock(m_register.fpr);
2865 ASSERT(m_register.pair.tagGPR != InvalidGPRReg && m_register.pair.payloadGPR != InvalidGPRReg);
2866 m_jit->unlock(m_register.pair.tagGPR);
2867 m_jit->unlock(m_register.pair.payloadGPR);
2879 return edge().node();
2885 if (m_gprOrInvalid == InvalidGPRReg)
2886 m_gprOrInvalid = m_jit->fillJSValue(m_edge);
2887 return m_gprOrInvalid;
2889 JSValueRegs jsValueRegs()
2891 return JSValueRegs(gpr());
2893 #elif USE(JSVALUE32_64)
2894 bool isDouble() { return m_isDouble; }
2898 if (m_register.pair.tagGPR == InvalidGPRReg && m_register.pair.payloadGPR == InvalidGPRReg)
2899 m_isDouble = !m_jit->fillJSValue(m_edge, m_register.pair.tagGPR, m_register.pair.payloadGPR, m_register.fpr);
2905 ASSERT(!m_isDouble);
2906 return m_register.pair.tagGPR;
2912 ASSERT(!m_isDouble);
2913 return m_register.pair.payloadGPR;
2916 JSValueRegs jsValueRegs()
2918 return JSValueRegs(tagGPR(), payloadGPR());
2921 GPRReg gpr(WhichValueWord which)
2923 return jsValueRegs().gpr(which);
2930 return m_register.fpr;
2940 SpeculativeJIT* m_jit;
2943 GPRReg m_gprOrInvalid;
2944 #elif USE(JSVALUE32_64)
2956 class StorageOperand {
2958 explicit StorageOperand(SpeculativeJIT* jit, Edge edge)
2961 , m_gprOrInvalid(InvalidGPRReg)
2964 ASSERT(edge.useKind() == UntypedUse || edge.useKind() == KnownCellUse);
2965 if (jit->isFilled(node()))
2971 ASSERT(m_gprOrInvalid != InvalidGPRReg);
2972 m_jit->unlock(m_gprOrInvalid);
2982 return edge().node();
2987 if (m_gprOrInvalid == InvalidGPRReg)
2988 m_gprOrInvalid = m_jit->fillStorage(edge());
2989 return m_gprOrInvalid;
2998 SpeculativeJIT* m_jit;
3000 GPRReg m_gprOrInvalid;
3004 // === Temporaries ===
3006 // These classes are used to allocate temporary registers.
3007 // A mechanism is provided to attempt to reuse the registers
3008 // currently allocated to child nodes whose value is consumed
3009 // by, and not live after, this operation.
3011 enum ReuseTag { Reuse };
3013 class GPRTemporary {
3016 GPRTemporary(SpeculativeJIT*);
3017 GPRTemporary(SpeculativeJIT*, GPRReg specific);
3018 template<typename T>
3019 GPRTemporary(SpeculativeJIT* jit, ReuseTag, T& operand)
3021 , m_gpr(InvalidGPRReg)
3023 if (m_jit->canReuse(operand.node()))
3024 m_gpr = m_jit->reuse(operand.gpr());
3026 m_gpr = m_jit->allocate();
3028 template<typename T1, typename T2>
3029 GPRTemporary(SpeculativeJIT* jit, ReuseTag, T1& op1, T2& op2)
3031 , m_gpr(InvalidGPRReg)
3033 if (m_jit->canReuse(op1.node()))
3034 m_gpr = m_jit->reuse(op1.gpr());
3035 else if (m_jit->canReuse(op2.node()))
3036 m_gpr = m_jit->reuse(op2.gpr());
3037 else if (m_jit->canReuse(op1.node(), op2.node()) && op1.gpr() == op2.gpr())
3038 m_gpr = m_jit->reuse(op1.gpr());
3040 m_gpr = m_jit->allocate();
3042 #if USE(JSVALUE32_64)
3043 GPRTemporary(SpeculativeJIT*, ReuseTag, JSValueOperand&, WhichValueWord);
3046 GPRTemporary(GPRTemporary& other) = delete;
3048 GPRTemporary& operator=(GPRTemporary&& other)
3051 ASSERT(m_gpr == InvalidGPRReg);
3052 std::swap(m_jit, other.m_jit);
3053 std::swap(m_gpr, other.m_gpr);
3057 void adopt(GPRTemporary&);
3061 if (m_jit && m_gpr != InvalidGPRReg)
3062 m_jit->unlock(gpr());
3071 SpeculativeJIT* m_jit;
3075 class JSValueRegsTemporary {
3077 JSValueRegsTemporary();
3078 JSValueRegsTemporary(SpeculativeJIT*);
3079 template<typename T>
3080 JSValueRegsTemporary(SpeculativeJIT*, ReuseTag, T& operand, WhichValueWord resultRegWord = PayloadWord);
3081 JSValueRegsTemporary(SpeculativeJIT*, ReuseTag, JSValueOperand&);
3082 ~JSValueRegsTemporary();
3090 GPRTemporary m_payloadGPR;
3091 GPRTemporary m_tagGPR;
3095 class FPRTemporary {
3097 FPRTemporary(SpeculativeJIT*);
3098 FPRTemporary(SpeculativeJIT*, SpeculateDoubleOperand&);
3099 FPRTemporary(SpeculativeJIT*, SpeculateDoubleOperand&, SpeculateDoubleOperand&);
3100 #if USE(JSVALUE32_64)
3101 FPRTemporary(SpeculativeJIT*, JSValueOperand&);
3106 m_jit->unlock(fpr());
3111 ASSERT(m_fpr != InvalidFPRReg);
3116 FPRTemporary(SpeculativeJIT* jit, FPRReg lockedFPR)
3123 SpeculativeJIT* m_jit;
3130 // These classes lock the result of a call to a C++ helper function.
3132 class GPRFlushedCallResult : public GPRTemporary {
3134 GPRFlushedCallResult(SpeculativeJIT* jit)
3135 : GPRTemporary(jit, GPRInfo::returnValueGPR)
3140 #if USE(JSVALUE32_64)
3141 class GPRFlushedCallResult2 : public GPRTemporary {
3143 GPRFlushedCallResult2(SpeculativeJIT* jit)
3144 : GPRTemporary(jit, GPRInfo::returnValueGPR2)
3150 class FPRResult : public FPRTemporary {
3152 FPRResult(SpeculativeJIT* jit)
3153 : FPRTemporary(jit, lockedResult(jit))
3158 static FPRReg lockedResult(SpeculativeJIT* jit)
3160 jit->lock(FPRInfo::returnValueFPR);
3161 return FPRInfo::returnValueFPR;
3166 // === Speculative Operand types ===
3168 // SpeculateInt32Operand, SpeculateStrictInt32Operand and SpeculateCellOperand.
3170 // These are used to lock the operands to a node into machine registers within the
3171 // SpeculativeJIT. The classes operate like those above, however these will
3172 // perform a speculative check for a more restrictive type than we can statically
3173 // determine the operand to have. If the operand does not have the requested type,
3174 // a bail-out to the non-speculative path will be taken.
3176 class SpeculateInt32Operand {
3178 explicit SpeculateInt32Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3181 , m_gprOrInvalid(InvalidGPRReg)
3183 , m_format(DataFormatNone)
3187 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || (edge.useKind() == Int32Use || edge.useKind() == KnownInt32Use));
3188 if (jit->isFilled(node()))
3192 ~SpeculateInt32Operand()
3194 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3195 m_jit->unlock(m_gprOrInvalid);
3205 return edge().node();
3210 gpr(); // m_format is set when m_gpr is locked.
3211 ASSERT(m_format == DataFormatInt32 || m_format == DataFormatJSInt32);
3217 if (m_gprOrInvalid == InvalidGPRReg)
3218 m_gprOrInvalid = m_jit->fillSpeculateInt32(edge(), m_format);
3219 return m_gprOrInvalid;
3228 SpeculativeJIT* m_jit;
3230 GPRReg m_gprOrInvalid;
3231 DataFormat m_format;
3234 class SpeculateStrictInt32Operand {
3236 explicit SpeculateStrictInt32Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation)
3239 , m_gprOrInvalid(InvalidGPRReg)
3242 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || (edge.useKind() == Int32Use || edge.useKind() == KnownInt32Use));
3243 if (jit->isFilled(node()))
3247 ~SpeculateStrictInt32Operand()
3249 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3250 m_jit->unlock(m_gprOrInvalid);
3260 return edge().node();
3265 if (m_gprOrInvalid == InvalidGPRReg)
3266 m_gprOrInvalid = m_jit->fillSpeculateInt32Strict(edge());
3267 return m_gprOrInvalid;
3276 SpeculativeJIT* m_jit;
3278 GPRReg m_gprOrInvalid;
3281 // Gives you a canonical Int52 (i.e. it's left-shifted by 16, low bits zero).
3282 class SpeculateInt52Operand {
3284 explicit SpeculateInt52Operand(SpeculativeJIT* jit, Edge edge)
3287 , m_gprOrInvalid(InvalidGPRReg)
3289 RELEASE_ASSERT(edge.useKind() == Int52RepUse);
3290 if (jit->isFilled(node()))
3294 ~SpeculateInt52Operand()
3296 ASSERT(m_gprOrInvalid != InvalidGPRReg);
3297 m_jit->unlock(m_gprOrInvalid);
3307 return edge().node();
3312 if (m_gprOrInvalid == InvalidGPRReg)
3313 m_gprOrInvalid = m_jit->fillSpeculateInt52(edge(), DataFormatInt52);
3314 return m_gprOrInvalid;