blob: fe8503e79488cb7dab8f8d4ac43602b304c352d1 [file] [log] [blame]
mrowe@apple.comf88a4632008-09-07 05:44:58 +00001/*
fpizlo@apple.com947ec622013-01-02 08:48:18 +00002 * Copyright (C) 2008, 2012, 2013 Apple Inc. All rights reserved.
mrowe@apple.comf88a4632008-09-07 05:44:58 +00003 *
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
ggaren@apple.comcc0f1f12008-11-17 23:16:00 +000026#ifndef JIT_h
27#define JIT_h
mrowe@apple.comf88a4632008-09-07 05:44:58 +000028
ggaren@apple.comf272d2d2008-11-17 04:25:37 +000029#if ENABLE(JIT)
mrowe@apple.comf88a4632008-09-07 05:44:58 +000030
barraclough@apple.com433cd152009-05-13 00:27:24 +000031// 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)
34#define JIT_CLASS_ALIGNMENT __attribute__ ((aligned (32)))
35#else
36#define JIT_CLASS_ALIGNMENT
37#endif
38
xan@webkit.org773abaf2011-02-21 21:14:57 +000039#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));
barraclough@apple.com71c5a9a2009-10-28 07:13:37 +000040
ggaren@apple.comd8fccca2009-05-08 20:51:53 +000041#include "CodeBlock.h"
fpizlo@apple.com7f6c6802011-09-13 01:33:43 +000042#include "CompactJITCodeMap.h"
ggaren@apple.com901a8a22008-11-17 20:57:18 +000043#include "Interpreter.h"
fpizlo@apple.com1949f322012-11-22 00:46:57 +000044#include "JITDisassembler.h"
fpizlo@apple.com5ba07882013-10-19 23:13:23 +000045#include "JITInlineCacheGenerator.h"
oliver@apple.comec0e4002010-04-27 03:45:47 +000046#include "JSInterfaceJIT.h"
fpizlo@apple.com77ea29a2012-12-04 22:30:28 +000047#include "LegacyProfiler.h"
mrowe@apple.comf88a4632008-09-07 05:44:58 +000048#include "Opcode.h"
ossy@webkit.org7269f912013-02-18 07:18:56 +000049#include "ResultType.h"
ap@apple.com94163232013-10-20 00:01:17 +000050#include "SamplingTool.h"
msaboff@apple.comec1cd572012-12-20 23:20:30 +000051#include "UnusedPointer.h"
mrowe@apple.comf88a4632008-09-07 05:44:58 +000052
cwzwarich@webkit.org3f782f62008-09-08 01:28:33 +000053namespace JSC {
mrowe@apple.comf88a4632008-09-07 05:44:58 +000054
mark.lam@apple.com5d7e7082013-10-11 19:03:39 +000055 class ArrayAllocationProfile;
mrowe@apple.comf88a4632008-09-07 05:44:58 +000056 class CodeBlock;
oliver@apple.come843bc02011-08-05 20:03:19 +000057 class FunctionExecutable;
ggaren@apple.comd8fccca2009-05-08 20:51:53 +000058 class JIT;
mrowe@apple.comf88a4632008-09-07 05:44:58 +000059 class JSPropertyNameIterator;
mark.lam@apple.com03944a02013-10-14 16:42:22 +000060 class Identifier;
ggaren@apple.com031563e2008-11-17 02:21:16 +000061 class Interpreter;
ggaren@apple.comb11e7872012-08-30 22:50:00 +000062 class JSScope;
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +000063 class JSStack;
ggaren@apple.comc862eac2013-01-29 05:48:01 +000064 class MarkedAllocator;
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +000065 class Register;
darin@apple.coma9778f92008-11-16 04:40:06 +000066 class StructureChain;
darin@apple.com5a494422008-10-18 23:08:12 +000067
barraclough@apple.come9642652008-10-23 22:29:54 +000068 struct CallLinkInfo;
mrowe@apple.comf88a4632008-09-07 05:44:58 +000069 struct Instruction;
barraclough@apple.comb8b15e22008-09-27 01:44:15 +000070 struct OperandTypes;
barraclough@apple.combc0fea62008-11-22 03:34:43 +000071 struct PolymorphicAccessStructureList;
levin@chromium.org93604aa2009-07-29 08:04:19 +000072 struct SimpleJumpTable;
73 struct StringJumpTable;
barraclough@apple.comf5f74822008-11-21 05:04:19 +000074 struct StructureStubInfo;
mrowe@apple.comf88a4632008-09-07 05:44:58 +000075
mrowe@apple.comf88a4632008-09-07 05:44:58 +000076 struct CallRecord {
barraclough@apple.com8c4ea6b2009-02-11 04:57:08 +000077 MacroAssembler::Call from;
ggaren@apple.com1ba49812010-05-19 18:28:54 +000078 unsigned bytecodeOffset;
barraclough@apple.com249befb2008-12-13 03:18:10 +000079 void* to;
mrowe@apple.comf88a4632008-09-07 05:44:58 +000080
81 CallRecord()
82 {
83 }
84
ggaren@apple.com1ba49812010-05-19 18:28:54 +000085 CallRecord(MacroAssembler::Call from, unsigned bytecodeOffset, void* to = 0)
barraclough@apple.com249befb2008-12-13 03:18:10 +000086 : from(from)
ggaren@apple.com1ba49812010-05-19 18:28:54 +000087 , bytecodeOffset(bytecodeOffset)
barraclough@apple.com249befb2008-12-13 03:18:10 +000088 , to(to)
ggaren@apple.com107bd0e2008-09-24 00:27:18 +000089 {
90 }
mrowe@apple.comf88a4632008-09-07 05:44:58 +000091 };
92
barraclough@apple.coma2a2e132008-12-13 23:58:58 +000093 struct JumpTable {
94 MacroAssembler::Jump from;
ggaren@apple.com1ba49812010-05-19 18:28:54 +000095 unsigned toBytecodeOffset;
barraclough@apple.coma2a2e132008-12-13 23:58:58 +000096
97 JumpTable(MacroAssembler::Jump f, unsigned t)
mrowe@apple.comf88a4632008-09-07 05:44:58 +000098 : from(f)
ggaren@apple.com1ba49812010-05-19 18:28:54 +000099 , toBytecodeOffset(t)
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000100 {
101 }
102 };
103
104 struct SlowCaseEntry {
barraclough@apple.com4f46a502008-12-13 01:39:38 +0000105 MacroAssembler::Jump from;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000106 unsigned to;
107 unsigned hint;
108
barraclough@apple.com4f46a502008-12-13 01:39:38 +0000109 SlowCaseEntry(MacroAssembler::Jump f, unsigned t, unsigned h = 0)
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000110 : from(f)
111 , to(t)
112 , hint(h)
113 {
114 }
115 };
116
117 struct SwitchRecord {
118 enum Type {
119 Immediate,
120 Character,
121 String
122 };
123
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000124 Type type;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000125
126 union {
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000127 SimpleJumpTable* simpleJumpTable;
128 StringJumpTable* stringJumpTable;
129 } jumpTable;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000130
ggaren@apple.com1ba49812010-05-19 18:28:54 +0000131 unsigned bytecodeOffset;
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000132 unsigned defaultOffset;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000133
ggaren@apple.com1ba49812010-05-19 18:28:54 +0000134 SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset, Type type)
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000135 : type(type)
ggaren@apple.com1ba49812010-05-19 18:28:54 +0000136 , bytecodeOffset(bytecodeOffset)
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000137 , defaultOffset(defaultOffset)
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000138 {
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000139 this->jumpTable.simpleJumpTable = jumpTable;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000140 }
141
ggaren@apple.com1ba49812010-05-19 18:28:54 +0000142 SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset)
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000143 : type(String)
ggaren@apple.com1ba49812010-05-19 18:28:54 +0000144 , bytecodeOffset(bytecodeOffset)
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000145 , defaultOffset(defaultOffset)
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000146 {
cwzwarich@webkit.orge8827732008-11-11 18:31:51 +0000147 this->jumpTable.stringJumpTable = jumpTable;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000148 }
149 };
150
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000151 struct ByValCompilationInfo {
152 ByValCompilationInfo() { }
153
154 ByValCompilationInfo(unsigned bytecodeIndex, MacroAssembler::PatchableJump badTypeJump, JITArrayMode arrayMode, MacroAssembler::Label doneTarget)
155 : bytecodeIndex(bytecodeIndex)
156 , badTypeJump(badTypeJump)
157 , arrayMode(arrayMode)
158 , doneTarget(doneTarget)
159 {
160 }
161
162 unsigned bytecodeIndex;
163 MacroAssembler::PatchableJump badTypeJump;
164 JITArrayMode arrayMode;
165 MacroAssembler::Label doneTarget;
166 MacroAssembler::Label slowPathTarget;
167 MacroAssembler::Call returnAddress;
168 };
169
barraclough@apple.com71500d52008-09-15 02:18:13 +0000170 struct StructureStubCompilationInfo {
barraclough@apple.com289318a2008-12-22 01:00:07 +0000171 MacroAssembler::DataLabelPtr hotPathBegin;
barraclough@apple.com8c4ea6b2009-02-11 04:57:08 +0000172 MacroAssembler::Call hotPathOther;
173 MacroAssembler::Call callReturnLocation;
ggaren@apple.com539d1bb2011-11-14 19:21:40 +0000174 CallLinkInfo::CallType callType;
oliver@apple.com1386ec92011-10-07 18:39:45 +0000175 unsigned bytecodeIndex;
barraclough@apple.com71500d52008-09-15 02:18:13 +0000176 };
177
barraclough@apple.com97bacef2009-06-05 07:55:38 +0000178 // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions.
barraclough@apple.com1444b282009-07-22 22:17:10 +0000179 void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
180 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
181 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction);
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000182
oliver@apple.comec0e4002010-04-27 03:45:47 +0000183 class JIT : private JSInterfaceJIT {
oliver@apple.com7ca71432013-07-25 04:02:44 +0000184 friend class JITSlowPathCall;
ggaren@apple.comd8fccca2009-05-08 20:51:53 +0000185 friend class JITStubCall;
ggaren@apple.comd8fccca2009-05-08 20:51:53 +0000186
barraclough@apple.comd13288c2008-12-05 23:57:43 +0000187 using MacroAssembler::Jump;
188 using MacroAssembler::JumpList;
189 using MacroAssembler::Label;
190
msaboff@apple.comec1cd572012-12-20 23:20:30 +0000191 static const uintptr_t patchGetByIdDefaultStructure = unusedPointer;
oliver@apple.com2c012fa2011-05-17 20:02:41 +0000192 static const int patchGetByIdDefaultOffset = 0;
barraclough@apple.com71500d52008-09-15 02:18:13 +0000193 // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler
weinig@apple.com76b0f8a2008-12-22 21:21:18 +0000194 // will compress the displacement, and we may not be able to fit a patched offset.
oliver@apple.com2c012fa2011-05-17 20:02:41 +0000195 static const int patchPutByIdDefaultOffset = 256;
barraclough@apple.com71500d52008-09-15 02:18:13 +0000196
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000197 public:
fpizlo@apple.com1342e7a2013-08-29 19:28:55 +0000198 static CompilationResult compile(VM* vm, CodeBlock* codeBlock, JITCompilationEffort effort)
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000199 {
fpizlo@apple.com1342e7a2013-08-29 19:28:55 +0000200 return JIT(vm, codeBlock).privateCompile(effort);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000201 }
fpizlo@apple.com947ec622013-01-02 08:48:18 +0000202
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000203 static void compileClosureCall(VM* vm, CallLinkInfo* callLinkInfo, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, Structure* expectedStructure, ExecutableBase* expectedExecutable, MacroAssemblerCodePtr codePtr)
fpizlo@apple.com947ec622013-01-02 08:48:18 +0000204 {
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000205 JIT jit(vm, callerCodeBlock);
fpizlo@apple.com947ec622013-01-02 08:48:18 +0000206 jit.m_bytecodeOffset = callLinkInfo->codeOrigin.bytecodeIndex;
207 jit.privateCompileClosureCall(callLinkInfo, calleeCodeBlock, expectedStructure, expectedExecutable, codePtr);
208 }
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000209
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000210 static void compileGetByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000211 {
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000212 JIT jit(vm, codeBlock);
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000213 jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
214 jit.privateCompileGetByVal(byValInfo, returnAddress, arrayMode);
215 }
216
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000217 static void compilePutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000218 {
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000219 JIT jit(vm, codeBlock);
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000220 jit.m_bytecodeOffset = byValInfo->bytecodeIndex;
221 jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode);
222 }
oliver@apple.come050d642013-10-19 00:09:28 +0000223
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 }
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000230
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000231 static CodeRef compileCTINativeCall(VM* vm, NativeFunction func)
barraclough@apple.com8cc46692010-05-19 06:04:18 +0000232 {
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000233 if (!vm->canUseJIT()) {
fpizlo@apple.come6e29a6f2012-03-06 06:54:23 +0000234#if ENABLE(LLINT)
235 return CodeRef::createLLIntCodeRef(llint_native_call_trampoline);
236#else
fpizlo@apple.come6a7f5f2011-09-11 05:49:36 +0000237 return CodeRef();
fpizlo@apple.come6e29a6f2012-03-06 06:54:23 +0000238#endif
239 }
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000240 JIT jit(vm, 0);
241 return jit.privateCompileCTINativeCall(vm, func);
barraclough@apple.com8cc46692010-05-19 06:04:18 +0000242 }
243
msaboff@apple.com95894332014-01-29 19:18:54 +0000244 static unsigned frameRegisterCountFor(CodeBlock*);
245 static int stackPointerOffsetFor(CodeBlock*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000246
247 private:
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000248 JIT(VM*, CodeBlock* = 0);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000249
250 void privateCompileMainPass();
251 void privateCompileLinkPass();
252 void privateCompileSlowCases();
fpizlo@apple.com1342e7a2013-08-29 19:28:55 +0000253 CompilationResult privateCompile(JITCompilationEffort);
fpizlo@apple.com33fbf1f2012-11-05 03:13:26 +0000254
fpizlo@apple.com947ec622013-01-02 08:48:18 +0000255 void privateCompileClosureCall(CallLinkInfo*, CodeBlock* calleeCodeBlock, Structure*, ExecutableBase*, MacroAssemblerCodePtr);
256
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000257 void privateCompileGetByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode);
258 void privateCompilePutByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000259
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000260 Label privateCompileCTINativeCall(VM*, bool isConstruct = false);
261 CodeRef privateCompileCTINativeCall(VM*, NativeFunction);
barraclough@apple.comce1490e2010-08-26 23:21:24 +0000262 void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000263
msaboff@apple.coma482c542013-10-04 18:20:40 +0000264 // Add a call out from JIT code, without an exception check.
265 Call appendCall(const FunctionPtr& function)
266 {
267 Call functionCall = call();
268 m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value()));
269 return functionCall;
270 }
271
msaboff@apple.com8f4bb0c2013-10-02 23:33:46 +0000272 void exceptionCheck(Jump jumpToHandler)
273 {
274 m_exceptionChecks.append(jumpToHandler);
275 }
276
277 void exceptionCheck()
278 {
279 m_exceptionChecks.append(emitExceptionCheck());
280 }
281
msaboff@apple.com5ca16c42013-10-07 18:20:27 +0000282 void exceptionCheckWithCallFrameRollback()
283 {
284 m_exceptionChecksWithCallFrameRollback.append(emitExceptionCheck());
285 }
286
msaboff@apple.com8f4bb0c2013-10-02 23:33:46 +0000287 void privateCompileExceptionHandlers();
288
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000289 void addSlowCase(Jump);
290 void addSlowCase(JumpList);
fpizlo@apple.com9b0b31e2011-09-19 22:27:38 +0000291 void addSlowCase();
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000292 void addJump(Jump, int);
293 void emitJumpSlowToHot(Jump, int);
294
ggaren@apple.com539d1bb2011-11-14 19:21:40 +0000295 void compileOpCall(OpcodeID, Instruction*, unsigned callLinkInfoIndex);
296 void compileOpCallSlowCase(OpcodeID, Instruction*, Vector<SlowCaseEntry>::iterator&, unsigned callLinkInfoIndex);
297 void compileLoadVarargs(Instruction*);
oliver@apple.comcf0e6c42013-07-25 04:01:45 +0000298 void compileCallEval(Instruction*);
299 void compileCallEvalSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&);
300 void emitPutCallResult(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000301
302 enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
303 void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000304 bool isOperandConstantImmediateDouble(int src);
oliver@apple.com8d181632009-09-25 02:40:59 +0000305
ggaren@apple.come1e45912011-11-14 19:44:32 +0000306 void emitLoadDouble(int index, FPRegisterID value);
307 void emitLoadInt32ToDouble(int index, FPRegisterID value);
barraclough@apple.comb8bcc942011-09-07 17:55:50 +0000308 Jump emitJumpIfNotObject(RegisterID structureReg);
oliver@apple.com8d181632009-09-25 02:40:59 +0000309
fpizlo@apple.com33fbf1f2012-11-05 03:13:26 +0000310 Jump addStructureTransitionCheck(JSCell*, Structure*, StructureStubInfo*, RegisterID scratch);
311 void addStructureTransitionCheck(JSCell*, Structure*, StructureStubInfo*, JumpList& failureCases, RegisterID scratch);
312 void testPrototype(JSValue, JumpList& failureCases, StructureStubInfo*);
ggaren@apple.com9dc3ab7a2009-10-19 22:59:41 +0000313
mhahnenberg@apple.com2ceb9d72013-12-20 00:49:58 +0000314 enum WriteBarrierMode { UnconditionalWriteBarrier, ShouldFilterValue, ShouldFilterBaseAndValue };
oliver@apple.com0cae6932011-09-23 22:05:24 +0000315 // value register in write barrier is used before any scratch registers
316 // so may safely be the same as either of the scratch registers.
mhahnenberg@apple.com2ceb9d72013-12-20 00:49:58 +0000317 Jump checkMarkWord(RegisterID owner, RegisterID scratch1, RegisterID scratch2);
318 Jump checkMarkWord(JSCell* owner);
319 void emitWriteBarrier(unsigned owner, unsigned value, WriteBarrierMode);
320 void emitWriteBarrier(JSCell* owner, unsigned value, WriteBarrierMode);
321/*
322 void emitWriteBarrier(RegisterID owner, RegisterID valueTag, RegisterID scratch1, RegisterID scratch2, WriteBarrierMode);
323 void emitWriteBarrier(JSCell* owner, RegisterID value, WriteBarrierMode);
324*/
oliver@apple.come843bc02011-08-05 20:03:19 +0000325
ggaren@apple.comc862eac2013-01-29 05:48:01 +0000326 template<typename StructureType> // StructureType can be RegisterID or ImmPtr.
327 void emitAllocateJSObject(RegisterID allocator, StructureType, RegisterID result, RegisterID scratch);
fpizlo@apple.com95a9f0d2011-08-20 02:17:49 +0000328
fpizlo@apple.com95a9f0d2011-08-20 02:17:49 +0000329 // This assumes that the value to profile is in regT0 and that regT3 is available for
330 // scratch.
fpizlo@apple.comba833642014-01-06 20:41:32 +0000331 void emitValueProfilingSite(ValueProfile*);
332 void emitValueProfilingSite(unsigned bytecodeOffset);
333 void emitValueProfilingSite();
fpizlo@apple.comc7be5be02012-09-17 19:07:32 +0000334 void emitArrayProfilingSite(RegisterID structureAndIndexingType, RegisterID scratch, ArrayProfile*);
335 void emitArrayProfilingSiteForBytecodeIndex(RegisterID structureAndIndexingType, RegisterID scratch, unsigned bytecodeIndex);
fpizlo@apple.com69e27842012-09-19 21:43:10 +0000336 void emitArrayProfileStoreToHoleSpecialCase(ArrayProfile*);
fpizlo@apple.com304fbca2012-12-17 21:38:51 +0000337 void emitArrayProfileOutOfBoundsSpecialCase(ArrayProfile*);
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000338
339 JITArrayMode chooseArrayMode(ArrayProfile*);
340
341 // Property is in regT1, base is in regT0. regT2 contains indexing type.
342 // Property is int-checked and zero extended. Base is cell checked.
343 // Structure is already profiled. Returns the slow cases. Fall-through
344 // case contains result in regT0, and it is not yet profiled.
fpizlo@apple.com75c91a72012-11-08 22:28:25 +0000345 JumpList emitInt32GetByVal(Instruction* instruction, PatchableJump& badType) { return emitContiguousGetByVal(instruction, badType, Int32Shape); }
346 JumpList emitDoubleGetByVal(Instruction*, PatchableJump& badType);
347 JumpList emitContiguousGetByVal(Instruction*, PatchableJump& badType, IndexingType expectedShape = ContiguousShape);
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000348 JumpList emitArrayStorageGetByVal(Instruction*, PatchableJump& badType);
fpizlo@apple.com0e0d9312013-08-15 20:43:06 +0000349 JumpList emitIntTypedArrayGetByVal(Instruction*, PatchableJump& badType, TypedArrayType);
350 JumpList emitFloatTypedArrayGetByVal(Instruction*, PatchableJump& badType, TypedArrayType);
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000351
352 // Property is in regT0, base is in regT0. regT2 contains indecing type.
353 // The value to store is not yet loaded. Property is int-checked and
354 // zero-extended. Base is cell checked. Structure is already profiled.
355 // returns the slow cases.
fpizlo@apple.com75c91a72012-11-08 22:28:25 +0000356 JumpList emitInt32PutByVal(Instruction* currentInstruction, PatchableJump& badType)
357 {
ossy@webkit.org2460fa12012-11-14 16:18:10 +0000358 return emitGenericContiguousPutByVal(currentInstruction, badType, Int32Shape);
fpizlo@apple.com75c91a72012-11-08 22:28:25 +0000359 }
360 JumpList emitDoublePutByVal(Instruction* currentInstruction, PatchableJump& badType)
361 {
ossy@webkit.org2460fa12012-11-14 16:18:10 +0000362 return emitGenericContiguousPutByVal(currentInstruction, badType, DoubleShape);
fpizlo@apple.com75c91a72012-11-08 22:28:25 +0000363 }
364 JumpList emitContiguousPutByVal(Instruction* currentInstruction, PatchableJump& badType)
365 {
ossy@webkit.org2460fa12012-11-14 16:18:10 +0000366 return emitGenericContiguousPutByVal(currentInstruction, badType);
fpizlo@apple.com75c91a72012-11-08 22:28:25 +0000367 }
ossy@webkit.org2460fa12012-11-14 16:18:10 +0000368 JumpList emitGenericContiguousPutByVal(Instruction*, PatchableJump& badType, IndexingType indexingShape = ContiguousShape);
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000369 JumpList emitArrayStoragePutByVal(Instruction*, PatchableJump& badType);
fpizlo@apple.com0e0d9312013-08-15 20:43:06 +0000370 JumpList emitIntTypedArrayPutByVal(Instruction*, PatchableJump& badType, TypedArrayType);
371 JumpList emitFloatTypedArrayPutByVal(Instruction*, PatchableJump& badType, TypedArrayType);
fpizlo@apple.comc14c8d32012-10-10 02:14:42 +0000372
fpizlo@apple.comd68b1f82012-07-05 22:55:51 +0000373 enum FinalObjectMode { MayBeFinal, KnownNotFinal };
374
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000375#if USE(JSVALUE32_64)
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000376 bool getOperandConstantImmediateInt(int op1, int op2, int& op, int32_t& constant);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000377
ggaren@apple.come1e45912011-11-14 19:44:32 +0000378 void emitLoadTag(int index, RegisterID tag);
379 void emitLoadPayload(int index, RegisterID payload);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000380
381 void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
ggaren@apple.come1e45912011-11-14 19:44:32 +0000382 void emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
383 void emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000384
ggaren@apple.come1e45912011-11-14 19:44:32 +0000385 void emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
386 void emitStore(int index, const JSValue constant, RegisterID base = callFrameRegister);
387 void emitStoreInt32(int index, RegisterID payload, bool indexIsInt32 = false);
388 void emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32 = false);
ggaren@apple.come1e45912011-11-14 19:44:32 +0000389 void emitStoreCell(int index, RegisterID payload, bool indexIsCell = false);
390 void emitStoreBool(int index, RegisterID payload, bool indexIsBool = false);
391 void emitStoreDouble(int index, FPRegisterID value);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000392
ggaren@apple.come1e45912011-11-14 19:44:32 +0000393 void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex);
394 void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000395
oliver@apple.com9b652762013-08-12 22:39:13 +0000396 void compileGetByIdHotPath(const Identifier*);
fpizlo@apple.comd68b1f82012-07-05 22:55:51 +0000397 void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset);
398 void compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset);
399 void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset, FinalObjectMode = MayBeFinal);
400 void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, PropertyOffset cachedOffset);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000401
402 // Arithmetic opcode helpers
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000403 void emitAdd32Constant(int dst, int op, int32_t constant, ResultType opType);
404 void emitSub32Constant(int dst, int op, int32_t constant, ResultType opType);
405 void emitBinaryDoubleOp(OpcodeID, int dst, int op1, int op2, OperandTypes, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters = true, bool op2IsInRegisters = true);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000406
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000407#else // USE(JSVALUE32_64)
408 void emitGetVirtualRegister(int src, RegisterID dst);
msaboff@apple.com62aa8b72013-09-26 22:53:54 +0000409 void emitGetVirtualRegister(VirtualRegister src, RegisterID dst);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000410 void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2);
msaboff@apple.com62aa8b72013-09-26 22:53:54 +0000411 void emitGetVirtualRegisters(VirtualRegister src1, RegisterID dst1, VirtualRegister src2, RegisterID dst2);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000412 void emitPutVirtualRegister(int dst, RegisterID from = regT0);
msaboff@apple.com62aa8b72013-09-26 22:53:54 +0000413 void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000414 void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false)
oliver@apple.come843bc02011-08-05 20:03:19 +0000415 {
416 emitPutVirtualRegister(dst, payload);
417 }
mark.lam@apple.com03944a02013-10-14 16:42:22 +0000418 void emitStoreCell(VirtualRegister dst, RegisterID payload)
419 {
420 emitPutVirtualRegister(dst, payload);
421 }
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000422
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000423 int32_t getConstantOperandImmediateInt(int src);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000424
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000425 Jump emitJumpIfJSCell(RegisterID);
426 Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID);
427 void emitJumpSlowCaseIfJSCell(RegisterID);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000428 void emitJumpSlowCaseIfNotJSCell(RegisterID);
429 void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);
barraclough@apple.comb8bcc942011-09-07 17:55:50 +0000430 Jump emitJumpIfImmediateInteger(RegisterID);
431 Jump emitJumpIfNotImmediateInteger(RegisterID);
432 Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000433 void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);
oliver@apple.com8d181632009-09-25 02:40:59 +0000434 void emitJumpSlowCaseIfNotImmediateNumber(RegisterID);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000435 void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
436
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000437 void emitFastArithReTagImmediate(RegisterID src, RegisterID dest);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000438
439 void emitTagAsBoolImmediate(RegisterID reg);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000440 void compileBinaryArithOp(OpcodeID, int dst, int src1, int src2, OperandTypes opi);
441 void compileBinaryArithOpSlowCase(Instruction*, OpcodeID, Vector<SlowCaseEntry>::iterator&, int dst, int src1, int src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000442
oliver@apple.com9b652762013-08-12 22:39:13 +0000443 void compileGetByIdHotPath(int baseVReg, const Identifier*);
fpizlo@apple.comd68b1f82012-07-05 22:55:51 +0000444 void compileGetDirectOffset(RegisterID base, RegisterID result, PropertyOffset cachedOffset);
445 void compileGetDirectOffset(JSObject* base, RegisterID result, PropertyOffset cachedOffset);
446 void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch, FinalObjectMode = MayBeFinal);
447 void compilePutDirectOffset(RegisterID base, RegisterID value, PropertyOffset cachedOffset);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000448
zoltan@webkit.org723ba022009-11-14 01:07:01 +0000449#endif // USE(JSVALUE32_64)
barraclough@apple.com970af2c2009-08-13 05:58:36 +0000450
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000451 void emit_compareAndJump(OpcodeID, int op1, int op2, unsigned target, RelationalCondition);
msaboff@apple.comc8dd3f72013-10-10 23:10:40 +0000452 void emit_compareAndJumpSlow(int op1, int op2, unsigned target, DoubleCondition, size_t (JIT_OPERATION *operation)(ExecState*, EncodedJSValue, EncodedJSValue), bool invert, Vector<SlowCaseEntry>::iterator&);
barraclough@apple.com3a8c64b2011-07-04 05:59:03 +0000453
fpizlo@apple.coma4ea0662013-12-02 19:09:15 +0000454 void emit_op_touch_entry(Instruction*);
weinig@apple.com0d74a262009-05-12 01:06:58 +0000455 void emit_op_add(Instruction*);
weinig@apple.com0d74a262009-05-12 01:06:58 +0000456 void emit_op_bitand(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000457 void emit_op_bitor(Instruction*);
458 void emit_op_bitxor(Instruction*);
459 void emit_op_call(Instruction*);
460 void emit_op_call_eval(Instruction*);
461 void emit_op_call_varargs(Instruction*);
fpizlo@apple.com88fedde2013-12-04 19:29:19 +0000462 void emit_op_captured_mov(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000463 void emit_op_catch(Instruction*);
464 void emit_op_construct(Instruction*);
fpizlo@apple.coma1fe26b2012-11-13 06:04:51 +0000465 void emit_op_get_callee(Instruction*);
barraclough@apple.comfd8c28a2010-05-25 03:04:43 +0000466 void emit_op_create_this(Instruction*);
oliver@apple.come2fe4ce2013-07-25 03:59:41 +0000467 void emit_op_to_this(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000468 void emit_op_create_arguments(Instruction*);
469 void emit_op_debug(Instruction*);
470 void emit_op_del_by_id(Instruction*);
471 void emit_op_div(Instruction*);
472 void emit_op_end(Instruction*);
473 void emit_op_enter(Instruction*);
oliver@apple.comf312e222010-10-04 22:43:18 +0000474 void emit_op_create_activation(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000475 void emit_op_eq(Instruction*);
476 void emit_op_eq_null(Instruction*);
477 void emit_op_get_by_id(Instruction*);
oliver@apple.com74e00b02010-09-25 21:42:00 +0000478 void emit_op_get_arguments_length(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000479 void emit_op_get_by_val(Instruction*);
oliver@apple.com74e00b02010-09-25 21:42:00 +0000480 void emit_op_get_argument_by_val(Instruction*);
oliver@apple.com0a4803c2009-10-29 01:25:02 +0000481 void emit_op_get_by_pname(Instruction*);
oliver@apple.comf61c9a12010-09-24 19:06:29 +0000482 void emit_op_init_lazy_reg(Instruction*);
barraclough@apple.com8da6d972010-11-16 21:11:26 +0000483 void emit_op_check_has_instance(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000484 void emit_op_instanceof(Instruction*);
fpizlo@apple.com1d216892012-04-12 00:55:44 +0000485 void emit_op_is_undefined(Instruction*);
486 void emit_op_is_boolean(Instruction*);
487 void emit_op_is_number(Instruction*);
488 void emit_op_is_string(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000489 void emit_op_jeq_null(Instruction*);
490 void emit_op_jfalse(Instruction*);
491 void emit_op_jmp(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000492 void emit_op_jneq_null(Instruction*);
493 void emit_op_jneq_ptr(Instruction*);
mjs@apple.coma46c49c2009-12-06 09:42:03 +0000494 void emit_op_jless(Instruction*);
barraclough@apple.com3a8c64b2011-07-04 05:59:03 +0000495 void emit_op_jlesseq(Instruction*);
barraclough@apple.com57b4bdb82011-07-04 19:26:05 +0000496 void emit_op_jgreater(Instruction*);
497 void emit_op_jgreatereq(Instruction*);
498 void emit_op_jnless(Instruction*);
weinig@apple.com0d74a262009-05-12 01:06:58 +0000499 void emit_op_jnlesseq(Instruction*);
barraclough@apple.com57b4bdb82011-07-04 19:26:05 +0000500 void emit_op_jngreater(Instruction*);
501 void emit_op_jngreatereq(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000502 void emit_op_jtrue(Instruction*);
fpizlo@apple.coma71ab052011-09-13 05:35:53 +0000503 void emit_op_loop_hint(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000504 void emit_op_lshift(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000505 void emit_op_mod(Instruction*);
506 void emit_op_mov(Instruction*);
507 void emit_op_mul(Instruction*);
508 void emit_op_negate(Instruction*);
509 void emit_op_neq(Instruction*);
510 void emit_op_neq_null(Instruction*);
511 void emit_op_new_array(Instruction*);
fpizlo@apple.com4500e352012-10-17 21:39:11 +0000512 void emit_op_new_array_with_size(Instruction*);
oliver@apple.coma991d692011-06-14 23:39:25 +0000513 void emit_op_new_array_buffer(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000514 void emit_op_new_func(Instruction*);
fpizlo@apple.com88fedde2013-12-04 19:29:19 +0000515 void emit_op_new_captured_func(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000516 void emit_op_new_func_exp(Instruction*);
517 void emit_op_new_object(Instruction*);
oliver@apple.com22d55c32010-05-10 01:41:07 +0000518 void emit_op_new_regexp(Instruction*);
ggaren@apple.com5236be22009-10-17 05:52:20 +0000519 void emit_op_get_pnames(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000520 void emit_op_next_pname(Instruction*);
521 void emit_op_not(Instruction*);
522 void emit_op_nstricteq(Instruction*);
523 void emit_op_pop_scope(Instruction*);
ggaren@apple.comf3036112013-04-27 23:14:04 +0000524 void emit_op_dec(Instruction*);
525 void emit_op_inc(Instruction*);
commit-queue@webkit.org90ba1872010-11-17 08:05:39 +0000526 void emit_op_profile_did_call(Instruction*);
527 void emit_op_profile_will_call(Instruction*);
ggaren@apple.com170d6f22012-09-02 21:27:23 +0000528 void emit_op_push_name_scope(Instruction*);
529 void emit_op_push_with_scope(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000530 void emit_op_put_by_id(Instruction*);
531 void emit_op_put_by_index(Instruction*);
532 void emit_op_put_by_val(Instruction*);
barraclough@apple.com09a55682012-01-30 18:28:39 +0000533 void emit_op_put_getter_setter(Instruction*);
oliver@apple.comc909f5f2012-10-18 23:37:40 +0000534 void emit_op_init_global_const(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000535 void emit_op_ret(Instruction*);
barraclough@apple.comfd6a1502010-05-20 05:36:17 +0000536 void emit_op_ret_object_or_this(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000537 void emit_op_rshift(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000538 void emit_op_strcat(Instruction*);
539 void emit_op_stricteq(Instruction*);
540 void emit_op_sub(Instruction*);
541 void emit_op_switch_char(Instruction*);
542 void emit_op_switch_imm(Instruction*);
543 void emit_op_switch_string(Instruction*);
weinig@apple.com0d74a262009-05-12 01:06:58 +0000544 void emit_op_tear_off_activation(Instruction*);
545 void emit_op_tear_off_arguments(Instruction*);
weinig@apple.com0d74a262009-05-12 01:06:58 +0000546 void emit_op_throw(Instruction*);
oliver@apple.comf0c01b82012-11-07 00:13:54 +0000547 void emit_op_throw_static_error(Instruction*);
ggaren@apple.comf3036112013-04-27 23:14:04 +0000548 void emit_op_to_number(Instruction*);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000549 void emit_op_to_primitive(Instruction*);
550 void emit_op_unexpected_load(Instruction*);
fpizlo@apple.com9089acb2013-12-14 06:33:42 +0000551 void emit_op_unsigned(Instruction*);
oliver@apple.com429ede02010-04-30 07:56:38 +0000552 void emit_op_urshift(Instruction*);
weinig@apple.com0d74a262009-05-12 01:06:58 +0000553
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000554 void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
555 void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
weinig@apple.com60a74092009-05-12 01:40:00 +0000556 void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000557 void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
weinig@apple.com60a74092009-05-12 01:40:00 +0000558 void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
559 void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
560 void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
fpizlo@apple.com88fedde2013-12-04 19:29:19 +0000561 void emitSlow_op_captured_mov(Instruction*, Vector<SlowCaseEntry>::iterator&);
weinig@apple.com60a74092009-05-12 01:40:00 +0000562 void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.come2fe4ce2013-07-25 03:59:41 +0000563 void emitSlow_op_to_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
commit-queue@webkit.orgc9b19ab2011-07-18 18:55:48 +0000564 void emitSlow_op_create_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000565 void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
566 void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
mhahnenberg@apple.com5f2e70b2013-09-25 00:37:57 +0000567 void emitSlow_op_get_callee(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000568 void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.com74e00b02010-09-25 21:42:00 +0000569 void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000570 void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.com74e00b02010-09-25 21:42:00 +0000571 void emitSlow_op_get_argument_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.com0a4803c2009-10-29 01:25:02 +0000572 void emitSlow_op_get_by_pname(Instruction*, Vector<SlowCaseEntry>::iterator&);
barraclough@apple.com8da6d972010-11-16 21:11:26 +0000573 void emitSlow_op_check_has_instance(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000574 void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&);
575 void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&);
mjs@apple.coma46c49c2009-12-06 09:42:03 +0000576 void emitSlow_op_jless(Instruction*, Vector<SlowCaseEntry>::iterator&);
barraclough@apple.com3a8c64b2011-07-04 05:59:03 +0000577 void emitSlow_op_jlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
barraclough@apple.com57b4bdb82011-07-04 19:26:05 +0000578 void emitSlow_op_jgreater(Instruction*, Vector<SlowCaseEntry>::iterator&);
579 void emitSlow_op_jgreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
580 void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000581 void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
barraclough@apple.com57b4bdb82011-07-04 19:26:05 +0000582 void emitSlow_op_jngreater(Instruction*, Vector<SlowCaseEntry>::iterator&);
583 void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000584 void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
mark.lam@apple.coma61ec352013-04-22 17:37:29 +0000585 void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000586 void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000587 void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
588 void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
589 void emitSlow_op_negate(Instruction*, Vector<SlowCaseEntry>::iterator&);
590 void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&);
commit-queue@webkit.orgc9b19ab2011-07-18 18:55:48 +0000591 void emitSlow_op_new_object(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000592 void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
593 void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.comf3036112013-04-27 23:14:04 +0000594 void emitSlow_op_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
595 void emitSlow_op_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000596 void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
597 void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000598 void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
599 void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
600 void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.comf3036112013-04-27 23:14:04 +0000601 void emitSlow_op_to_number(Instruction*, Vector<SlowCaseEntry>::iterator&);
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000602 void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
fpizlo@apple.com9089acb2013-12-14 06:33:42 +0000603 void emitSlow_op_unsigned(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.com429ede02010-04-30 07:56:38 +0000604 void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.comc909f5f2012-10-18 23:37:40 +0000605
oliver@apple.com58c86752013-07-25 04:02:40 +0000606 void emit_op_resolve_scope(Instruction*);
607 void emit_op_get_from_scope(Instruction*);
608 void emit_op_put_to_scope(Instruction*);
609 void emitSlow_op_resolve_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
610 void emitSlow_op_get_from_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
611 void emitSlow_op_put_to_scope(Instruction*, Vector<SlowCaseEntry>::iterator&);
oliver@apple.comc909f5f2012-10-18 23:37:40 +0000612
oliver@apple.com429ede02010-04-30 07:56:38 +0000613 void emitRightShift(Instruction*, bool isUnsigned);
614 void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
weinig@apple.com60a74092009-05-12 01:40:00 +0000615
oliver@apple.com58c86752013-07-25 04:02:40 +0000616 void emitVarInjectionCheck(bool needsVarInjectionChecks);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000617 void emitResolveClosure(int dst, bool needsVarInjectionChecks, unsigned depth);
618 void emitLoadWithStructureCheck(int scope, Structure** structureSlot);
oliver@apple.com58c86752013-07-25 04:02:40 +0000619 void emitGetGlobalProperty(uintptr_t* operandSlot);
620 void emitGetGlobalVar(uintptr_t operand);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000621 void emitGetClosureVar(int scope, uintptr_t operand);
622 void emitPutGlobalProperty(uintptr_t* operandSlot, int value);
fpizlo@apple.com86468342013-11-27 02:47:43 +0000623#if USE(JSVALUE64)
624 void emitNotifyWrite(RegisterID value, RegisterID scratch, VariableWatchpointSet*);
625#else
626 void emitNotifyWrite(RegisterID tag, RegisterID payload, RegisterID scratch, VariableWatchpointSet*);
627#endif
628 void emitPutGlobalVar(uintptr_t operand, int value, VariableWatchpointSet*);
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000629 void emitPutClosureVar(int scope, uintptr_t operand, int value);
oliver@apple.com58c86752013-07-25 04:02:40 +0000630
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000631 void emitInitRegister(int dst);
oliver@apple.comecfd2242008-09-20 03:00:43 +0000632
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +0000633 void emitPutIntToCallFrameHeader(RegisterID from, JSStack::CallFrameHeaderEntry);
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +0000634 void emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister);
635 void emitGetFromCallFrameHeader32(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister);
yuqiang.xian@intel.com5b1cb732012-10-19 05:46:10 +0000636#if USE(JSVALUE64)
637 void emitGetFromCallFrameHeader64(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister);
638#endif
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000639
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000640 JSValue getConstantOperand(int src);
641 bool isOperandConstantImmediateInt(int src);
642 bool isOperandConstantImmediateChar(int src);
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000643
barraclough@apple.com4f46a502008-12-13 01:39:38 +0000644 Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter)
645 {
646 return iter++->from;
647 }
648 void linkSlowCase(Vector<SlowCaseEntry>::iterator& iter)
649 {
650 iter->from.link(this);
651 ++iter;
652 }
fpizlo@apple.com9b0b31e2011-09-19 22:27:38 +0000653 void linkDummySlowCase(Vector<SlowCaseEntry>::iterator& iter)
654 {
655 ASSERT(!iter->from.isSet());
656 ++iter;
657 }
ggaren@apple.come1e45912011-11-14 19:44:32 +0000658 void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex);
weinig@apple.com262302f2008-09-16 03:46:58 +0000659
msaboff@apple.coma482c542013-10-04 18:20:40 +0000660 MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&);
msaboff@apple.com5ca16c42013-10-07 18:20:27 +0000661 MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&);
msaboff@apple.coma482c542013-10-04 18:20:40 +0000662 MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int);
fpizlo@apple.com1cfa0a92013-10-16 02:19:20 +0000663 MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr&, int);
664
665 enum WithProfileTag { WithProfile };
666
mark.lam@apple.com03944a02013-10-14 16:42:22 +0000667 MacroAssembler::Call callOperation(C_JITOperation_E);
668 MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg);
mark.lam@apple.com5d7e7082013-10-11 19:03:39 +0000669 MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*);
mark.lam@apple.com03944a02013-10-14 16:42:22 +0000670 MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t);
msaboff@apple.com75cc9322013-12-06 21:38:26 +0000671 MacroAssembler::Call callOperation(F_JITOperation_EJZ, GPRReg, int32_t);
msaboff@apple.coma482c542013-10-04 18:20:40 +0000672 MacroAssembler::Call callOperation(J_JITOperation_E, int);
mark.lam@apple.com5d7e7082013-10-11 19:03:39 +0000673 MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg);
mark.lam@apple.com5d7e7082013-10-11 19:03:39 +0000674 MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, GPRReg, int32_t);
675 MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, const JSValue*, int32_t);
676 MacroAssembler::Call callOperation(J_JITOperation_EC, int, JSCell*);
mhahnenberg@apple.com2ceb9d72013-12-20 00:49:58 +0000677 MacroAssembler::Call callOperation(V_JITOperation_EC, JSCell*);
mark.lam@apple.com03944a02013-10-14 16:42:22 +0000678 MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg);
fpizlo@apple.com1cfa0a92013-10-16 02:19:20 +0000679#if USE(JSVALUE64)
fpizlo@apple.comd49bfe82013-10-19 02:20:14 +0000680 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, StringImpl*);
fpizlo@apple.com1cfa0a92013-10-16 02:19:20 +0000681#else
fpizlo@apple.comd49bfe82013-10-19 02:20:14 +0000682 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, StringImpl*);
fpizlo@apple.com1cfa0a92013-10-16 02:19:20 +0000683#endif
mark.lam@apple.com03944a02013-10-14 16:42:22 +0000684 MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, const Identifier*);
685 MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg);
mark.lam@apple.com65293072013-10-17 07:20:20 +0000686#if USE(JSVALUE64)
687 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg);
688#else
689 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
690#endif
msaboff@apple.coma482c542013-10-04 18:20:40 +0000691 MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
fpizlo@apple.com1cfa0a92013-10-16 02:19:20 +0000692 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EPc, int, Instruction*);
mark.lam@apple.com2a90d902013-10-15 03:03:45 +0000693 MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
694 MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
msaboff@apple.comc8dd3f72013-10-10 23:10:40 +0000695 MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
696 MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);
697 MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID);
698 MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID);
msaboff@apple.com95894332014-01-29 19:18:54 +0000699 MacroAssembler::Call callOperation(Sprt_JITOperation_EZ, int32_t);
msaboff@apple.com4b6250f2013-10-15 18:33:04 +0000700 MacroAssembler::Call callOperation(V_JITOperation_E);
701 MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID);
702 MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);
703 MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID);
704 MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, int32_t);
705 MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
msaboff@apple.combdfcf6a2013-10-18 16:25:02 +0000706#if USE(JSVALUE64)
707 MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID);
708#else
709 MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID, RegisterID);
710#endif
msaboff@apple.com4b6250f2013-10-15 18:33:04 +0000711 MacroAssembler::Call callOperation(V_JITOperation_EJIdJJ, RegisterID, const Identifier*, RegisterID, RegisterID);
fpizlo@apple.comd97d7572013-10-14 18:39:45 +0000712#if USE(JSVALUE64)
msaboff@apple.com75cc9322013-12-06 21:38:26 +0000713 MacroAssembler::Call callOperation(F_JITOperation_EFJJ, RegisterID, RegisterID, RegisterID);
fpizlo@apple.comd49bfe82013-10-19 02:20:14 +0000714 MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, StringImpl*);
fpizlo@apple.comd97d7572013-10-14 18:39:45 +0000715#else
fpizlo@apple.comd49bfe82013-10-19 02:20:14 +0000716 MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, RegisterID, RegisterID, StringImpl*);
fpizlo@apple.comd97d7572013-10-14 18:39:45 +0000717#endif
msaboff@apple.com853b04f2013-10-17 01:23:56 +0000718 MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID);
msaboff@apple.com4b6250f2013-10-15 18:33:04 +0000719 MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, int32_t, RegisterID);
720 MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, int32_t);
mark.lam@apple.com2a90d902013-10-15 03:03:45 +0000721 MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*);
msaboff@apple.com4b6250f2013-10-15 18:33:04 +0000722 MacroAssembler::Call callOperation(V_JITOperation_EZ, int32_t);
msaboff@apple.com2b95ada2013-10-09 13:29:00 +0000723 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E);
msaboff@apple.com95894332014-01-29 19:18:54 +0000724 MacroAssembler::Call callOperationNoExceptionCheck(J_JITOperation_EE, RegisterID);
msaboff@apple.com5ca16c42013-10-07 18:20:27 +0000725 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*);
726 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E);
msaboff@apple.comc8dd3f72013-10-10 23:10:40 +0000727#if USE(JSVALUE32_64)
msaboff@apple.com75cc9322013-12-06 21:38:26 +0000728 MacroAssembler::Call callOperation(F_JITOperation_EFJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID);
729 MacroAssembler::Call callOperation(F_JITOperation_EJZ, GPRReg, GPRReg, int32_t);
mark.lam@apple.com03944a02013-10-14 16:42:22 +0000730 MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg);
731 MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg, GPRReg);
732 MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*);
733 MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
mark.lam@apple.com2a90d902013-10-15 03:03:45 +0000734 MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t);
msaboff@apple.comc8dd3f72013-10-10 23:10:40 +0000735 MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
736 MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
msaboff@apple.com4b6250f2013-10-15 18:33:04 +0000737 MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, RegisterID, int32_t);
738 MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID);
msaboff@apple.com853b04f2013-10-17 01:23:56 +0000739 MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID);
msaboff@apple.com4b6250f2013-10-15 18:33:04 +0000740 MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t);
741 MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, RegisterID, int32_t, RegisterID, RegisterID);
msaboff@apple.comc8dd3f72013-10-10 23:10:40 +0000742#endif
msaboff@apple.coma482c542013-10-04 18:20:40 +0000743
barraclough@apple.coma2a2e132008-12-13 23:58:58 +0000744 Jump checkStructure(RegisterID reg, Structure* structure);
barraclough@apple.comf5f74822008-11-21 05:04:19 +0000745
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000746 void updateTopCallFrame();
barraclough@apple.com23f0c052008-12-16 04:48:16 +0000747
barraclough@apple.com97bacef2009-06-05 07:55:38 +0000748 Call emitNakedCall(CodePtr function = CodePtr());
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000749
oliver@apple.com5230bd32010-05-06 19:39:54 +0000750 // Loads the character value of a single character string into dst.
751 void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures);
752
fpizlo@apple.com903c3782011-09-15 23:24:27 +0000753#if ENABLE(DFG_JIT)
mark.lam@apple.coma61ec352013-04-22 17:37:29 +0000754 void emitEnterOptimizationCheck();
fpizlo@apple.com594887a2011-09-06 09:23:55 +0000755#else
mark.lam@apple.coma61ec352013-04-22 17:37:29 +0000756 void emitEnterOptimizationCheck() { }
fpizlo@apple.com594887a2011-09-06 09:23:55 +0000757#endif
mark.lam@apple.comdff6b222013-04-17 22:37:45 +0000758
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000759#ifndef NDEBUG
msaboff@apple.com7535bbd2013-09-10 06:01:03 +0000760 void printBytecodeOperandTypes(int src1, int src2);
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000761#endif
762
barraclough@apple.com536c0db2009-05-12 06:21:56 +0000763#if ENABLE(SAMPLING_FLAGS)
barraclough@apple.comc32f32e2009-05-13 09:10:02 +0000764 void setSamplingFlag(int32_t);
765 void clearSamplingFlag(int32_t);
766#endif
767
768#if ENABLE(SAMPLING_COUNTERS)
barraclough@apple.com6d410b02011-11-10 20:24:06 +0000769 void emitCount(AbstractSamplingCounter&, int32_t = 1);
barraclough@apple.com24a7abb2009-01-16 23:34:46 +0000770#endif
771
772#if ENABLE(OPCODE_SAMPLING)
barraclough@apple.com536c0db2009-05-12 06:21:56 +0000773 void sampleInstruction(Instruction*, bool = false);
barraclough@apple.com24a7abb2009-01-16 23:34:46 +0000774#endif
barraclough@apple.com536c0db2009-05-12 06:21:56 +0000775
776#if ENABLE(CODEBLOCK_SAMPLING)
777 void sampleCodeBlock(CodeBlock*);
barraclough@apple.com24a7abb2009-01-16 23:34:46 +0000778#else
barraclough@apple.com536c0db2009-05-12 06:21:56 +0000779 void sampleCodeBlock(CodeBlock*) {}
barraclough@apple.com24a7abb2009-01-16 23:34:46 +0000780#endif
781
fpizlo@apple.com903c3782011-09-15 23:24:27 +0000782#if ENABLE(DFG_JIT)
fpizlo@apple.com98aa2532011-09-25 23:40:51 +0000783 bool canBeOptimized() { return m_canBeOptimized; }
fpizlo@apple.com4d95ce62013-02-27 03:52:58 +0000784 bool canBeOptimizedOrInlined() { return m_canBeOptimizedOrInlined; }
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +0000785 bool shouldEmitProfiling() { return m_shouldEmitProfiling; }
fpizlo@apple.com452cb412011-09-08 21:38:04 +0000786#else
fpizlo@apple.com98aa2532011-09-25 23:40:51 +0000787 bool canBeOptimized() { return false; }
commit-queue@webkit.org456305d2013-02-27 18:34:33 +0000788 bool canBeOptimizedOrInlined() { return false; }
fpizlo@apple.com452cb412011-09-08 21:38:04 +0000789 // Enables use of value profiler with tiered compilation turned off,
790 // in which case all code gets profiled.
fpizlo@apple.com85846322013-02-28 23:23:14 +0000791 bool shouldEmitProfiling() { return false; }
fpizlo@apple.com452cb412011-09-08 21:38:04 +0000792#endif
793
ggaren@apple.com031563e2008-11-17 02:21:16 +0000794 Interpreter* m_interpreter;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000795
796 Vector<CallRecord> m_calls;
barraclough@apple.coma2a2e132008-12-13 23:58:58 +0000797 Vector<Label> m_labels;
fpizlo@apple.com5ba07882013-10-19 23:13:23 +0000798 Vector<JITGetByIdGenerator> m_getByIds;
799 Vector<JITPutByIdGenerator> m_putByIds;
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000800 Vector<ByValCompilationInfo> m_byValCompilationInfo;
barraclough@apple.come9642652008-10-23 22:29:54 +0000801 Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo;
barraclough@apple.coma2a2e132008-12-13 23:58:58 +0000802 Vector<JumpTable> m_jmpTable;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000803
ggaren@apple.com1ba49812010-05-19 18:28:54 +0000804 unsigned m_bytecodeOffset;
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000805 Vector<SlowCaseEntry> m_slowCases;
806 Vector<SwitchRecord> m_switches;
807
msaboff@apple.com8f4bb0c2013-10-02 23:33:46 +0000808 JumpList m_exceptionChecks;
msaboff@apple.com5ca16c42013-10-07 18:20:27 +0000809 JumpList m_exceptionChecksWithCallFrameRollback;
msaboff@apple.com8f4bb0c2013-10-02 23:33:46 +0000810
fpizlo@apple.com5ba07882013-10-19 23:13:23 +0000811 unsigned m_getByIdIndex;
812 unsigned m_putByIdIndex;
fpizlo@apple.com0e9910a2012-10-09 23:39:53 +0000813 unsigned m_byValInstructionIndex;
weinig@apple.com0d74a262009-05-12 01:06:58 +0000814 unsigned m_callLinkInfoIndex;
ggaren@apple.comd8fccca2009-05-08 20:51:53 +0000815
fpizlo@apple.com1949f322012-11-22 00:46:57 +0000816 OwnPtr<JITDisassembler> m_disassembler;
fpizlo@apple.comd2deec82012-12-10 18:17:46 +0000817 RefPtr<Profiler::Compilation> m_compilation;
oliver@apple.com31df1c82011-05-20 01:33:46 +0000818 WeakRandom m_randomGenerator;
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000819 static CodeRef stringGetByValStubGenerator(VM*);
barraclough@apple.come32d4ec2011-09-21 22:43:11 +0000820
fpizlo@apple.com452cb412011-09-08 21:38:04 +0000821 bool m_canBeOptimized;
fpizlo@apple.com4d95ce62013-02-27 03:52:58 +0000822 bool m_canBeOptimizedOrInlined;
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +0000823 bool m_shouldEmitProfiling;
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000824 } JIT_CLASS_ALIGNMENT;
mjs@apple.combe317ee2009-12-12 17:52:21 +0000825
ggaren@apple.com540d71a62009-07-30 20:57:44 +0000826} // namespace JSC
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000827
ggaren@apple.comf272d2d2008-11-17 04:25:37 +0000828#endif // ENABLE(JIT)
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000829
ggaren@apple.comcc0f1f12008-11-17 23:16:00 +0000830#endif // JIT_h