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