1 | /*
|
---|
2 | * Copyright (C) 2008 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 CTI_h
|
---|
27 | #define CTI_h
|
---|
28 |
|
---|
29 | #if ENABLE(CTI)
|
---|
30 |
|
---|
31 | #define WTF_USE_CTI_REPATCH_PIC 1
|
---|
32 |
|
---|
33 | #include "Machine.h"
|
---|
34 | #include "Opcode.h"
|
---|
35 | #include "RegisterFile.h"
|
---|
36 | #include <masm/X86Assembler.h>
|
---|
37 | #include <profiler/Profiler.h>
|
---|
38 | #include <wtf/AlwaysInline.h>
|
---|
39 | #include <wtf/Vector.h>
|
---|
40 |
|
---|
41 | #define CTI_ARGS_code 0x0C
|
---|
42 | #define CTI_ARGS_registerFile 0x0D
|
---|
43 | #define CTI_ARGS_callFrame 0x0E
|
---|
44 | #define CTI_ARGS_exception 0x0F
|
---|
45 | #define CTI_ARGS_profilerReference 0x10
|
---|
46 | #define CTI_ARGS_globalData 0x11
|
---|
47 |
|
---|
48 | #define ARG_callFrame static_cast<CallFrame*>(ARGS[CTI_ARGS_callFrame])
|
---|
49 | #define ARG_registerFile static_cast<RegisterFile*>(ARGS[CTI_ARGS_registerFile])
|
---|
50 | #define ARG_exception static_cast<JSValue**>(ARGS[CTI_ARGS_exception])
|
---|
51 | #define ARG_profilerReference static_cast<Profiler**>(ARGS[CTI_ARGS_profilerReference])
|
---|
52 | #define ARG_globalData static_cast<JSGlobalData*>(ARGS[CTI_ARGS_globalData])
|
---|
53 |
|
---|
54 | #define ARG_setCallFrame(newCallFrame) (ARGS[CTI_ARGS_callFrame] = (newCallFrame))
|
---|
55 |
|
---|
56 | #define ARG_src1 static_cast<JSValue*>(ARGS[1])
|
---|
57 | #define ARG_src2 static_cast<JSValue*>(ARGS[2])
|
---|
58 | #define ARG_src3 static_cast<JSValue*>(ARGS[3])
|
---|
59 | #define ARG_src4 static_cast<JSValue*>(ARGS[4])
|
---|
60 | #define ARG_src5 static_cast<JSValue*>(ARGS[5])
|
---|
61 | #define ARG_id1 static_cast<Identifier*>(ARGS[1])
|
---|
62 | #define ARG_id2 static_cast<Identifier*>(ARGS[2])
|
---|
63 | #define ARG_id3 static_cast<Identifier*>(ARGS[3])
|
---|
64 | #define ARG_id4 static_cast<Identifier*>(ARGS[4])
|
---|
65 | #define ARG_int1 reinterpret_cast<intptr_t>(ARGS[1])
|
---|
66 | #define ARG_int2 reinterpret_cast<intptr_t>(ARGS[2])
|
---|
67 | #define ARG_int3 reinterpret_cast<intptr_t>(ARGS[3])
|
---|
68 | #define ARG_int4 reinterpret_cast<intptr_t>(ARGS[4])
|
---|
69 | #define ARG_int5 reinterpret_cast<intptr_t>(ARGS[5])
|
---|
70 | #define ARG_int6 reinterpret_cast<intptr_t>(ARGS[6])
|
---|
71 | #define ARG_func1 static_cast<FuncDeclNode*>(ARGS[1])
|
---|
72 | #define ARG_funcexp1 static_cast<FuncExprNode*>(ARGS[1])
|
---|
73 | #define ARG_registers1 static_cast<Register*>(ARGS[1])
|
---|
74 | #define ARG_regexp1 static_cast<RegExp*>(ARGS[1])
|
---|
75 | #define ARG_pni1 static_cast<JSPropertyNameIterator*>(ARGS[1])
|
---|
76 | #define ARG_instr1 static_cast<Instruction*>(ARGS[1])
|
---|
77 | #define ARG_instr2 static_cast<Instruction*>(ARGS[2])
|
---|
78 | #define ARG_instr3 static_cast<Instruction*>(ARGS[3])
|
---|
79 | #define ARG_instr4 static_cast<Instruction*>(ARGS[4])
|
---|
80 | #define ARG_instr5 static_cast<Instruction*>(ARGS[5])
|
---|
81 | #define ARG_instr6 static_cast<Instruction*>(ARGS[6])
|
---|
82 |
|
---|
83 | #define CTI_RETURN_ADDRESS_SLOT (ARGS[-1])
|
---|
84 |
|
---|
85 | namespace JSC {
|
---|
86 |
|
---|
87 | class CodeBlock;
|
---|
88 | class JSPropertyNameIterator;
|
---|
89 | class JSValue;
|
---|
90 | class Machine;
|
---|
91 | class Register;
|
---|
92 | class RegisterFile;
|
---|
93 | class ScopeChainNode;
|
---|
94 | class SimpleJumpTable;
|
---|
95 | class StringJumpTable;
|
---|
96 | class StructureIDChain;
|
---|
97 |
|
---|
98 | struct Instruction;
|
---|
99 | struct OperandTypes;
|
---|
100 | struct StructureStubInfo;
|
---|
101 |
|
---|
102 | typedef JSValue* (SFX_CALL *CTIHelper_j)(CTI_ARGS);
|
---|
103 | typedef JSPropertyNameIterator* (SFX_CALL *CTIHelper_p)(CTI_ARGS);
|
---|
104 | typedef void (SFX_CALL *CTIHelper_v)(CTI_ARGS);
|
---|
105 | typedef void* (SFX_CALL *CTIHelper_s)(CTI_ARGS);
|
---|
106 | typedef int (SFX_CALL *CTIHelper_b)(CTI_ARGS);
|
---|
107 | typedef VoidPtrPair (SFX_CALL *CTIHelper_2)(CTI_ARGS);
|
---|
108 |
|
---|
109 | struct CallRecord {
|
---|
110 | X86Assembler::JmpSrc from;
|
---|
111 | void* to;
|
---|
112 | unsigned opcodeIndex;
|
---|
113 |
|
---|
114 | CallRecord()
|
---|
115 | {
|
---|
116 | }
|
---|
117 |
|
---|
118 | CallRecord(X86Assembler::JmpSrc f, CTIHelper_j t, unsigned i)
|
---|
119 | : from(f)
|
---|
120 | , to((void*)t)
|
---|
121 | , opcodeIndex(i)
|
---|
122 | {
|
---|
123 | }
|
---|
124 |
|
---|
125 | CallRecord(X86Assembler::JmpSrc f, CTIHelper_p t, unsigned i)
|
---|
126 | : from(f)
|
---|
127 | , to((void*)t)
|
---|
128 | , opcodeIndex(i)
|
---|
129 | {
|
---|
130 | }
|
---|
131 |
|
---|
132 | CallRecord(X86Assembler::JmpSrc f, CTIHelper_v t, unsigned i)
|
---|
133 | : from(f)
|
---|
134 | , to((void*)t)
|
---|
135 | , opcodeIndex(i)
|
---|
136 | {
|
---|
137 | }
|
---|
138 |
|
---|
139 | CallRecord(X86Assembler::JmpSrc f, CTIHelper_s t, unsigned i)
|
---|
140 | : from(f)
|
---|
141 | , to((void*)t)
|
---|
142 | , opcodeIndex(i)
|
---|
143 | {
|
---|
144 | }
|
---|
145 |
|
---|
146 | CallRecord(X86Assembler::JmpSrc f, CTIHelper_b t, unsigned i)
|
---|
147 | : from(f)
|
---|
148 | , to((void*)t)
|
---|
149 | , opcodeIndex(i)
|
---|
150 | {
|
---|
151 | }
|
---|
152 |
|
---|
153 | CallRecord(X86Assembler::JmpSrc f, CTIHelper_2 t, unsigned i)
|
---|
154 | : from(f)
|
---|
155 | , to((void*)t)
|
---|
156 | , opcodeIndex(i)
|
---|
157 | {
|
---|
158 | }
|
---|
159 |
|
---|
160 | CallRecord(X86Assembler::JmpSrc f, unsigned i)
|
---|
161 | : from(f)
|
---|
162 | , to(0)
|
---|
163 | , opcodeIndex(i)
|
---|
164 | {
|
---|
165 | }
|
---|
166 | };
|
---|
167 |
|
---|
168 | struct JmpTable {
|
---|
169 | X86Assembler::JmpSrc from;
|
---|
170 | unsigned to;
|
---|
171 |
|
---|
172 | JmpTable(X86Assembler::JmpSrc f, unsigned t)
|
---|
173 | : from(f)
|
---|
174 | , to(t)
|
---|
175 | {
|
---|
176 | }
|
---|
177 | };
|
---|
178 |
|
---|
179 | struct SlowCaseEntry {
|
---|
180 | X86Assembler::JmpSrc from;
|
---|
181 | unsigned to;
|
---|
182 | unsigned hint;
|
---|
183 |
|
---|
184 | SlowCaseEntry(X86Assembler::JmpSrc f, unsigned t, unsigned h = 0)
|
---|
185 | : from(f)
|
---|
186 | , to(t)
|
---|
187 | , hint(h)
|
---|
188 | {
|
---|
189 | }
|
---|
190 | };
|
---|
191 |
|
---|
192 | struct SwitchRecord {
|
---|
193 | enum Type {
|
---|
194 | Immediate,
|
---|
195 | Character,
|
---|
196 | String
|
---|
197 | };
|
---|
198 |
|
---|
199 | Type m_type;
|
---|
200 |
|
---|
201 | union {
|
---|
202 | SimpleJumpTable* m_simpleJumpTable;
|
---|
203 | StringJumpTable* m_stringJumpTable;
|
---|
204 | } m_jumpTable;
|
---|
205 |
|
---|
206 | unsigned m_opcodeIndex;
|
---|
207 | unsigned m_defaultOffset;
|
---|
208 |
|
---|
209 | SwitchRecord(SimpleJumpTable* jumpTable, unsigned opcodeIndex, unsigned defaultOffset, Type type)
|
---|
210 | : m_type(type)
|
---|
211 | , m_opcodeIndex(opcodeIndex)
|
---|
212 | , m_defaultOffset(defaultOffset)
|
---|
213 | {
|
---|
214 | m_jumpTable.m_simpleJumpTable = jumpTable;
|
---|
215 | }
|
---|
216 |
|
---|
217 | SwitchRecord(StringJumpTable* jumpTable, unsigned opcodeIndex, unsigned defaultOffset)
|
---|
218 | : m_type(String)
|
---|
219 | , m_opcodeIndex(opcodeIndex)
|
---|
220 | , m_defaultOffset(defaultOffset)
|
---|
221 | {
|
---|
222 | m_jumpTable.m_stringJumpTable = jumpTable;
|
---|
223 | }
|
---|
224 | };
|
---|
225 |
|
---|
226 | struct StructureStubCompilationInfo {
|
---|
227 | X86Assembler::JmpSrc callReturnLocation;
|
---|
228 | X86Assembler::JmpDst hotPathBegin;
|
---|
229 | X86Assembler::JmpSrc hotPathOther;
|
---|
230 | X86Assembler::JmpDst coldPathOther;
|
---|
231 | };
|
---|
232 |
|
---|
233 | extern "C" {
|
---|
234 | JSValue* ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue** exception, Profiler**, JSGlobalData*);
|
---|
235 | void ctiVMThrowTrampoline();
|
---|
236 | };
|
---|
237 |
|
---|
238 | void ctiSetReturnAddress(void** where, void* what);
|
---|
239 | void ctiRepatchCallByReturnAddress(void* where, void* what);
|
---|
240 |
|
---|
241 | class CTI {
|
---|
242 | static const int repatchGetByIdDefaultStructureID = -1;
|
---|
243 | // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler
|
---|
244 | // will compress the displacement, and we may not be able to fit a repatched offset.
|
---|
245 | static const int repatchGetByIdDefaultOffset = 256;
|
---|
246 |
|
---|
247 | #if USE(FAST_CALL_CTI_ARGUMENT)
|
---|
248 | static const int ctiArgumentInitSize = 2;
|
---|
249 | #elif USE(CTI_ARGUMENT)
|
---|
250 | static const int ctiArgumentInitSize = 4;
|
---|
251 | #else
|
---|
252 | static const int ctiArgumentInitSize = 0;
|
---|
253 | #endif
|
---|
254 | // These architecture specific value are used to enable repatching - see comment on op_put_by_id.
|
---|
255 | static const int repatchOffsetPutByIdStructureID = 19;
|
---|
256 | static const int repatchOffsetPutByIdPropertyMapOffset = 34;
|
---|
257 | // These architecture specific value are used to enable repatching - see comment on op_get_by_id.
|
---|
258 | static const int repatchOffsetGetByIdStructureID = 19;
|
---|
259 | static const int repatchOffsetGetByIdBranchToSlowCase = 25;
|
---|
260 | static const int repatchOffsetGetByIdPropertyMapOffset = 34;
|
---|
261 | #if ENABLE(SAMPLING_TOOL)
|
---|
262 | static const int repatchOffsetGetByIdSlowCaseCall = 27 + 4 + ctiArgumentInitSize;
|
---|
263 | #else
|
---|
264 | static const int repatchOffsetGetByIdSlowCaseCall = 17 + 4 + ctiArgumentInitSize;
|
---|
265 | #endif
|
---|
266 | static const int repatchOffsetOpCallCall = 6;
|
---|
267 |
|
---|
268 | public:
|
---|
269 | static void compile(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock)
|
---|
270 | {
|
---|
271 | CTI cti(machine, callFrame, codeBlock);
|
---|
272 | cti.privateCompile();
|
---|
273 | }
|
---|
274 |
|
---|
275 | #if ENABLE(WREC)
|
---|
276 | static void* compileRegExp(Machine*, const UString& pattern, unsigned* numSubpatterns_ptr, const char** error_ptr, bool ignoreCase = false, bool multiline = false);
|
---|
277 | #endif
|
---|
278 |
|
---|
279 | static void compileGetByIdSelf(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress)
|
---|
280 | {
|
---|
281 | CTI cti(machine, callFrame, codeBlock);
|
---|
282 | cti.privateCompileGetByIdSelf(structureID, cachedOffset, returnAddress);
|
---|
283 | }
|
---|
284 |
|
---|
285 | static void compileGetByIdProto(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress)
|
---|
286 | {
|
---|
287 | CTI cti(machine, callFrame, codeBlock);
|
---|
288 | cti.privateCompileGetByIdProto(structureID, prototypeStructureID, cachedOffset, returnAddress);
|
---|
289 | }
|
---|
290 |
|
---|
291 | static void compileGetByIdChain(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset, void* returnAddress)
|
---|
292 | {
|
---|
293 | CTI cti(machine, callFrame, codeBlock);
|
---|
294 | cti.privateCompileGetByIdChain(structureID, chain, count, cachedOffset, returnAddress);
|
---|
295 | }
|
---|
296 |
|
---|
297 | static void compilePutByIdReplace(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress)
|
---|
298 | {
|
---|
299 | CTI cti(machine, callFrame, codeBlock);
|
---|
300 | cti.privateCompilePutByIdReplace(structureID, cachedOffset, returnAddress);
|
---|
301 | }
|
---|
302 |
|
---|
303 | static void compilePutByIdTransition(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* oldStructureID, StructureID* newStructureID, size_t cachedOffset, StructureIDChain* sIDC, void* returnAddress)
|
---|
304 | {
|
---|
305 | CTI cti(machine, callFrame, codeBlock);
|
---|
306 | cti.privateCompilePutByIdTransition(oldStructureID, newStructureID, cachedOffset, sIDC, returnAddress);
|
---|
307 | }
|
---|
308 |
|
---|
309 | static void* compileArrayLengthTrampoline(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock)
|
---|
310 | {
|
---|
311 | CTI cti(machine, callFrame, codeBlock);
|
---|
312 | return cti.privateCompileArrayLengthTrampoline();
|
---|
313 | }
|
---|
314 |
|
---|
315 | static void* compileStringLengthTrampoline(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock)
|
---|
316 | {
|
---|
317 | CTI cti(machine, callFrame, codeBlock);
|
---|
318 | return cti.privateCompileStringLengthTrampoline();
|
---|
319 | }
|
---|
320 |
|
---|
321 | static void patchGetByIdSelf(CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress);
|
---|
322 | static void patchPutByIdReplace(CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress);
|
---|
323 |
|
---|
324 | static void compilePatchGetArrayLength(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress)
|
---|
325 | {
|
---|
326 | CTI cti(machine, callFrame, codeBlock);
|
---|
327 | return cti.privateCompilePatchGetArrayLength(returnAddress);
|
---|
328 | }
|
---|
329 |
|
---|
330 | static void linkCall(CodeBlock* callerCodeBlock, JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, void* returnAddress, int callerArgCount);
|
---|
331 | static void unlinkCall(StructureStubInfo*);
|
---|
332 |
|
---|
333 | inline static JSValue* execute(void* code, RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData, JSValue** exception)
|
---|
334 | {
|
---|
335 | return ctiTrampoline(code, registerFile, callFrame, exception, Profiler::enabledProfilerReference(), globalData);
|
---|
336 | }
|
---|
337 |
|
---|
338 | private:
|
---|
339 | CTI(Machine*, CallFrame*, CodeBlock*);
|
---|
340 |
|
---|
341 | static uintptr_t asInteger(JSValue*);
|
---|
342 |
|
---|
343 | bool isConstant(int src);
|
---|
344 | JSValue* getConstant(CallFrame*, int src);
|
---|
345 |
|
---|
346 | void privateCompileMainPass();
|
---|
347 | void privateCompileLinkPass();
|
---|
348 | void privateCompileSlowCases();
|
---|
349 | void privateCompile();
|
---|
350 | void privateCompileGetByIdSelf(StructureID*, size_t cachedOffset, void* returnAddress);
|
---|
351 | void privateCompileGetByIdProto(StructureID*, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress);
|
---|
352 | void privateCompileGetByIdChain(StructureID*, StructureIDChain*, size_t count, size_t cachedOffset, void* returnAddress);
|
---|
353 | void privateCompilePutByIdReplace(StructureID*, size_t cachedOffset, void* returnAddress);
|
---|
354 | void privateCompilePutByIdTransition(StructureID*, StructureID*, size_t cachedOffset, StructureIDChain*, void* returnAddress);
|
---|
355 |
|
---|
356 | void* privateCompileArrayLengthTrampoline();
|
---|
357 | void* privateCompileStringLengthTrampoline();
|
---|
358 | void privateCompilePatchGetArrayLength(void* returnAddress);
|
---|
359 |
|
---|
360 | enum CompileOpCallType { OpCallNormal, OpCallEval, OpConstruct };
|
---|
361 | void compileOpCall(Instruction* instruction, unsigned i, unsigned structureIDInstructionIndex, CompileOpCallType type = OpCallNormal);
|
---|
362 | void compileOpCallInitializeCallFrame(unsigned callee, unsigned argCount);
|
---|
363 | void compileOpCallSetupArgs(Instruction* instruction, bool isConstruct, bool isEval);
|
---|
364 | enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
|
---|
365 | void compileOpStrictEq(Instruction* instruction, unsigned i, CompileOpStrictEqType type);
|
---|
366 | void putDoubleResultToJSNumberCellOrJSImmediate(X86::XMMRegisterID xmmSource, X86::RegisterID jsNumberCell, unsigned dst, X86Assembler::JmpSrc* wroteJSNumberCell, X86::XMMRegisterID tempXmm, X86::RegisterID tempReg1, X86::RegisterID tempReg2);
|
---|
367 | void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
|
---|
368 | void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
|
---|
369 |
|
---|
370 | void emitGetArg(int src, X86Assembler::RegisterID dst);
|
---|
371 | void emitGetPutArg(unsigned src, unsigned offset, X86Assembler::RegisterID scratch);
|
---|
372 | void emitPutArg(X86Assembler::RegisterID src, unsigned offset);
|
---|
373 | void emitPutArgConstant(unsigned value, unsigned offset);
|
---|
374 | void emitPutResult(unsigned dst, X86Assembler::RegisterID from = X86::eax);
|
---|
375 |
|
---|
376 | void emitInitRegister(unsigned dst);
|
---|
377 |
|
---|
378 | void emitPutCTIParam(void* value, unsigned name);
|
---|
379 | void emitPutCTIParam(X86Assembler::RegisterID from, unsigned name);
|
---|
380 | void emitGetCTIParam(unsigned name, X86Assembler::RegisterID to);
|
---|
381 |
|
---|
382 | void emitPutToCallFrameHeader(X86Assembler::RegisterID from, RegisterFile::CallFrameHeaderEntry entry);
|
---|
383 | void emitGetFromCallFrameHeader(RegisterFile::CallFrameHeaderEntry entry, X86Assembler::RegisterID to);
|
---|
384 |
|
---|
385 | JSValue* getConstantImmediateNumericArg(unsigned src);
|
---|
386 | unsigned getDeTaggedConstantImmediate(JSValue* imm);
|
---|
387 |
|
---|
388 | void emitJumpSlowCaseIfIsJSCell(X86Assembler::RegisterID reg, unsigned opcodeIndex);
|
---|
389 | void emitJumpSlowCaseIfNotJSCell(X86Assembler::RegisterID reg, unsigned opcodeIndex);
|
---|
390 |
|
---|
391 | void emitJumpSlowCaseIfNotImmNum(X86Assembler::RegisterID, unsigned opcodeIndex);
|
---|
392 | void emitJumpSlowCaseIfNotImmNums(X86Assembler::RegisterID, X86Assembler::RegisterID, unsigned opcodeIndex);
|
---|
393 |
|
---|
394 | void emitFastArithDeTagImmediate(X86Assembler::RegisterID);
|
---|
395 | X86Assembler::JmpSrc emitFastArithDeTagImmediateJumpIfZero(X86Assembler::RegisterID);
|
---|
396 | void emitFastArithReTagImmediate(X86Assembler::RegisterID);
|
---|
397 | void emitFastArithPotentiallyReTagImmediate(X86Assembler::RegisterID);
|
---|
398 | void emitFastArithImmToInt(X86Assembler::RegisterID);
|
---|
399 | void emitFastArithIntToImmOrSlowCase(X86Assembler::RegisterID, unsigned opcodeIndex);
|
---|
400 | void emitFastArithIntToImmNoCheck(X86Assembler::RegisterID);
|
---|
401 |
|
---|
402 | void emitTagAsBoolImmediate(X86Assembler::RegisterID reg);
|
---|
403 |
|
---|
404 | X86Assembler::JmpSrc emitNakedCall(unsigned opcodeIndex, X86::RegisterID);
|
---|
405 | X86Assembler::JmpSrc emitNakedCall(unsigned opcodeIndex, void(*function)());
|
---|
406 | X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_j);
|
---|
407 | X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_p);
|
---|
408 | X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_v);
|
---|
409 | X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_s);
|
---|
410 | X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_b);
|
---|
411 | X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_2);
|
---|
412 |
|
---|
413 | void emitGetVariableObjectRegister(X86Assembler::RegisterID variableObject, int index, X86Assembler::RegisterID dst);
|
---|
414 | void emitPutVariableObjectRegister(X86Assembler::RegisterID src, X86Assembler::RegisterID variableObject, int index);
|
---|
415 |
|
---|
416 | void emitSlowScriptCheck(unsigned opcodeIndex);
|
---|
417 | #ifndef NDEBUG
|
---|
418 | void printOpcodeOperandTypes(unsigned src1, unsigned src2);
|
---|
419 | #endif
|
---|
420 |
|
---|
421 | X86Assembler m_jit;
|
---|
422 | Machine* m_machine;
|
---|
423 | CallFrame* m_callFrame;
|
---|
424 | CodeBlock* m_codeBlock;
|
---|
425 |
|
---|
426 | Vector<CallRecord> m_calls;
|
---|
427 | Vector<X86Assembler::JmpDst> m_labels;
|
---|
428 | Vector<StructureStubCompilationInfo> m_structureStubCompilationInfo;
|
---|
429 | Vector<JmpTable> m_jmpTable;
|
---|
430 |
|
---|
431 | struct JSRInfo {
|
---|
432 | X86Assembler::JmpDst addrPosition;
|
---|
433 | X86Assembler::JmpDst target;
|
---|
434 |
|
---|
435 | JSRInfo(const X86Assembler::JmpDst& storeLocation, const X86Assembler::JmpDst& targetLocation)
|
---|
436 | : addrPosition(storeLocation)
|
---|
437 | , target(targetLocation)
|
---|
438 | {
|
---|
439 | }
|
---|
440 | };
|
---|
441 |
|
---|
442 | Vector<JSRInfo> m_jsrSites;
|
---|
443 | Vector<SlowCaseEntry> m_slowCases;
|
---|
444 | Vector<SwitchRecord> m_switches;
|
---|
445 |
|
---|
446 | // This limit comes from the limit set in PCRE
|
---|
447 | static const int MaxPatternSize = (1 << 16);
|
---|
448 |
|
---|
449 | };
|
---|
450 | }
|
---|
451 |
|
---|
452 | #endif // ENABLE(CTI)
|
---|
453 |
|
---|
454 | #endif // CTI_h
|
---|