f54658573ee35c053a1bd7edff437bfaceae63a0
[WebKit-https.git] / Source / JavaScriptCore / jit / JIT.h
1 /*
2  * Copyright (C) 2008, 2012-2016 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 "PCToCodeOriginMap.h"
49 #include "ResultType.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     class StructureStubInfo;
67
68     struct Instruction;
69     struct OperandTypes;
70     struct SimpleJumpTable;
71     struct StringJumpTable;
72
73     struct CallRecord {
74         MacroAssembler::Call from;
75         unsigned bytecodeOffset;
76         void* to;
77
78         CallRecord()
79         {
80         }
81
82         CallRecord(MacroAssembler::Call from, unsigned bytecodeOffset, void* to = 0)
83             : from(from)
84             , bytecodeOffset(bytecodeOffset)
85             , to(to)
86         {
87         }
88     };
89
90     struct JumpTable {
91         MacroAssembler::Jump from;
92         unsigned toBytecodeOffset;
93
94         JumpTable(MacroAssembler::Jump f, unsigned t)
95             : from(f)
96             , toBytecodeOffset(t)
97         {
98         }
99     };
100
101     struct SlowCaseEntry {
102         MacroAssembler::Jump from;
103         unsigned to;
104         
105         SlowCaseEntry(MacroAssembler::Jump f, unsigned t)
106             : from(f)
107             , to(t)
108         {
109         }
110     };
111
112     struct SwitchRecord {
113         enum Type {
114             Immediate,
115             Character,
116             String
117         };
118
119         Type type;
120
121         union {
122             SimpleJumpTable* simpleJumpTable;
123             StringJumpTable* stringJumpTable;
124         } jumpTable;
125
126         unsigned bytecodeOffset;
127         unsigned defaultOffset;
128
129         SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset, Type type)
130             : type(type)
131             , bytecodeOffset(bytecodeOffset)
132             , defaultOffset(defaultOffset)
133         {
134             this->jumpTable.simpleJumpTable = jumpTable;
135         }
136
137         SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset)
138             : type(String)
139             , bytecodeOffset(bytecodeOffset)
140             , defaultOffset(defaultOffset)
141         {
142             this->jumpTable.stringJumpTable = jumpTable;
143         }
144     };
145
146     struct ByValCompilationInfo {
147         ByValCompilationInfo() { }
148         
149         ByValCompilationInfo(ByValInfo* byValInfo, unsigned bytecodeIndex, MacroAssembler::PatchableJump notIndexJump, MacroAssembler::PatchableJump badTypeJump, JITArrayMode arrayMode, ArrayProfile* arrayProfile, MacroAssembler::Label doneTarget, MacroAssembler::Label nextHotPathTarget)
150             : byValInfo(byValInfo)
151             , bytecodeIndex(bytecodeIndex)
152             , notIndexJump(notIndexJump)
153             , badTypeJump(badTypeJump)
154             , arrayMode(arrayMode)
155             , arrayProfile(arrayProfile)
156             , doneTarget(doneTarget)
157             , nextHotPathTarget(nextHotPathTarget)
158         {
159         }
160
161         ByValInfo* byValInfo;
162         unsigned bytecodeIndex;
163         MacroAssembler::PatchableJump notIndexJump;
164         MacroAssembler::PatchableJump badTypeJump;
165         JITArrayMode arrayMode;
166         ArrayProfile* arrayProfile;
167         MacroAssembler::Label doneTarget;
168         MacroAssembler::Label nextHotPathTarget;
169         MacroAssembler::Label slowPathTarget;
170         MacroAssembler::Call returnAddress;
171     };
172
173     struct CallCompilationInfo {
174         MacroAssembler::DataLabelPtr hotPathBegin;
175         MacroAssembler::Call hotPathOther;
176         MacroAssembler::Call callReturnLocation;
177         CallLinkInfo* callLinkInfo;
178     };
179
180     void ctiPatchCallByReturnAddress(ReturnAddressPtr, FunctionPtr newCalleeFunction);
181
182     class JIT : private JSInterfaceJIT {
183         friend class JITSlowPathCall;
184         friend class JITStubCall;
185
186         using MacroAssembler::Jump;
187         using MacroAssembler::JumpList;
188         using MacroAssembler::Label;
189
190         static const uintptr_t patchGetByIdDefaultStructure = unusedPointer;
191         static const int patchGetByIdDefaultOffset = 0;
192         // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler
193         // will compress the displacement, and we may not be able to fit a patched offset.
194         static const int patchPutByIdDefaultOffset = 256;
195
196     public:
197         static CompilationResult compile(VM* vm, CodeBlock* codeBlock, JITCompilationEffort effort)
198         {
199             return JIT(vm, codeBlock).privateCompile(effort);
200         }
201         
202         static void compileGetByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
203         {
204             JIT jit(vm, codeBlock);
205             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
206             jit.privateCompileGetByVal(byValInfo, returnAddress, arrayMode);
207         }
208
209         static void compileGetByValWithCachedId(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, const Identifier& propertyName)
210         {
211             JIT jit(vm, codeBlock);
212             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
213             jit.privateCompileGetByValWithCachedId(byValInfo, returnAddress, propertyName);
214         }
215
216         static void compilePutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
217         {
218             JIT jit(vm, codeBlock);
219             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
220             jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode);
221         }
222         
223         static void compileDirectPutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
224         {
225             JIT jit(vm, codeBlock);
226             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
227             jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode);
228         }
229
230         static void compilePutByValWithCachedId(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, PutKind putKind, const Identifier& propertyName)
231         {
232             JIT jit(vm, codeBlock);
233             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
234             jit.privateCompilePutByValWithCachedId(byValInfo, returnAddress, putKind, propertyName);
235         }
236
237         static void compileHasIndexedProperty(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
238         {
239             JIT jit(vm, codeBlock);
240             jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
241             jit.privateCompileHasIndexedProperty(byValInfo, returnAddress, arrayMode);
242         }
243
244         static CodeRef compileCTINativeCall(VM* vm, NativeFunction func)
245         {
246             if (!vm->canUseJIT()) {
247                 return CodeRef::createLLIntCodeRef(llint_native_call_trampoline);
248             }
249             JIT jit(vm, 0);
250             return jit.privateCompileCTINativeCall(vm, func);
251         }
252
253         static unsigned frameRegisterCountFor(CodeBlock*);
254         static int stackPointerOffsetFor(CodeBlock*);
255
256         JS_EXPORT_PRIVATE static HashMap<CString, double> compileTimeStats();
257
258     private:
259         JIT(VM*, CodeBlock* = 0);
260         ~JIT();
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(const 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(OpcodeID, 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 isOperandConstantDouble(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         void emitGetVirtualRegister(int src, JSValueRegs dst);
405         void emitPutVirtualRegister(int dst, JSValueRegs src);
406
407         int32_t getOperandConstantInt(int src);
408         double getOperandConstantDouble(int src);
409
410 #if USE(JSVALUE32_64)
411         bool getOperandConstantInt(int op1, int op2, int& op, int32_t& constant);
412
413         void emitLoadTag(int index, RegisterID tag);
414         void emitLoadPayload(int index, RegisterID payload);
415
416         void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
417         void emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
418         void emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2);
419
420         void emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
421         void emitStore(int index, const JSValue constant, RegisterID base = callFrameRegister);
422         void emitStoreInt32(int index, RegisterID payload, bool indexIsInt32 = false);
423         void emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32 = false);
424         void emitStoreCell(int index, RegisterID payload, bool indexIsCell = false);
425         void emitStoreBool(int index, RegisterID payload, bool indexIsBool = false);
426         void emitStoreDouble(int index, FPRegisterID value);
427
428         void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex);
429         void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag);
430
431         void compileGetByIdHotPath(const Identifier*);
432
433         // Arithmetic opcode helpers
434         void emitSub32Constant(int dst, int op, int32_t constant, ResultType opType);
435         void emitBinaryDoubleOp(OpcodeID, int dst, int op1, int op2, OperandTypes, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters = true, bool op2IsInRegisters = true);
436
437 #else // USE(JSVALUE32_64)
438         void emitGetVirtualRegister(int src, RegisterID dst);
439         void emitGetVirtualRegister(VirtualRegister src, RegisterID dst);
440         void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2);
441         void emitGetVirtualRegisters(VirtualRegister src1, RegisterID dst1, VirtualRegister src2, RegisterID dst2);
442         void emitPutVirtualRegister(int dst, RegisterID from = regT0);
443         void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0);
444         void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false)
445         {
446             emitPutVirtualRegister(dst, payload);
447         }
448         void emitStoreCell(VirtualRegister dst, RegisterID payload)
449         {
450             emitPutVirtualRegister(dst, payload);
451         }
452
453         Jump emitJumpIfJSCell(RegisterID);
454         Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID);
455         void emitJumpSlowCaseIfJSCell(RegisterID);
456         void emitJumpSlowCaseIfNotJSCell(RegisterID);
457         void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);
458         Jump emitJumpIfInt(RegisterID);
459         Jump emitJumpIfNotInt(RegisterID);
460         Jump emitJumpIfNotInt(RegisterID, RegisterID, RegisterID scratch);
461         PatchableJump emitPatchableJumpIfNotInt(RegisterID);
462         void emitJumpSlowCaseIfNotInt(RegisterID);
463         void emitJumpSlowCaseIfNotNumber(RegisterID);
464         void emitJumpSlowCaseIfNotInt(RegisterID, RegisterID, RegisterID scratch);
465
466         void emitTagBool(RegisterID);
467
468         void compileGetByIdHotPath(int baseVReg, const Identifier*);
469
470 #endif // USE(JSVALUE32_64)
471
472         void emit_compareAndJump(OpcodeID, int op1, int op2, unsigned target, RelationalCondition);
473         void emit_compareAndJumpSlow(int op1, int op2, unsigned target, DoubleCondition, size_t (JIT_OPERATION *operation)(ExecState*, EncodedJSValue, EncodedJSValue), bool invert, Vector<SlowCaseEntry>::iterator&);
474         
475         void assertStackPointerOffset();
476
477         void emit_op_add(Instruction*);
478         void emit_op_bitand(Instruction*);
479         void emit_op_bitor(Instruction*);
480         void emit_op_bitxor(Instruction*);
481         void emit_op_call(Instruction*);
482         void emit_op_tail_call(Instruction*);
483         void emit_op_call_eval(Instruction*);
484         void emit_op_call_varargs(Instruction*);
485         void emit_op_tail_call_varargs(Instruction*);
486         void emit_op_tail_call_forward_arguments(Instruction*);
487         void emit_op_construct_varargs(Instruction*);
488         void emit_op_catch(Instruction*);
489         void emit_op_construct(Instruction*);
490         void emit_op_create_this(Instruction*);
491         void emit_op_to_this(Instruction*);
492         void emit_op_create_direct_arguments(Instruction*);
493         void emit_op_create_scoped_arguments(Instruction*);
494         void emit_op_create_cloned_arguments(Instruction*);
495         void emit_op_argument_count(Instruction*);
496         void emit_op_copy_rest(Instruction*);
497         void emit_op_get_rest_length(Instruction*);
498         void emit_op_check_tdz(Instruction*);
499         void emit_op_assert(Instruction*);
500         void emit_op_save(Instruction*);
501         void emit_op_resume(Instruction*);
502         void emit_op_debug(Instruction*);
503         void emit_op_del_by_id(Instruction*);
504         void emit_op_del_by_val(Instruction*);
505         void emit_op_div(Instruction*);
506         void emit_op_end(Instruction*);
507         void emit_op_enter(Instruction*);
508         void emit_op_get_scope(Instruction*);
509         void emit_op_eq(Instruction*);
510         void emit_op_eq_null(Instruction*);
511         void emit_op_try_get_by_id(Instruction*);
512         void emit_op_get_by_id(Instruction*);
513         void emit_op_get_by_id_with_this(Instruction*);
514         void emit_op_get_by_val_with_this(Instruction*);
515         void emit_op_get_arguments_length(Instruction*);
516         void emit_op_get_by_val(Instruction*);
517         void emit_op_get_argument_by_val(Instruction*);
518         void emit_op_init_lazy_reg(Instruction*);
519         void emit_op_overrides_has_instance(Instruction*);
520         void emit_op_instanceof(Instruction*);
521         void emit_op_instanceof_custom(Instruction*);
522         void emit_op_is_empty(Instruction*);
523         void emit_op_is_undefined(Instruction*);
524         void emit_op_is_boolean(Instruction*);
525         void emit_op_is_number(Instruction*);
526         void emit_op_is_string(Instruction*);
527         void emit_op_is_object(Instruction*);
528         void emit_op_jeq_null(Instruction*);
529         void emit_op_jfalse(Instruction*);
530         void emit_op_jmp(Instruction*);
531         void emit_op_jneq_null(Instruction*);
532         void emit_op_jneq_ptr(Instruction*);
533         void emit_op_jless(Instruction*);
534         void emit_op_jlesseq(Instruction*);
535         void emit_op_jgreater(Instruction*);
536         void emit_op_jgreatereq(Instruction*);
537         void emit_op_jnless(Instruction*);
538         void emit_op_jnlesseq(Instruction*);
539         void emit_op_jngreater(Instruction*);
540         void emit_op_jngreatereq(Instruction*);
541         void emit_op_jtrue(Instruction*);
542         void emit_op_loop_hint(Instruction*);
543         void emit_op_watchdog(Instruction*);
544         void emit_op_lshift(Instruction*);
545         void emit_op_mod(Instruction*);
546         void emit_op_mov(Instruction*);
547         void emit_op_mul(Instruction*);
548         void emit_op_negate(Instruction*);
549         void emit_op_neq(Instruction*);
550         void emit_op_neq_null(Instruction*);
551         void emit_op_new_array(Instruction*);
552         void emit_op_new_array_with_size(Instruction*);
553         void emit_op_new_array_buffer(Instruction*);
554         void emit_op_new_func(Instruction*);
555         void emit_op_new_func_exp(Instruction*);
556         void emit_op_new_generator_func(Instruction*);
557         void emit_op_new_generator_func_exp(Instruction*);
558         void emit_op_new_object(Instruction*);
559         void emit_op_new_regexp(Instruction*);
560         void emit_op_not(Instruction*);
561         void emit_op_nstricteq(Instruction*);
562         void emit_op_dec(Instruction*);
563         void emit_op_inc(Instruction*);
564         void emit_op_profile_type(Instruction*);
565         void emit_op_profile_control_flow(Instruction*);
566         void emit_op_push_with_scope(Instruction*);
567         void emit_op_create_lexical_environment(Instruction*);
568         void emit_op_get_parent_scope(Instruction*);
569         void emit_op_put_by_id(Instruction*);
570         void emit_op_put_by_id_with_this(Instruction*);
571         void emit_op_put_by_index(Instruction*);
572         void emit_op_put_by_val(Instruction*);
573         void emit_op_put_by_val_with_this(Instruction*);
574         void emit_op_put_getter_by_id(Instruction*);
575         void emit_op_put_setter_by_id(Instruction*);
576         void emit_op_put_getter_setter_by_id(Instruction*);
577         void emit_op_put_getter_by_val(Instruction*);
578         void emit_op_put_setter_by_val(Instruction*);
579         void emit_op_ret(Instruction*);
580         void emit_op_rshift(Instruction*);
581         void emit_op_set_function_name(Instruction*);
582         void emit_op_strcat(Instruction*);
583         void emit_op_stricteq(Instruction*);
584         void emit_op_sub(Instruction*);
585         void emit_op_switch_char(Instruction*);
586         void emit_op_switch_imm(Instruction*);
587         void emit_op_switch_string(Instruction*);
588         void emit_op_tear_off_arguments(Instruction*);
589         void emit_op_throw(Instruction*);
590         void emit_op_throw_static_error(Instruction*);
591         void emit_op_to_number(Instruction*);
592         void emit_op_to_string(Instruction*);
593         void emit_op_to_primitive(Instruction*);
594         void emit_op_unexpected_load(Instruction*);
595         void emit_op_unsigned(Instruction*);
596         void emit_op_urshift(Instruction*);
597         void emit_op_get_enumerable_length(Instruction*);
598         void emit_op_has_generic_property(Instruction*);
599         void emit_op_has_structure_property(Instruction*);
600         void emit_op_has_indexed_property(Instruction*);
601         void emit_op_get_direct_pname(Instruction*);
602         void emit_op_get_property_enumerator(Instruction*);
603         void emit_op_enumerator_structure_pname(Instruction*);
604         void emit_op_enumerator_generic_pname(Instruction*);
605         void emit_op_to_index_string(Instruction*);
606         void emit_op_log_shadow_chicken_prologue(Instruction*);
607         void emit_op_log_shadow_chicken_tail(Instruction*);
608
609         void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
610         void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
611         void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&);
612         void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
613         void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
614         void emitSlow_op_tail_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
615         void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
616         void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
617         void emitSlow_op_tail_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
618         void emitSlow_op_tail_call_forward_arguments(Instruction*, Vector<SlowCaseEntry>::iterator&);
619         void emitSlow_op_construct_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
620         void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
621         void emitSlow_op_to_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
622         void emitSlow_op_create_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
623         void emitSlow_op_check_tdz(Instruction*, Vector<SlowCaseEntry>::iterator&);
624         void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
625         void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
626         void emitSlow_op_get_callee(Instruction*, Vector<SlowCaseEntry>::iterator&);
627         void emitSlow_op_try_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
628         void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
629         void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&);
630         void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
631         void emitSlow_op_get_argument_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
632         void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&);
633         void emitSlow_op_instanceof_custom(Instruction*, Vector<SlowCaseEntry>::iterator&);
634         void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&);
635         void emitSlow_op_jless(Instruction*, Vector<SlowCaseEntry>::iterator&);
636         void emitSlow_op_jlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
637         void emitSlow_op_jgreater(Instruction*, Vector<SlowCaseEntry>::iterator&);
638         void emitSlow_op_jgreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
639         void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&);
640         void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
641         void emitSlow_op_jngreater(Instruction*, Vector<SlowCaseEntry>::iterator&);
642         void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
643         void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
644         void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&);
645         void emitSlow_op_watchdog(Instruction*, Vector<SlowCaseEntry>::iterator&);
646         void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
647         void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
648         void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
649         void emitSlow_op_negate(Instruction*, Vector<SlowCaseEntry>::iterator&);
650         void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&);
651         void emitSlow_op_new_object(Instruction*, Vector<SlowCaseEntry>::iterator&);
652         void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
653         void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
654         void emitSlow_op_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
655         void emitSlow_op_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
656         void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
657         void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
658         void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
659         void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
660         void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
661         void emitSlow_op_to_number(Instruction*, Vector<SlowCaseEntry>::iterator&);
662         void emitSlow_op_to_string(Instruction*, Vector<SlowCaseEntry>::iterator&);
663         void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
664         void emitSlow_op_unsigned(Instruction*, Vector<SlowCaseEntry>::iterator&);
665         void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
666         void emitSlow_op_has_indexed_property(Instruction*, Vector<SlowCaseEntry>::iterator&);
667         void emitSlow_op_has_structure_property(Instruction*, Vector<SlowCaseEntry>::iterator&);
668         void emitSlow_op_get_direct_pname(Instruction*, Vector<SlowCaseEntry>::iterator&);
669
670         void emit_op_resolve_scope(Instruction*);
671         void emit_op_get_from_scope(Instruction*);
672         void emit_op_put_to_scope(Instruction*);
673         void emit_op_get_from_arguments(Instruction*);
674         void emit_op_put_to_arguments(Instruction*);
675         void emitSlow_op_resolve_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
676         void emitSlow_op_get_from_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
677         void emitSlow_op_put_to_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
678
679         void emitRightShift(Instruction*, bool isUnsigned);
680         void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
681
682         void emitNewFuncCommon(Instruction*);
683         void emitNewFuncExprCommon(Instruction*);
684         void emitVarInjectionCheck(bool needsVarInjectionChecks);
685         void emitResolveClosure(int dst, int scope, bool needsVarInjectionChecks, unsigned depth);
686         void emitLoadWithStructureCheck(int scope, Structure** structureSlot);
687 #if USE(JSVALUE64)
688         void emitGetVarFromPointer(JSValue* operand, GPRReg);
689         void emitGetVarFromIndirectPointer(JSValue** operand, GPRReg);
690 #else
691         void emitGetVarFromIndirectPointer(JSValue** operand, GPRReg tag, GPRReg payload);
692         void emitGetVarFromPointer(JSValue* operand, GPRReg tag, GPRReg payload);
693 #endif
694         void emitGetClosureVar(int scope, uintptr_t operand);
695         void emitNotifyWrite(WatchpointSet*);
696         void emitNotifyWrite(GPRReg pointerToSet);
697         void emitPutGlobalVariable(JSValue* operand, int value, WatchpointSet*);
698         void emitPutGlobalVariableIndirect(JSValue** addressOfOperand, int value, WatchpointSet**);
699         void emitPutClosureVar(int scope, uintptr_t operand, int value, WatchpointSet*);
700
701         void emitInitRegister(int dst);
702
703         void emitPutIntToCallFrameHeader(RegisterID from, JSStack::CallFrameHeaderEntry);
704
705         JSValue getConstantOperand(int src);
706         bool isOperandConstantInt(int src);
707         bool isOperandConstantChar(int src);
708
709         Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter)
710         {
711             return iter++->from;
712         }
713         void linkSlowCase(Vector<SlowCaseEntry>::iterator& iter)
714         {
715             iter->from.link(this);
716             ++iter;
717         }
718         void linkDummySlowCase(Vector<SlowCaseEntry>::iterator& iter)
719         {
720             ASSERT(!iter->from.isSet());
721             ++iter;
722         }
723         void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex);
724         void linkAllSlowCasesForBytecodeOffset(Vector<SlowCaseEntry>& slowCases,
725             Vector<SlowCaseEntry>::iterator&, unsigned bytecodeOffset);
726
727         MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&);
728 #if OS(WINDOWS) && CPU(X86_64)
729         MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr&);
730 #endif
731         MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&);
732         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int);
733         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr&, int);
734         
735         enum WithProfileTag { WithProfile };
736         
737         MacroAssembler::Call callOperation(C_JITOperation_E);
738         MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg);
739         MacroAssembler::Call callOperation(C_JITOperation_EL, GPRReg);
740         MacroAssembler::Call callOperation(C_JITOperation_EL, TrustedImmPtr);
741         MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*);
742         MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t);
743         MacroAssembler::Call callOperation(Z_JITOperation_EJZZ, GPRReg, int32_t, int32_t);
744         MacroAssembler::Call callOperation(J_JITOperation_E, int);
745         MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg);
746         MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, GPRReg, int32_t);
747         MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, const JSValue*, int32_t);
748         MacroAssembler::Call callOperation(J_JITOperation_EC, int, JSCell*);
749         MacroAssembler::Call callOperation(V_JITOperation_EC, JSCell*);
750         MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg);
751 #if USE(JSVALUE64)
752         MacroAssembler::Call callOperation(J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*);
753         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*);
754 #else
755         MacroAssembler::Call callOperation(J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*);
756         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*);
757 #endif
758         MacroAssembler::Call callOperation(J_JITOperation_EJI, int, GPRReg, UniquedStringImpl*);
759         MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg);
760         MacroAssembler::Call callOperation(J_JITOperation_EJJRp, JSValueRegs, JSValueRegs, JSValueRegs, ResultProfile*);
761         MacroAssembler::Call callOperation(J_JITOperation_EJJAp, int, GPRReg, GPRReg, ArrayProfile*);
762         MacroAssembler::Call callOperation(J_JITOperation_EJJBy, int, GPRReg, GPRReg, ByValInfo*);
763         MacroAssembler::Call callOperation(Z_JITOperation_EJOJ, GPRReg, GPRReg, GPRReg);
764         MacroAssembler::Call callOperation(C_JITOperation_EJsc, GPRReg);
765         MacroAssembler::Call callOperation(J_JITOperation_EJscC, int, GPRReg, JSCell*);
766         MacroAssembler::Call callOperation(J_JITOperation_EJscCJ, int, GPRReg, JSCell*, GPRReg);
767         MacroAssembler::Call callOperation(C_JITOperation_EJscZ, GPRReg, int32_t);
768         MacroAssembler::Call callOperation(C_JITOperation_EJscZ, int, GPRReg, int32_t);
769 #if USE(JSVALUE64)
770         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg);
771 #else
772         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
773 #endif
774         MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
775         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EPc, int, Instruction*);
776         MacroAssembler::Call callOperation(J_JITOperation_EPc, int, Instruction*);
777         MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
778         MacroAssembler::Call callOperation(J_JITOperation_EZZ, int, int32_t, int32_t);
779         MacroAssembler::Call callOperation(P_JITOperation_E);
780         MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
781         MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
782         MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);
783         MacroAssembler::Call callOperation(S_JITOperation_EJI, GPRReg, UniquedStringImpl*);
784         MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID);
785         MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID);
786         MacroAssembler::Call callOperation(Sprt_JITOperation_EZ, int32_t);
787         MacroAssembler::Call callOperation(V_JITOperation_E);
788         MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID);
789         MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);
790         MacroAssembler::Call callOperation(V_JITOperation_ECIZC, RegisterID, UniquedStringImpl*, int32_t, RegisterID);
791         MacroAssembler::Call callOperation(V_JITOperation_ECIZCC, RegisterID, UniquedStringImpl*, int32_t, RegisterID, RegisterID);
792 #if USE(JSVALUE64)
793         MacroAssembler::Call callOperation(V_JITOperation_ECJZC, RegisterID, RegisterID, int32_t, RegisterID);
794 #else
795         MacroAssembler::Call callOperation(V_JITOperation_ECJZC, RegisterID, RegisterID, RegisterID, int32_t, RegisterID);
796 #endif
797         MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID);
798         MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
799         MacroAssembler::Call callOperation(J_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
800         MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
801         MacroAssembler::Call callOperationNoExceptionCheck(Z_JITOperation_E);
802 #if USE(JSVALUE64)
803         MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID);
804 #else
805         MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID, RegisterID);
806 #endif
807 #if USE(JSVALUE64)
808         MacroAssembler::Call callOperation(F_JITOperation_EFJZZ, RegisterID, RegisterID, int32_t, RegisterID);
809         MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, UniquedStringImpl*);
810         MacroAssembler::Call callOperation(V_JITOperation_ECIZJJ, RegisterID, UniquedStringImpl*, int32_t, RegisterID, RegisterID);
811         MacroAssembler::Call callOperation(V_JITOperation_ECJ, RegisterID, RegisterID);
812 #else
813         MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, RegisterID, RegisterID, UniquedStringImpl*);
814         MacroAssembler::Call callOperation(V_JITOperation_ECJ, RegisterID, RegisterID, RegisterID);
815 #endif
816         MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID);
817         MacroAssembler::Call callOperation(V_JITOperation_EJJJAp, RegisterID, RegisterID, RegisterID, ArrayProfile*);
818         MacroAssembler::Call callOperation(V_JITOperation_EJJJBy, RegisterID, RegisterID, RegisterID, ByValInfo*);
819         MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, int32_t, RegisterID);
820         MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, int32_t);
821         MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*);
822         MacroAssembler::Call callOperation(V_JITOperation_EZ, int32_t);
823         MacroAssembler::Call callOperation(V_JITOperation_EZJ, int, GPRReg);
824         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E);
825         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*);
826         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E);
827 #if USE(JSVALUE32_64)
828         MacroAssembler::Call callOperation(F_JITOperation_EFJZZ, RegisterID, RegisterID, RegisterID, int32_t, RegisterID);
829         MacroAssembler::Call callOperation(Z_JITOperation_EJZZ, GPRReg, GPRReg, int32_t, int32_t);
830         MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg);
831         MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg, GPRReg);
832         MacroAssembler::Call callOperation(J_JITOperation_EJI, int, GPRReg, GPRReg, UniquedStringImpl*);
833         MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
834         MacroAssembler::Call callOperation(Z_JITOperation_EJOJ, GPRReg, GPRReg, GPRReg, GPRReg, GPRReg);
835         MacroAssembler::Call callOperation(J_JITOperation_EJJAp, int, GPRReg, GPRReg, GPRReg, GPRReg, ArrayProfile*);
836         MacroAssembler::Call callOperation(J_JITOperation_EJJBy, int, GPRReg, GPRReg, GPRReg, GPRReg, ByValInfo*);
837         MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t);
838         MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
839         MacroAssembler::Call callOperation(S_JITOperation_EJI, GPRReg, GPRReg, UniquedStringImpl*);
840         MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
841         MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID, RegisterID);
842         MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID);
843         MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID);
844         MacroAssembler::Call callOperation(V_JITOperation_EJJJAp, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, ArrayProfile*);
845         MacroAssembler::Call callOperation(V_JITOperation_EJJJBy, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, ByValInfo*);
846         MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t);
847         MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, RegisterID, int32_t, RegisterID, RegisterID);
848         MacroAssembler::Call callOperation(V_JITOperation_EZJ, int32_t, RegisterID, RegisterID);
849         MacroAssembler::Call callOperation(J_JITOperation_EJscCJ, int, GPRReg, JSCell*, GPRReg, GPRReg);
850 #endif
851
852         template<typename SnippetGenerator>
853         void emitBitBinaryOpFastPath(Instruction* currentInstruction);
854
855         void emitRightShiftFastPath(Instruction* currentInstruction, OpcodeID);
856
857         Jump checkStructure(RegisterID reg, Structure* structure);
858
859         void updateTopCallFrame();
860
861         Call emitNakedCall(CodePtr function = CodePtr());
862         Call emitNakedTailCall(CodePtr function = CodePtr());
863
864         // Loads the character value of a single character string into dst.
865         void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures);
866         
867 #if ENABLE(DFG_JIT)
868         void emitEnterOptimizationCheck();
869 #else
870         void emitEnterOptimizationCheck() { }
871 #endif
872
873 #ifndef NDEBUG
874         void printBytecodeOperandTypes(int src1, int src2);
875 #endif
876
877 #if ENABLE(SAMPLING_FLAGS)
878         void setSamplingFlag(int32_t);
879         void clearSamplingFlag(int32_t);
880 #endif
881
882 #if ENABLE(SAMPLING_COUNTERS)
883         void emitCount(AbstractSamplingCounter&, int32_t = 1);
884 #endif
885
886 #if ENABLE(OPCODE_SAMPLING)
887         void sampleInstruction(Instruction*, bool = false);
888 #endif
889
890 #if ENABLE(CODEBLOCK_SAMPLING)
891         void sampleCodeBlock(CodeBlock*);
892 #else
893         void sampleCodeBlock(CodeBlock*) {}
894 #endif
895
896 #if ENABLE(DFG_JIT)
897         bool canBeOptimized() { return m_canBeOptimized; }
898         bool canBeOptimizedOrInlined() { return m_canBeOptimizedOrInlined; }
899         bool shouldEmitProfiling() { return m_shouldEmitProfiling; }
900 #else
901         bool canBeOptimized() { return false; }
902         bool canBeOptimizedOrInlined() { return false; }
903         // Enables use of value profiler with tiered compilation turned off,
904         // in which case all code gets profiled.
905         bool shouldEmitProfiling() { return false; }
906 #endif
907
908         static bool reportCompileTimes();
909         static bool computeCompileTimes();
910
911         Interpreter* m_interpreter;
912
913         Vector<CallRecord> m_calls;
914         Vector<Label> m_labels;
915         Vector<JITGetByIdGenerator> m_getByIds;
916         Vector<JITPutByIdGenerator> m_putByIds;
917         Vector<ByValCompilationInfo> m_byValCompilationInfo;
918         Vector<CallCompilationInfo> m_callCompilationInfo;
919         Vector<JumpTable> m_jmpTable;
920
921         unsigned m_bytecodeOffset;
922         Vector<SlowCaseEntry> m_slowCases;
923         Vector<SwitchRecord> m_switches;
924
925         JumpList m_exceptionChecks;
926         JumpList m_exceptionChecksWithCallFrameRollback;
927
928         unsigned m_getByIdIndex;
929         unsigned m_putByIdIndex;
930         unsigned m_byValInstructionIndex;
931         unsigned m_callLinkInfoIndex;
932
933         std::unique_ptr<JITDisassembler> m_disassembler;
934         RefPtr<Profiler::Compilation> m_compilation;
935         WeakRandom m_randomGenerator;
936         static CodeRef stringGetByValStubGenerator(VM*);
937
938         PCToCodeOriginMapBuilder m_pcToCodeOriginMapBuilder;
939
940         bool m_canBeOptimized;
941         bool m_canBeOptimizedOrInlined;
942         bool m_shouldEmitProfiling;
943     } JIT_CLASS_ALIGNMENT;
944
945 } // namespace JSC
946
947 #endif // ENABLE(JIT)
948
949 #endif // JIT_h