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