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