Add support for CheckWatchdogTimer as slow path in DFG and FTL.
[WebKit-https.git] / Source / JavaScriptCore / jit / JIT.h
1 /*
2  * Copyright (C) 2008, 2012-2015 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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. 
24  */
25
26 #ifndef JIT_h
27 #define JIT_h
28
29 #if ENABLE(JIT)
30
31 // We've run into some problems where changing the size of the class JIT leads to
32 // performance fluctuations.  Try forcing alignment in an attempt to stabalize this.
33 #if COMPILER(GCC_OR_CLANG)
34 #define JIT_CLASS_ALIGNMENT __attribute__ ((aligned (32)))
35 #else
36 #define JIT_CLASS_ALIGNMENT
37 #endif
38
39 #define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(expected), static_cast<int>(actual));
40
41 #include "CodeBlock.h"
42 #include "CompactJITCodeMap.h"
43 #include "Interpreter.h"
44 #include "JITDisassembler.h"
45 #include "JITInlineCacheGenerator.h"
46 #include "JSInterfaceJIT.h"
47 #include "Opcode.h"
48 #include "ResultType.h"
49 #include "SamplingTool.h"
50 #include "UnusedPointer.h"
51
52 namespace JSC {
53
54     class ArrayAllocationProfile;
55     class CallLinkInfo;
56     class CodeBlock;
57     class FunctionExecutable;
58     class JIT;
59     class Identifier;
60     class Interpreter;
61     class JSScope;
62     class JSStack;
63     class MarkedAllocator;
64     class Register;
65     class StructureChain;
66
67     struct Instruction;
68     struct OperandTypes;
69     struct PolymorphicAccessStructureList;
70     struct SimpleJumpTable;
71     struct StringJumpTable;
72     struct StructureStubInfo;
73
74     struct CallRecord {
75         MacroAssembler::Call from;
76         unsigned bytecodeOffset;
77         void* to;
78
79         CallRecord()
80         {
81         }
82
83         CallRecord(MacroAssembler::Call from, unsigned bytecodeOffset, void* to = 0)
84             : from(from)
85             , bytecodeOffset(bytecodeOffset)
86             , to(to)
87         {
88         }
89     };
90
91     struct JumpTable {
92         MacroAssembler::Jump from;
93         unsigned toBytecodeOffset;
94
95         JumpTable(MacroAssembler::Jump f, unsigned t)
96             : from(f)
97             , toBytecodeOffset(t)
98         {
99         }
100     };
101
102     struct SlowCaseEntry {
103         MacroAssembler::Jump from;
104         unsigned to;
105         unsigned hint;
106         
107         SlowCaseEntry(MacroAssembler::Jump f, unsigned t, unsigned h = 0)
108             : from(f)
109             , to(t)
110             , hint(h)
111         {
112         }
113     };
114
115     struct SwitchRecord {
116         enum Type {
117             Immediate,
118             Character,
119             String
120         };
121
122         Type type;
123
124         union {
125             SimpleJumpTable* simpleJumpTable;
126             StringJumpTable* stringJumpTable;
127         } jumpTable;
128
129         unsigned bytecodeOffset;
130         unsigned defaultOffset;
131
132         SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset, Type type)
133             : type(type)
134             , bytecodeOffset(bytecodeOffset)
135             , defaultOffset(defaultOffset)
136         {
137             this->jumpTable.simpleJumpTable = jumpTable;
138         }
139
140         SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset)
141             : type(String)
142             , bytecodeOffset(bytecodeOffset)
143             , defaultOffset(defaultOffset)
144         {
145             this->jumpTable.stringJumpTable = jumpTable;
146         }
147     };
148
149     struct ByValCompilationInfo {
150         ByValCompilationInfo() { }
151         
152         ByValCompilationInfo(ByValInfo* byValInfo, unsigned bytecodeIndex, MacroAssembler::PatchableJump notIndexJump, MacroAssembler::PatchableJump badTypeJump, JITArrayMode arrayMode, ArrayProfile* arrayProfile, MacroAssembler::Label doneTarget, MacroAssembler::Label nextHotPathTarget)
153             : byValInfo(byValInfo)
154             , bytecodeIndex(bytecodeIndex)
155             , notIndexJump(notIndexJump)
156             , badTypeJump(badTypeJump)
157             , arrayMode(arrayMode)
158             , arrayProfile(arrayProfile)
159             , doneTarget(doneTarget)
160             , nextHotPathTarget(nextHotPathTarget)
161         {
162         }
163
164         ByValInfo* byValInfo;
165         unsigned bytecodeIndex;
166         MacroAssembler::PatchableJump notIndexJump;
167         MacroAssembler::PatchableJump badTypeJump;
168         JITArrayMode arrayMode;
169         ArrayProfile* arrayProfile;
170         MacroAssembler::Label doneTarget;
171         MacroAssembler::Label nextHotPathTarget;
172         MacroAssembler::Label slowPathTarget;
173         MacroAssembler::Call returnAddress;
174     };
175
176     struct CallCompilationInfo {
177         MacroAssembler::DataLabelPtr hotPathBegin;
178         MacroAssembler::Call hotPathOther;
179         MacroAssembler::Call callReturnLocation;
180         CallLinkInfo* callLinkInfo;
181     };
182
183     // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions.
184     void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
185     void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
186     void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction);
187
188     class JIT : private JSInterfaceJIT {
189         friend class JITSlowPathCall;
190         friend class JITStubCall;
191
192         using MacroAssembler::Jump;
193         using MacroAssembler::JumpList;
194         using MacroAssembler::Label;
195
196         static const uintptr_t patchGetByIdDefaultStructure = unusedPointer;
197         static const int patchGetByIdDefaultOffset = 0;
198         // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler
199         // will compress the displacement, and we may not be able to fit a patched offset.
200         static const int patchPutByIdDefaultOffset = 256;
201
202     public:
203         static CompilationResult compile(VM* vm, CodeBlock* codeBlock, JITCompilationEffort effort)
204         {
205             return JIT(vm, codeBlock).privateCompile(effort);
206         }
207         
208         static void compileGetByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
209         {
210             JIT jit(vm, codeBlock);
211             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
212             jit.privateCompileGetByVal(byValInfo, returnAddress, arrayMode);
213         }
214
215         static void compileGetByValWithCachedId(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, const Identifier& propertyName)
216         {
217             JIT jit(vm, codeBlock);
218             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
219             jit.privateCompileGetByValWithCachedId(byValInfo, returnAddress, propertyName);
220         }
221
222         static void compilePutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
223         {
224             JIT jit(vm, codeBlock);
225             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
226             jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode);
227         }
228         
229         static void compileDirectPutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
230         {
231             JIT jit(vm, codeBlock);
232             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
233             jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode);
234         }
235
236         static void compileHasIndexedProperty(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
237         {
238             JIT jit(vm, codeBlock);
239             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
240             jit.privateCompileHasIndexedProperty(byValInfo, returnAddress, arrayMode);
241         }
242
243         static CodeRef compileCTINativeCall(VM* vm, NativeFunction func)
244         {
245             if (!vm->canUseJIT()) {
246                 return CodeRef::createLLIntCodeRef(llint_native_call_trampoline);
247             }
248             JIT jit(vm, 0);
249             return jit.privateCompileCTINativeCall(vm, func);
250         }
251
252         static unsigned frameRegisterCountFor(CodeBlock*);
253         static int stackPointerOffsetFor(CodeBlock*);
254
255     private:
256         JIT(VM*, CodeBlock* = 0);
257
258         void privateCompileMainPass();
259         void privateCompileLinkPass();
260         void privateCompileSlowCases();
261         CompilationResult privateCompile(JITCompilationEffort);
262         
263         void privateCompileGetByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode);
264         void privateCompileGetByValWithCachedId(ByValInfo*, ReturnAddressPtr, const Identifier&);
265         void privateCompilePutByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode);
266
267         void privateCompileHasIndexedProperty(ByValInfo*, ReturnAddressPtr, JITArrayMode);
268
269         Label privateCompileCTINativeCall(VM*, bool isConstruct = false);
270         CodeRef privateCompileCTINativeCall(VM*, NativeFunction);
271         void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
272
273         // Add a call out from JIT code, without an exception check.
274         Call appendCall(const FunctionPtr& function)
275         {
276             Call functionCall = call();
277             m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value()));
278             return functionCall;
279         }
280
281 #if OS(WINDOWS) && CPU(X86_64)
282         Call appendCallWithSlowPathReturnType(const FunctionPtr& function)
283         {
284             Call functionCall = callWithSlowPathReturnType();
285             m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value()));
286             return functionCall;
287         }
288 #endif
289
290         void exceptionCheck(Jump jumpToHandler)
291         {
292             m_exceptionChecks.append(jumpToHandler);
293         }
294
295         void exceptionCheck()
296         {
297             m_exceptionChecks.append(emitExceptionCheck());
298         }
299
300         void exceptionCheckWithCallFrameRollback()
301         {
302             m_exceptionChecksWithCallFrameRollback.append(emitExceptionCheck());
303         }
304
305         void privateCompileExceptionHandlers();
306
307         void addSlowCase(Jump);
308         void addSlowCase(JumpList);
309         void addSlowCase();
310         void addJump(Jump, int);
311         void emitJumpSlowToHot(Jump, int);
312
313         void compileOpCall(OpcodeID, Instruction*, unsigned callLinkInfoIndex);
314         void compileOpCallSlowCase(OpcodeID, Instruction*, Vector<SlowCaseEntry>::iterator&, unsigned callLinkInfoIndex);
315         void compileSetupVarargsFrame(Instruction*, CallLinkInfo*);
316         void compileCallEval(Instruction*);
317         void compileCallEvalSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&);
318         void emitPutCallResult(Instruction*);
319
320         enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
321         void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
322         bool isOperandConstantImmediateDouble(int src);
323         
324         void emitLoadDouble(int index, FPRegisterID value);
325         void emitLoadInt32ToDouble(int index, FPRegisterID value);
326         Jump emitJumpIfCellObject(RegisterID cellReg);
327         Jump emitJumpIfCellNotObject(RegisterID cellReg);
328
329         enum WriteBarrierMode { UnconditionalWriteBarrier, ShouldFilterBase, ShouldFilterValue, ShouldFilterBaseAndValue };
330         // value register in write barrier is used before any scratch registers
331         // so may safely be the same as either of the scratch registers.
332         void emitWriteBarrier(unsigned owner, unsigned value, WriteBarrierMode);
333         void emitWriteBarrier(JSCell* owner, unsigned value, WriteBarrierMode);
334         void emitWriteBarrier(JSCell* owner);
335
336         template<typename StructureType> // StructureType can be RegisterID or ImmPtr.
337         void emitAllocateJSObject(RegisterID allocator, StructureType, RegisterID result, RegisterID scratch);
338         
339         // This assumes that the value to profile is in regT0 and that regT3 is available for
340         // scratch.
341         void emitValueProfilingSite(ValueProfile*);
342         void emitValueProfilingSite(unsigned bytecodeOffset);
343         void emitValueProfilingSite();
344         void emitArrayProfilingSiteWithCell(RegisterID cell, RegisterID indexingType, ArrayProfile*);
345         void emitArrayProfilingSiteForBytecodeIndexWithCell(RegisterID cell, RegisterID indexingType, unsigned bytecodeIndex);
346         void emitArrayProfileStoreToHoleSpecialCase(ArrayProfile*);
347         void emitArrayProfileOutOfBoundsSpecialCase(ArrayProfile*);
348         
349         JITArrayMode chooseArrayMode(ArrayProfile*);
350         
351         // Property is in regT1, base is in regT0. regT2 contains indexing type.
352         // Property is int-checked and zero extended. Base is cell checked.
353         // Structure is already profiled. Returns the slow cases. Fall-through
354         // case contains result in regT0, and it is not yet profiled.
355         JumpList emitInt32Load(Instruction* instruction, PatchableJump& badType) { return emitContiguousLoad(instruction, badType, Int32Shape); }
356         JumpList emitDoubleLoad(Instruction*, PatchableJump& badType);
357         JumpList emitContiguousLoad(Instruction*, PatchableJump& badType, IndexingType expectedShape = ContiguousShape);
358         JumpList emitArrayStorageLoad(Instruction*, PatchableJump& badType);
359         JumpList emitLoadForArrayMode(Instruction*, JITArrayMode, PatchableJump& badType);
360
361         JumpList emitInt32GetByVal(Instruction* instruction, PatchableJump& badType) { return emitContiguousGetByVal(instruction, badType, Int32Shape); }
362         JumpList emitDoubleGetByVal(Instruction*, PatchableJump& badType);
363         JumpList emitContiguousGetByVal(Instruction*, PatchableJump& badType, IndexingType expectedShape = ContiguousShape);
364         JumpList emitArrayStorageGetByVal(Instruction*, PatchableJump& badType);
365         JumpList emitDirectArgumentsGetByVal(Instruction*, PatchableJump& badType);
366         JumpList emitScopedArgumentsGetByVal(Instruction*, PatchableJump& badType);
367         JumpList emitIntTypedArrayGetByVal(Instruction*, PatchableJump& badType, TypedArrayType);
368         JumpList emitFloatTypedArrayGetByVal(Instruction*, PatchableJump& badType, TypedArrayType);
369         
370         // Property is in regT0, base is in regT0. regT2 contains indecing type.
371         // The value to store is not yet loaded. Property is int-checked and
372         // zero-extended. Base is cell checked. Structure is already profiled.
373         // returns the slow cases.
374         JumpList emitInt32PutByVal(Instruction* currentInstruction, PatchableJump& badType)
375         {
376             return emitGenericContiguousPutByVal(currentInstruction, badType, Int32Shape);
377         }
378         JumpList emitDoublePutByVal(Instruction* currentInstruction, PatchableJump& badType)
379         {
380             return emitGenericContiguousPutByVal(currentInstruction, badType, DoubleShape);
381         }
382         JumpList emitContiguousPutByVal(Instruction* currentInstruction, PatchableJump& badType)
383         {
384             return emitGenericContiguousPutByVal(currentInstruction, badType);
385         }
386         JumpList emitGenericContiguousPutByVal(Instruction*, PatchableJump& badType, IndexingType indexingShape = ContiguousShape);
387         JumpList emitArrayStoragePutByVal(Instruction*, PatchableJump& badType);
388         JumpList emitIntTypedArrayPutByVal(Instruction*, PatchableJump& badType, TypedArrayType);
389         JumpList emitFloatTypedArrayPutByVal(Instruction*, PatchableJump& badType, TypedArrayType);
390
391         JITGetByIdGenerator emitGetByValWithCachedId(Instruction*, const Identifier&, Jump& fastDoneCase, Jump& slowDoneCase, JumpList& slowCases);
392
393         enum FinalObjectMode { MayBeFinal, KnownNotFinal };
394
395         template <typename T> Jump branchStructure(RelationalCondition, T leftHandSide, Structure*);
396
397 #if USE(JSVALUE32_64)
398         bool getOperandConstantImmediateInt(int op1, int op2, int& op, int32_t& constant);
399
400         void emitLoadTag(int index, RegisterID tag);
401         void emitLoadPayload(int index, RegisterID payload);
402
403         void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
404         void emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
405         void emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2);
406
407         void emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
408         void emitStore(int index, const JSValue constant, RegisterID base = callFrameRegister);
409         void emitStoreInt32(int index, RegisterID payload, bool indexIsInt32 = false);
410         void emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32 = false);
411         void emitStoreCell(int index, RegisterID payload, bool indexIsCell = false);
412         void emitStoreBool(int index, RegisterID payload, bool indexIsBool = false);
413         void emitStoreDouble(int index, FPRegisterID value);
414
415         void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex);
416         void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag);
417
418         void compileGetByIdHotPath(const Identifier*);
419         void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset);
420         void compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset);
421         void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset, FinalObjectMode = MayBeFinal);
422         void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, PropertyOffset cachedOffset);
423
424         // Arithmetic opcode helpers
425         void emitAdd32Constant(int dst, int op, int32_t constant, ResultType opType);
426         void emitSub32Constant(int dst, int op, int32_t constant, ResultType opType);
427         void emitBinaryDoubleOp(OpcodeID, int dst, int op1, int op2, OperandTypes, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters = true, bool op2IsInRegisters = true);
428
429 #else // USE(JSVALUE32_64)
430         void emitGetVirtualRegister(int src, RegisterID dst);
431         void emitGetVirtualRegister(VirtualRegister src, RegisterID dst);
432         void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2);
433         void emitGetVirtualRegisters(VirtualRegister src1, RegisterID dst1, VirtualRegister src2, RegisterID dst2);
434         void emitPutVirtualRegister(int dst, RegisterID from = regT0);
435         void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0);
436         void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false)
437         {
438             emitPutVirtualRegister(dst, payload);
439         }
440         void emitStoreCell(VirtualRegister dst, RegisterID payload)
441         {
442             emitPutVirtualRegister(dst, payload);
443         }
444
445         int32_t getConstantOperandImmediateInt(int src);
446
447         Jump emitJumpIfJSCell(RegisterID);
448         Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID);
449         void emitJumpSlowCaseIfJSCell(RegisterID);
450         void emitJumpSlowCaseIfNotJSCell(RegisterID);
451         void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);
452         Jump emitJumpIfImmediateInteger(RegisterID);
453         Jump emitJumpIfNotImmediateInteger(RegisterID);
454         Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
455         PatchableJump emitPatchableJumpIfNotImmediateInteger(RegisterID);
456         void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);
457         void emitJumpSlowCaseIfNotImmediateNumber(RegisterID);
458         void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
459
460         void emitFastArithReTagImmediate(RegisterID src, RegisterID dest);
461
462         void emitTagAsBoolImmediate(RegisterID reg);
463         void compileBinaryArithOp(OpcodeID, int dst, int src1, int src2, OperandTypes opi);
464         void compileBinaryArithOpSlowCase(Instruction*, OpcodeID, Vector<SlowCaseEntry>::iterator&, int dst, int src1, int src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase);
465
466         void compileGetByIdHotPath(int baseVReg, const Identifier*);
467         void compileGetDirectOffset(RegisterID base, RegisterID result, PropertyOffset cachedOffset);
468         void compileGetDirectOffset(JSObject* base, RegisterID result, PropertyOffset cachedOffset);
469         void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch, FinalObjectMode = MayBeFinal);
470         void compilePutDirectOffset(RegisterID base, RegisterID value, PropertyOffset cachedOffset);
471
472 #endif // USE(JSVALUE32_64)
473
474         void emit_compareAndJump(OpcodeID, int op1, int op2, unsigned target, RelationalCondition);
475         void emit_compareAndJumpSlow(int op1, int op2, unsigned target, DoubleCondition, size_t (JIT_OPERATION *operation)(ExecState*, EncodedJSValue, EncodedJSValue), bool invert, Vector<SlowCaseEntry>::iterator&);
476         
477         void assertStackPointerOffset();
478
479         void emit_op_add(Instruction*);
480         void emit_op_bitand(Instruction*);
481         void emit_op_bitor(Instruction*);
482         void emit_op_bitxor(Instruction*);
483         void emit_op_call(Instruction*);
484         void emit_op_call_eval(Instruction*);
485         void emit_op_call_varargs(Instruction*);
486         void emit_op_construct_varargs(Instruction*);
487         void emit_op_catch(Instruction*);
488         void emit_op_construct(Instruction*);
489         void emit_op_create_this(Instruction*);
490         void emit_op_to_this(Instruction*);
491         void emit_op_create_direct_arguments(Instruction*);
492         void emit_op_create_scoped_arguments(Instruction*);
493         void emit_op_create_out_of_band_arguments(Instruction*);
494         void emit_op_check_tdz(Instruction*);
495         void emit_op_debug(Instruction*);
496         void emit_op_del_by_id(Instruction*);
497         void emit_op_div(Instruction*);
498         void emit_op_end(Instruction*);
499         void emit_op_enter(Instruction*);
500         void emit_op_get_scope(Instruction*);
501         void emit_op_load_arrowfunction_this(Instruction*);
502         void emit_op_eq(Instruction*);
503         void emit_op_eq_null(Instruction*);
504         void emit_op_get_by_id(Instruction*);
505         void emit_op_get_arguments_length(Instruction*);
506         void emit_op_get_by_val(Instruction*);
507         void emit_op_get_argument_by_val(Instruction*);
508         void emit_op_init_lazy_reg(Instruction*);
509         void emit_op_check_has_instance(Instruction*);
510         void emit_op_instanceof(Instruction*);
511         void emit_op_is_undefined(Instruction*);
512         void emit_op_is_boolean(Instruction*);
513         void emit_op_is_number(Instruction*);
514         void emit_op_is_string(Instruction*);
515         void emit_op_is_object(Instruction*);
516         void emit_op_jeq_null(Instruction*);
517         void emit_op_jfalse(Instruction*);
518         void emit_op_jmp(Instruction*);
519         void emit_op_jneq_null(Instruction*);
520         void emit_op_jneq_ptr(Instruction*);
521         void emit_op_jless(Instruction*);
522         void emit_op_jlesseq(Instruction*);
523         void emit_op_jgreater(Instruction*);
524         void emit_op_jgreatereq(Instruction*);
525         void emit_op_jnless(Instruction*);
526         void emit_op_jnlesseq(Instruction*);
527         void emit_op_jngreater(Instruction*);
528         void emit_op_jngreatereq(Instruction*);
529         void emit_op_jtrue(Instruction*);
530         void emit_op_loop_hint(Instruction*);
531         void emit_op_lshift(Instruction*);
532         void emit_op_mod(Instruction*);
533         void emit_op_mov(Instruction*);
534         void emit_op_mul(Instruction*);
535         void emit_op_negate(Instruction*);
536         void emit_op_neq(Instruction*);
537         void emit_op_neq_null(Instruction*);
538         void emit_op_new_array(Instruction*);
539         void emit_op_new_array_with_size(Instruction*);
540         void emit_op_new_array_buffer(Instruction*);
541         void emit_op_new_func(Instruction*);
542         void emit_op_new_func_exp(Instruction*);
543         void emit_op_new_arrow_func_exp(Instruction*);
544         void emit_op_new_object(Instruction*);
545         void emit_op_new_regexp(Instruction*);
546         void emit_op_not(Instruction*);
547         void emit_op_nstricteq(Instruction*);
548         void emit_op_dec(Instruction*);
549         void emit_op_inc(Instruction*);
550         void emit_op_profile_did_call(Instruction*);
551         void emit_op_profile_will_call(Instruction*);
552         void emit_op_profile_type(Instruction*);
553         void emit_op_profile_control_flow(Instruction*);
554         void emit_op_push_with_scope(Instruction*);
555         void emit_op_create_lexical_environment(Instruction*);
556         void emit_op_get_parent_scope(Instruction*);
557         void emit_op_put_by_id(Instruction*);
558         void emit_op_put_by_index(Instruction*);
559         void emit_op_put_by_val(Instruction*);
560         void emit_op_put_getter_by_id(Instruction*);
561         void emit_op_put_setter_by_id(Instruction*);
562         void emit_op_put_getter_setter(Instruction*);
563         void emit_op_ret(Instruction*);
564         void emit_op_rshift(Instruction*);
565         void emit_op_strcat(Instruction*);
566         void emit_op_stricteq(Instruction*);
567         void emit_op_sub(Instruction*);
568         void emit_op_switch_char(Instruction*);
569         void emit_op_switch_imm(Instruction*);
570         void emit_op_switch_string(Instruction*);
571         void emit_op_tear_off_arguments(Instruction*);
572         void emit_op_throw(Instruction*);
573         void emit_op_throw_static_error(Instruction*);
574         void emit_op_to_number(Instruction*);
575         void emit_op_to_string(Instruction*);
576         void emit_op_to_primitive(Instruction*);
577         void emit_op_unexpected_load(Instruction*);
578         void emit_op_unsigned(Instruction*);
579         void emit_op_urshift(Instruction*);
580         void emit_op_get_enumerable_length(Instruction*);
581         void emit_op_has_generic_property(Instruction*);
582         void emit_op_has_structure_property(Instruction*);
583         void emit_op_has_indexed_property(Instruction*);
584         void emit_op_get_direct_pname(Instruction*);
585         void emit_op_get_property_enumerator(Instruction*);
586         void emit_op_enumerator_structure_pname(Instruction*);
587         void emit_op_enumerator_generic_pname(Instruction*);
588         void emit_op_to_index_string(Instruction*);
589
590         void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
591         void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
592         void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&);
593         void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
594         void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
595         void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
596         void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
597         void emitSlow_op_construct_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
598         void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
599         void emitSlow_op_to_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
600         void emitSlow_op_create_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
601         void emitSlow_op_check_tdz(Instruction*, Vector<SlowCaseEntry>::iterator&);
602         void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
603         void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
604         void emitSlow_op_get_callee(Instruction*, Vector<SlowCaseEntry>::iterator&);
605         void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
606         void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&);
607         void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
608         void emitSlow_op_get_argument_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
609         void emitSlow_op_check_has_instance(Instruction*, Vector<SlowCaseEntry>::iterator&);
610         void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&);
611         void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&);
612         void emitSlow_op_jless(Instruction*, Vector<SlowCaseEntry>::iterator&);
613         void emitSlow_op_jlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
614         void emitSlow_op_jgreater(Instruction*, Vector<SlowCaseEntry>::iterator&);
615         void emitSlow_op_jgreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
616         void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&);
617         void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
618         void emitSlow_op_jngreater(Instruction*, Vector<SlowCaseEntry>::iterator&);
619         void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
620         void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
621         void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&);
622         void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
623         void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
624         void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
625         void emitSlow_op_negate(Instruction*, Vector<SlowCaseEntry>::iterator&);
626         void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&);
627         void emitSlow_op_new_object(Instruction*, Vector<SlowCaseEntry>::iterator&);
628         void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
629         void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
630         void emitSlow_op_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
631         void emitSlow_op_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
632         void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
633         void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
634         void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
635         void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
636         void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
637         void emitSlow_op_to_number(Instruction*, Vector<SlowCaseEntry>::iterator&);
638         void emitSlow_op_to_string(Instruction*, Vector<SlowCaseEntry>::iterator&);
639         void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
640         void emitSlow_op_unsigned(Instruction*, Vector<SlowCaseEntry>::iterator&);
641         void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
642         void emitSlow_op_has_indexed_property(Instruction*, Vector<SlowCaseEntry>::iterator&);
643         void emitSlow_op_has_structure_property(Instruction*, Vector<SlowCaseEntry>::iterator&);
644         void emitSlow_op_get_direct_pname(Instruction*, Vector<SlowCaseEntry>::iterator&);
645
646         void emit_op_resolve_scope(Instruction*);
647         void emit_op_get_from_scope(Instruction*);
648         void emit_op_put_to_scope(Instruction*);
649         void emit_op_get_from_arguments(Instruction*);
650         void emit_op_put_to_arguments(Instruction*);
651         void emitSlow_op_resolve_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
652         void emitSlow_op_get_from_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
653         void emitSlow_op_put_to_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
654
655         void emitRightShift(Instruction*, bool isUnsigned);
656         void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
657
658         void emitNewFuncExprCommon(Instruction*);
659         void emitVarInjectionCheck(bool needsVarInjectionChecks);
660         void emitResolveClosure(int dst, int scope, bool needsVarInjectionChecks, unsigned depth);
661         void emitLoadWithStructureCheck(int scope, Structure** structureSlot);
662         void emitGetGlobalProperty(uintptr_t* operandSlot);
663         void emitGetGlobalVar(uintptr_t operand);
664         void emitGetClosureVar(int scope, uintptr_t operand);
665         void emitPutGlobalProperty(uintptr_t* operandSlot, int value);
666         void emitNotifyWrite(WatchpointSet*);
667         void emitPutGlobalVar(uintptr_t operand, int value, WatchpointSet*);
668         void emitPutClosureVar(int scope, uintptr_t operand, int value, WatchpointSet*);
669
670         void emitInitRegister(int dst);
671
672         void emitPutIntToCallFrameHeader(RegisterID from, JSStack::CallFrameHeaderEntry);
673
674         JSValue getConstantOperand(int src);
675         bool isOperandConstantImmediateInt(int src);
676         bool isOperandConstantImmediateChar(int src);
677
678         Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter)
679         {
680             return iter++->from;
681         }
682         void linkSlowCase(Vector<SlowCaseEntry>::iterator& iter)
683         {
684             iter->from.link(this);
685             ++iter;
686         }
687         void linkDummySlowCase(Vector<SlowCaseEntry>::iterator& iter)
688         {
689             ASSERT(!iter->from.isSet());
690             ++iter;
691         }
692         void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex);
693
694         MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&);
695 #if OS(WINDOWS) && CPU(X86_64)
696         MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr&);
697 #endif
698         MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&);
699         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int);
700         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr&, int);
701         
702         enum WithProfileTag { WithProfile };
703         
704         MacroAssembler::Call callOperation(C_JITOperation_E);
705         MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg);
706         MacroAssembler::Call callOperation(C_JITOperation_EL, GPRReg);
707         MacroAssembler::Call callOperation(C_JITOperation_EL, TrustedImmPtr);
708         MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*);
709         MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t);
710         MacroAssembler::Call callOperation(Z_JITOperation_EJZZ, GPRReg, int32_t, int32_t);
711         MacroAssembler::Call callOperation(J_JITOperation_E, int);
712         MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg);
713         MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, GPRReg, int32_t);
714         MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, const JSValue*, int32_t);
715         MacroAssembler::Call callOperation(J_JITOperation_EC, int, JSCell*);
716         MacroAssembler::Call callOperation(V_JITOperation_EC, JSCell*);
717         MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg);
718 #if USE(JSVALUE64)
719         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*);
720 #else
721         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*);
722 #endif
723         MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, const Identifier*);
724         MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg);
725         MacroAssembler::Call callOperation(J_JITOperation_EJJAp, int, GPRReg, GPRReg, ArrayProfile*);
726         MacroAssembler::Call callOperation(J_JITOperation_EJJBy, int, GPRReg, GPRReg, ByValInfo*);
727         MacroAssembler::Call callOperation(C_JITOperation_EJsc, GPRReg);
728         MacroAssembler::Call callOperation(J_JITOperation_EJscC, int, GPRReg, JSCell*);
729         MacroAssembler::Call callOperation(J_JITOperation_EJscCJ, int, GPRReg, JSCell*, GPRReg);
730         MacroAssembler::Call callOperation(C_JITOperation_EJscZ, GPRReg, int32_t);
731         MacroAssembler::Call callOperation(C_JITOperation_EJscZ, int, GPRReg, int32_t);
732 #if USE(JSVALUE64)
733         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg);
734 #else
735         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
736 #endif
737         MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
738         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EPc, int, Instruction*);
739         MacroAssembler::Call callOperation(J_JITOperation_EPc, int, Instruction*);
740         MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
741         MacroAssembler::Call callOperation(J_JITOperation_EZZ, int, int32_t, int32_t);
742         MacroAssembler::Call callOperation(P_JITOperation_E);
743         MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
744         MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
745         MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);
746         MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID);
747         MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID);
748         MacroAssembler::Call callOperation(Sprt_JITOperation_EZ, int32_t);
749         MacroAssembler::Call callOperation(V_JITOperation_E);
750         MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID);
751         MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);
752         MacroAssembler::Call callOperation(V_JITOperation_ECIZC, RegisterID, const Identifier*, int32_t, RegisterID);
753         MacroAssembler::Call callOperation(V_JITOperation_ECIZCC, RegisterID, const Identifier*, int32_t, RegisterID, RegisterID);
754         MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID);
755         MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
756         MacroAssembler::Call callOperation(J_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
757         MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
758 #if USE(JSVALUE64)
759         MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID);
760 #else
761         MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID, RegisterID);
762 #endif
763         MacroAssembler::Call callOperation(V_JITOperation_EJIdZJ, RegisterID, const Identifier*, int32_t, RegisterID);
764         MacroAssembler::Call callOperation(V_JITOperation_EJIdZJJ, RegisterID, const Identifier*, int32_t, RegisterID, RegisterID);
765 #if USE(JSVALUE64)
766         MacroAssembler::Call callOperation(F_JITOperation_EFJZZ, RegisterID, RegisterID, int32_t, RegisterID);
767         MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, UniquedStringImpl*);
768 #else
769         MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, RegisterID, RegisterID, UniquedStringImpl*);
770 #endif
771         MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID);
772         MacroAssembler::Call callOperation(V_JITOperation_EJJJAp, RegisterID, RegisterID, RegisterID, ArrayProfile*);
773         MacroAssembler::Call callOperation(V_JITOperation_EJJJBy, RegisterID, RegisterID, RegisterID, ByValInfo*);
774         MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, int32_t, RegisterID);
775         MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, int32_t);
776         MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*);
777         MacroAssembler::Call callOperation(V_JITOperation_EZ, int32_t);
778         MacroAssembler::Call callOperation(V_JITOperation_EZJ, int, GPRReg);
779         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E);
780         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*);
781         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E);
782 #if USE(JSVALUE32_64)
783         MacroAssembler::Call callOperation(F_JITOperation_EFJZZ, RegisterID, RegisterID, RegisterID, int32_t, RegisterID);
784         MacroAssembler::Call callOperation(Z_JITOperation_EJZZ, GPRReg, GPRReg, int32_t, int32_t);
785         MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg);
786         MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg, GPRReg);
787         MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*);
788         MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
789         MacroAssembler::Call callOperation(J_JITOperation_EJJAp, int, GPRReg, GPRReg, GPRReg, GPRReg, ArrayProfile*);
790         MacroAssembler::Call callOperation(J_JITOperation_EJJBy, int, GPRReg, GPRReg, GPRReg, GPRReg, ByValInfo*);
791         MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t);
792         MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
793         MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
794         MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID, RegisterID);
795         MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID);
796         MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID);
797         MacroAssembler::Call callOperation(V_JITOperation_EJJJAp, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, ArrayProfile*);
798         MacroAssembler::Call callOperation(V_JITOperation_EJJJBy, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, ByValInfo*);
799         MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t);
800         MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, RegisterID, int32_t, RegisterID, RegisterID);
801         MacroAssembler::Call callOperation(V_JITOperation_EZJ, int32_t, RegisterID, RegisterID);
802 #endif
803
804         Jump checkStructure(RegisterID reg, Structure* structure);
805
806         void updateTopCallFrame();
807
808         Call emitNakedCall(CodePtr function = CodePtr());
809
810         // Loads the character value of a single character string into dst.
811         void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures);
812         
813 #if ENABLE(DFG_JIT)
814         void emitEnterOptimizationCheck();
815 #else
816         void emitEnterOptimizationCheck() { }
817 #endif
818
819 #ifndef NDEBUG
820         void printBytecodeOperandTypes(int src1, int src2);
821 #endif
822
823 #if ENABLE(SAMPLING_FLAGS)
824         void setSamplingFlag(int32_t);
825         void clearSamplingFlag(int32_t);
826 #endif
827
828 #if ENABLE(SAMPLING_COUNTERS)
829         void emitCount(AbstractSamplingCounter&, int32_t = 1);
830 #endif
831
832 #if ENABLE(OPCODE_SAMPLING)
833         void sampleInstruction(Instruction*, bool = false);
834 #endif
835
836 #if ENABLE(CODEBLOCK_SAMPLING)
837         void sampleCodeBlock(CodeBlock*);
838 #else
839         void sampleCodeBlock(CodeBlock*) {}
840 #endif
841
842 #if ENABLE(DFG_JIT)
843         bool canBeOptimized() { return m_canBeOptimized; }
844         bool canBeOptimizedOrInlined() { return m_canBeOptimizedOrInlined; }
845         bool shouldEmitProfiling() { return m_shouldEmitProfiling; }
846 #else
847         bool canBeOptimized() { return false; }
848         bool canBeOptimizedOrInlined() { return false; }
849         // Enables use of value profiler with tiered compilation turned off,
850         // in which case all code gets profiled.
851         bool shouldEmitProfiling() { return false; }
852 #endif
853
854         Interpreter* m_interpreter;
855
856         Vector<CallRecord> m_calls;
857         Vector<Label> m_labels;
858         Vector<JITGetByIdGenerator> m_getByIds;
859         Vector<JITPutByIdGenerator> m_putByIds;
860         Vector<ByValCompilationInfo> m_byValCompilationInfo;
861         Vector<CallCompilationInfo> m_callCompilationInfo;
862         Vector<JumpTable> m_jmpTable;
863
864         unsigned m_bytecodeOffset;
865         Vector<SlowCaseEntry> m_slowCases;
866         Vector<SwitchRecord> m_switches;
867
868         JumpList m_exceptionChecks;
869         JumpList m_exceptionChecksWithCallFrameRollback;
870
871         unsigned m_getByIdIndex;
872         unsigned m_putByIdIndex;
873         unsigned m_byValInstructionIndex;
874         unsigned m_callLinkInfoIndex;
875
876         std::unique_ptr<JITDisassembler> m_disassembler;
877         RefPtr<Profiler::Compilation> m_compilation;
878         WeakRandom m_randomGenerator;
879         static CodeRef stringGetByValStubGenerator(VM*);
880
881         bool m_canBeOptimized;
882         bool m_canBeOptimizedOrInlined;
883         bool m_shouldEmitProfiling;
884     } JIT_CLASS_ALIGNMENT;
885
886 } // namespace JSC
887
888 #endif // ENABLE(JIT)
889
890 #endif // JIT_h