mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 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 | |
ggaren@apple.com | f272d2d | 2008-11-17 04:25:37 +0000 | [diff] [blame^] | 29 | #include <wtf/Platform.h> |
| 30 | |
| 31 | #if ENABLE(JIT) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 32 | |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 33 | #define WTF_USE_CTI_REPATCH_PIC 1 |
| 34 | |
alp@webkit.org | 7e2b6cd | 2008-10-10 00:50:25 +0000 | [diff] [blame] | 35 | #include "Machine.h" |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 36 | #include "Opcode.h" |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 37 | #include "RegisterFile.h" |
ggaren@apple.com | f272d2d | 2008-11-17 04:25:37 +0000 | [diff] [blame^] | 38 | #include "X86Assembler.h" |
| 39 | #include "Profiler.h" |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 40 | #include <wtf/AlwaysInline.h> |
| 41 | #include <wtf/Vector.h> |
| 42 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 43 | #define CTI_ARGS_code 0x0C |
darin@apple.com | d3f4640 | 2008-10-04 21:12:54 +0000 | [diff] [blame] | 44 | #define CTI_ARGS_registerFile 0x0D |
darin@apple.com | 8c2bac0 | 2008-10-09 00:40:43 +0000 | [diff] [blame] | 45 | #define CTI_ARGS_callFrame 0x0E |
darin@apple.com | d3f4640 | 2008-10-04 21:12:54 +0000 | [diff] [blame] | 46 | #define CTI_ARGS_exception 0x0F |
| 47 | #define CTI_ARGS_profilerReference 0x10 |
| 48 | #define CTI_ARGS_globalData 0x11 |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 49 | |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 50 | #define ARG_callFrame static_cast<CallFrame*>(ARGS[CTI_ARGS_callFrame]) |
| 51 | #define ARG_registerFile static_cast<RegisterFile*>(ARGS[CTI_ARGS_registerFile]) |
darin@apple.com | 44331f8 | 2008-10-24 16:22:51 +0000 | [diff] [blame] | 52 | #define ARG_exception static_cast<JSValue**>(ARGS[CTI_ARGS_exception]) |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 53 | #define ARG_profilerReference static_cast<Profiler**>(ARGS[CTI_ARGS_profilerReference]) |
| 54 | #define ARG_globalData static_cast<JSGlobalData*>(ARGS[CTI_ARGS_globalData]) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 55 | |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 56 | #define ARG_setCallFrame(newCallFrame) (ARGS[CTI_ARGS_callFrame] = (newCallFrame)) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 57 | |
darin@apple.com | 5c465b0 | 2008-10-19 16:58:58 +0000 | [diff] [blame] | 58 | #define ARG_src1 static_cast<JSValue*>(ARGS[1]) |
| 59 | #define ARG_src2 static_cast<JSValue*>(ARGS[2]) |
| 60 | #define ARG_src3 static_cast<JSValue*>(ARGS[3]) |
| 61 | #define ARG_src4 static_cast<JSValue*>(ARGS[4]) |
| 62 | #define ARG_src5 static_cast<JSValue*>(ARGS[5]) |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 63 | #define ARG_id1 static_cast<Identifier*>(ARGS[1]) |
| 64 | #define ARG_id2 static_cast<Identifier*>(ARGS[2]) |
| 65 | #define ARG_id3 static_cast<Identifier*>(ARGS[3]) |
| 66 | #define ARG_id4 static_cast<Identifier*>(ARGS[4]) |
| 67 | #define ARG_int1 reinterpret_cast<intptr_t>(ARGS[1]) |
| 68 | #define ARG_int2 reinterpret_cast<intptr_t>(ARGS[2]) |
| 69 | #define ARG_int3 reinterpret_cast<intptr_t>(ARGS[3]) |
| 70 | #define ARG_int4 reinterpret_cast<intptr_t>(ARGS[4]) |
| 71 | #define ARG_int5 reinterpret_cast<intptr_t>(ARGS[5]) |
| 72 | #define ARG_int6 reinterpret_cast<intptr_t>(ARGS[6]) |
| 73 | #define ARG_func1 static_cast<FuncDeclNode*>(ARGS[1]) |
| 74 | #define ARG_funcexp1 static_cast<FuncExprNode*>(ARGS[1]) |
| 75 | #define ARG_registers1 static_cast<Register*>(ARGS[1]) |
| 76 | #define ARG_regexp1 static_cast<RegExp*>(ARGS[1]) |
| 77 | #define ARG_pni1 static_cast<JSPropertyNameIterator*>(ARGS[1]) |
| 78 | #define ARG_instr1 static_cast<Instruction*>(ARGS[1]) |
| 79 | #define ARG_instr2 static_cast<Instruction*>(ARGS[2]) |
| 80 | #define ARG_instr3 static_cast<Instruction*>(ARGS[3]) |
| 81 | #define ARG_instr4 static_cast<Instruction*>(ARGS[4]) |
| 82 | #define ARG_instr5 static_cast<Instruction*>(ARGS[5]) |
| 83 | #define ARG_instr6 static_cast<Instruction*>(ARGS[6]) |
barraclough@apple.com | 1bab56d | 2008-11-15 01:33:36 +0000 | [diff] [blame] | 84 | #define ARG_returnAddress2 static_cast<void*>(ARGS[2]) |
barraclough@apple.com | 52eea52 | 2008-11-07 01:30:03 +0000 | [diff] [blame] | 85 | #define ARG_codeBlock4 static_cast<CodeBlock*>(ARGS[4]) |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 86 | |
| 87 | #define CTI_RETURN_ADDRESS_SLOT (ARGS[-1]) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 88 | |
oliver@apple.com | 487b61b | 2008-10-30 04:33:21 +0000 | [diff] [blame] | 89 | #if COMPILER(MSVC) |
| 90 | #define FASTCALL __fastcall |
| 91 | #elif COMPILER(GCC) |
| 92 | #define FASTCALL __attribute__ ((fastcall)) |
| 93 | #else |
| 94 | #error Need to support fastcall calling convention in this compiler |
| 95 | #endif |
| 96 | |
cwzwarich@webkit.org | 3f782f6 | 2008-09-08 01:28:33 +0000 | [diff] [blame] | 97 | namespace JSC { |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 98 | |
| 99 | class CodeBlock; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 100 | class JSPropertyNameIterator; |
ggaren@apple.com | 031563e | 2008-11-17 02:21:16 +0000 | [diff] [blame] | 101 | class Interpreter; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 102 | class Register; |
| 103 | class RegisterFile; |
| 104 | class ScopeChainNode; |
| 105 | class SimpleJumpTable; |
| 106 | class StringJumpTable; |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 107 | class StructureChain; |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 108 | |
barraclough@apple.com | e964265 | 2008-10-23 22:29:54 +0000 | [diff] [blame] | 109 | struct CallLinkInfo; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 110 | struct Instruction; |
barraclough@apple.com | b8b15e2 | 2008-09-27 01:44:15 +0000 | [diff] [blame] | 111 | struct OperandTypes; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 112 | |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 113 | typedef JSValue* (SFX_CALL *CTIHelper_j)(CTI_ARGS); |
| 114 | typedef JSObject* (SFX_CALL *CTIHelper_o)(CTI_ARGS); |
mjs@apple.com | 36f4f42 | 2008-10-15 02:39:52 +0000 | [diff] [blame] | 115 | typedef JSPropertyNameIterator* (SFX_CALL *CTIHelper_p)(CTI_ARGS); |
| 116 | typedef void (SFX_CALL *CTIHelper_v)(CTI_ARGS); |
| 117 | typedef void* (SFX_CALL *CTIHelper_s)(CTI_ARGS); |
| 118 | typedef int (SFX_CALL *CTIHelper_b)(CTI_ARGS); |
| 119 | typedef VoidPtrPair (SFX_CALL *CTIHelper_2)(CTI_ARGS); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 120 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 121 | struct CallRecord { |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 122 | typedef X86Assembler::JmpSrc JmpSrc; |
| 123 | |
| 124 | JmpSrc from; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 125 | void* to; |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 126 | unsigned bytecodeIndex; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 127 | |
| 128 | CallRecord() |
| 129 | { |
| 130 | } |
| 131 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 132 | CallRecord(JmpSrc f, CTIHelper_j t, unsigned i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 133 | : from(f) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 134 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 135 | , bytecodeIndex(i) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 136 | { |
| 137 | } |
| 138 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 139 | CallRecord(JmpSrc f, CTIHelper_o t, unsigned i) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 140 | : from(f) |
| 141 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 142 | , bytecodeIndex(i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 143 | { |
| 144 | } |
| 145 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 146 | CallRecord(JmpSrc f, CTIHelper_p t, unsigned i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 147 | : from(f) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 148 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 149 | , bytecodeIndex(i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 150 | { |
| 151 | } |
| 152 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 153 | CallRecord(JmpSrc f, CTIHelper_v t, unsigned i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 154 | : from(f) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 155 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 156 | , bytecodeIndex(i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 157 | { |
| 158 | } |
| 159 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 160 | CallRecord(JmpSrc f, CTIHelper_s t, unsigned i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 161 | : from(f) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 162 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 163 | , bytecodeIndex(i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 164 | { |
| 165 | } |
| 166 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 167 | CallRecord(JmpSrc f, CTIHelper_b t, unsigned i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 168 | : from(f) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 169 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 170 | , bytecodeIndex(i) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 171 | { |
| 172 | } |
ggaren@apple.com | 107bd0e | 2008-09-24 00:27:18 +0000 | [diff] [blame] | 173 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 174 | CallRecord(JmpSrc f, CTIHelper_2 t, unsigned i) |
barraclough@apple.com | 79c9ae1 | 2008-10-07 20:27:50 +0000 | [diff] [blame] | 175 | : from(f) |
darin@apple.com | 40d7c81 | 2008-10-20 16:22:55 +0000 | [diff] [blame] | 176 | , to(reinterpret_cast<void*>(t)) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 177 | , bytecodeIndex(i) |
barraclough@apple.com | 79c9ae1 | 2008-10-07 20:27:50 +0000 | [diff] [blame] | 178 | { |
| 179 | } |
| 180 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 181 | CallRecord(JmpSrc f, unsigned i) |
ggaren@apple.com | 107bd0e | 2008-09-24 00:27:18 +0000 | [diff] [blame] | 182 | : from(f) |
| 183 | , to(0) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 184 | , bytecodeIndex(i) |
ggaren@apple.com | 107bd0e | 2008-09-24 00:27:18 +0000 | [diff] [blame] | 185 | { |
| 186 | } |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 187 | }; |
| 188 | |
| 189 | struct JmpTable { |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 190 | typedef X86Assembler::JmpSrc JmpSrc; |
| 191 | |
| 192 | JmpSrc from; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 193 | unsigned to; |
| 194 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 195 | JmpTable(JmpSrc f, unsigned t) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 196 | : from(f) |
| 197 | , to(t) |
| 198 | { |
| 199 | } |
| 200 | }; |
| 201 | |
| 202 | struct SlowCaseEntry { |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 203 | typedef X86Assembler::JmpSrc JmpSrc; |
| 204 | |
| 205 | JmpSrc from; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 206 | unsigned to; |
| 207 | unsigned hint; |
| 208 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 209 | SlowCaseEntry(JmpSrc f, unsigned t, unsigned h = 0) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 210 | : from(f) |
| 211 | , to(t) |
| 212 | , hint(h) |
| 213 | { |
| 214 | } |
| 215 | }; |
| 216 | |
| 217 | struct SwitchRecord { |
| 218 | enum Type { |
| 219 | Immediate, |
| 220 | Character, |
| 221 | String |
| 222 | }; |
| 223 | |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 224 | Type type; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 225 | |
| 226 | union { |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 227 | SimpleJumpTable* simpleJumpTable; |
| 228 | StringJumpTable* stringJumpTable; |
| 229 | } jumpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 230 | |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 231 | unsigned bytecodeIndex; |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 232 | unsigned defaultOffset; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 233 | |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 234 | SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeIndex, unsigned defaultOffset, Type type) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 235 | : type(type) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 236 | , bytecodeIndex(bytecodeIndex) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 237 | , defaultOffset(defaultOffset) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 238 | { |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 239 | this->jumpTable.simpleJumpTable = jumpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 240 | } |
| 241 | |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 242 | SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeIndex, unsigned defaultOffset) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 243 | : type(String) |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 244 | , bytecodeIndex(bytecodeIndex) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 245 | , defaultOffset(defaultOffset) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 246 | { |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 247 | this->jumpTable.stringJumpTable = jumpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 248 | } |
| 249 | }; |
| 250 | |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 251 | struct StructureStubCompilationInfo { |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 252 | typedef X86Assembler::JmpSrc JmpSrc; |
| 253 | typedef X86Assembler::JmpDst JmpDst; |
| 254 | |
| 255 | JmpSrc callReturnLocation; |
| 256 | JmpDst hotPathBegin; |
| 257 | JmpSrc hotPathOther; |
| 258 | JmpDst coldPathOther; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 259 | }; |
| 260 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 261 | extern "C" { |
darin@apple.com | 44331f8 | 2008-10-24 16:22:51 +0000 | [diff] [blame] | 262 | JSValue* ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue** exception, Profiler**, JSGlobalData*); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 263 | void ctiVMThrowTrampoline(); |
| 264 | }; |
| 265 | |
| 266 | void ctiSetReturnAddress(void** where, void* what); |
| 267 | void ctiRepatchCallByReturnAddress(void* where, void* what); |
| 268 | |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 269 | class JIT { |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 270 | typedef X86Assembler::RegisterID RegisterID; |
| 271 | typedef X86Assembler::XMMRegisterID XMMRegisterID; |
| 272 | typedef X86Assembler::JmpSrc JmpSrc; |
| 273 | typedef X86Assembler::JmpDst JmpDst; |
| 274 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 275 | static const int repatchGetByIdDefaultStructure = -1; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 276 | // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler |
| 277 | // will compress the displacement, and we may not be able to fit a repatched offset. |
| 278 | static const int repatchGetByIdDefaultOffset = 256; |
| 279 | |
mjs@apple.com | 36f4f42 | 2008-10-15 02:39:52 +0000 | [diff] [blame] | 280 | #if USE(FAST_CALL_CTI_ARGUMENT) |
oliver@apple.com | 6dc83fb | 2008-10-08 04:56:38 +0000 | [diff] [blame] | 281 | static const int ctiArgumentInitSize = 2; |
mjs@apple.com | 36f4f42 | 2008-10-15 02:39:52 +0000 | [diff] [blame] | 282 | #elif USE(CTI_ARGUMENT) |
| 283 | static const int ctiArgumentInitSize = 4; |
| 284 | #else |
| 285 | static const int ctiArgumentInitSize = 0; |
| 286 | #endif |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 287 | // These architecture specific value are used to enable repatching - see comment on op_put_by_id. |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 288 | static const int repatchOffsetPutByIdStructure = 7; |
mjs@apple.com | e32adbc | 2008-11-13 12:53:35 +0000 | [diff] [blame] | 289 | static const int repatchOffsetPutByIdPropertyMapOffset = 22; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 290 | // These architecture specific value are used to enable repatching - see comment on op_get_by_id. |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 291 | static const int repatchOffsetGetByIdStructure = 7; |
mjs@apple.com | e32adbc | 2008-11-13 12:53:35 +0000 | [diff] [blame] | 292 | static const int repatchOffsetGetByIdBranchToSlowCase = 13; |
| 293 | static const int repatchOffsetGetByIdPropertyMapOffset = 22; |
ggaren@apple.com | 47d3f05 | 2008-11-15 21:37:49 +0000 | [diff] [blame] | 294 | #if ENABLE(OPCODE_SAMPLING) |
mjs@apple.com | 0d68a33 | 2008-10-17 09:06:42 +0000 | [diff] [blame] | 295 | static const int repatchOffsetGetByIdSlowCaseCall = 27 + 4 + ctiArgumentInitSize; |
barraclough@apple.com | 6bd3e165 | 2008-10-05 17:38:32 +0000 | [diff] [blame] | 296 | #else |
mjs@apple.com | 0d68a33 | 2008-10-17 09:06:42 +0000 | [diff] [blame] | 297 | static const int repatchOffsetGetByIdSlowCaseCall = 17 + 4 + ctiArgumentInitSize; |
barraclough@apple.com | 6bd3e165 | 2008-10-05 17:38:32 +0000 | [diff] [blame] | 298 | #endif |
barraclough@apple.com | 3a4eb9b | 2008-10-18 02:51:52 +0000 | [diff] [blame] | 299 | static const int repatchOffsetOpCallCall = 6; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 300 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 301 | public: |
barraclough@apple.com | 7c876fc | 2008-11-11 05:09:46 +0000 | [diff] [blame] | 302 | static void compile(JSGlobalData* globalData, CodeBlock* codeBlock) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 303 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 304 | JIT jit(globalData, codeBlock); |
| 305 | jit.privateCompile(); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 306 | } |
| 307 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 308 | static void compileGetByIdSelf(JSGlobalData* globalData, CodeBlock* codeBlock, Structure* structure, size_t cachedOffset, void* returnAddress) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 309 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 310 | JIT jit(globalData, codeBlock); |
| 311 | jit.privateCompileGetByIdSelf(structure, cachedOffset, returnAddress); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 312 | } |
| 313 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 314 | static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, void* returnAddress) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 315 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 316 | JIT jit(globalData, codeBlock); |
| 317 | jit.privateCompileGetByIdProto(structure, prototypeStructure, cachedOffset, returnAddress, callFrame); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 318 | } |
| 319 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 320 | static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, void* returnAddress) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 321 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 322 | JIT jit(globalData, codeBlock); |
| 323 | jit.privateCompileGetByIdChain(structure, chain, count, cachedOffset, returnAddress, callFrame); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 324 | } |
| 325 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 326 | static void compilePutByIdReplace(JSGlobalData* globalData, CodeBlock* codeBlock, Structure* structure, size_t cachedOffset, void* returnAddress) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 327 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 328 | JIT jit(globalData, codeBlock); |
| 329 | jit.privateCompilePutByIdReplace(structure, cachedOffset, returnAddress); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 330 | } |
oliver@apple.com | e3c5d0e | 2008-09-14 08:18:49 +0000 | [diff] [blame] | 331 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 332 | static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, void* returnAddress) |
oliver@apple.com | e3c5d0e | 2008-09-14 08:18:49 +0000 | [diff] [blame] | 333 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 334 | JIT jit(globalData, codeBlock); |
| 335 | jit.privateCompilePutByIdTransition(oldStructure, newStructure, cachedOffset, chain, returnAddress); |
oliver@apple.com | e3c5d0e | 2008-09-14 08:18:49 +0000 | [diff] [blame] | 336 | } |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 337 | |
barraclough@apple.com | 7c876fc | 2008-11-11 05:09:46 +0000 | [diff] [blame] | 338 | static void compileCTIMachineTrampolines(JSGlobalData* globalData) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 339 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 340 | JIT jit(globalData); |
| 341 | jit.privateCompileCTIMachineTrampolines(); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 342 | } |
ggaren@apple.com | 031563e | 2008-11-17 02:21:16 +0000 | [diff] [blame] | 343 | static void freeCTIMachineTrampolines(Interpreter*); |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 344 | |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 345 | static void patchGetByIdSelf(CodeBlock* codeBlock, Structure* structure, size_t cachedOffset, void* returnAddress); |
| 346 | static void patchPutByIdReplace(CodeBlock* codeBlock, Structure* structure, size_t cachedOffset, void* returnAddress); |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 347 | |
barraclough@apple.com | 7c876fc | 2008-11-11 05:09:46 +0000 | [diff] [blame] | 348 | static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, void* returnAddress) |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 349 | { |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 350 | JIT jit(globalData, codeBlock); |
| 351 | return jit.privateCompilePatchGetArrayLength(returnAddress); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 352 | } |
| 353 | |
barraclough@apple.com | e964265 | 2008-10-23 22:29:54 +0000 | [diff] [blame] | 354 | static void linkCall(JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, CallLinkInfo* callLinkInfo, int callerArgCount); |
| 355 | static void unlinkCall(CallLinkInfo*); |
barraclough@apple.com | 3a4eb9b | 2008-10-18 02:51:52 +0000 | [diff] [blame] | 356 | |
darin@apple.com | 44331f8 | 2008-10-24 16:22:51 +0000 | [diff] [blame] | 357 | inline static JSValue* execute(void* code, RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData, JSValue** exception) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 358 | { |
darin@apple.com | 8c2bac0 | 2008-10-09 00:40:43 +0000 | [diff] [blame] | 359 | return ctiTrampoline(code, registerFile, callFrame, exception, Profiler::enabledProfilerReference(), globalData); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | private: |
ggaren@apple.com | 4f7d7a9 | 2008-11-17 03:34:05 +0000 | [diff] [blame] | 363 | JIT(JSGlobalData*, CodeBlock* = 0); |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 364 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 365 | void privateCompileMainPass(); |
| 366 | void privateCompileLinkPass(); |
| 367 | void privateCompileSlowCases(); |
| 368 | void privateCompile(); |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 369 | void privateCompileGetByIdSelf(Structure*, size_t cachedOffset, void* returnAddress); |
| 370 | void privateCompileGetByIdProto(Structure*, Structure* prototypeStructure, size_t cachedOffset, void* returnAddress, CallFrame* callFrame); |
| 371 | void privateCompileGetByIdChain(Structure*, StructureChain*, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame); |
| 372 | void privateCompilePutByIdReplace(Structure*, size_t cachedOffset, void* returnAddress); |
| 373 | void privateCompilePutByIdTransition(Structure*, Structure*, size_t cachedOffset, StructureChain*, void* returnAddress); |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 374 | |
barraclough@apple.com | 7c876fc | 2008-11-11 05:09:46 +0000 | [diff] [blame] | 375 | void privateCompileCTIMachineTrampolines(); |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 376 | void privateCompilePatchGetArrayLength(void* returnAddress); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 377 | |
ggaren@apple.com | 47d3f05 | 2008-11-15 21:37:49 +0000 | [diff] [blame] | 378 | void compileOpCall(OpcodeID, Instruction* instruction, unsigned i, unsigned callLinkInfoIndex); |
barraclough@apple.com | 1bab56d | 2008-11-15 01:33:36 +0000 | [diff] [blame] | 379 | void compileOpCallInitializeCallFrame(); |
ggaren@apple.com | 68313b0 | 2008-11-13 00:48:23 +0000 | [diff] [blame] | 380 | void compileOpCallSetupArgs(Instruction*); |
| 381 | void compileOpCallEvalSetupArgs(Instruction*); |
| 382 | void compileOpConstructSetupArgs(Instruction*); |
mjs@apple.com | db29af2 | 2008-09-23 13:20:23 +0000 | [diff] [blame] | 383 | enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq }; |
| 384 | void compileOpStrictEq(Instruction* instruction, unsigned i, CompileOpStrictEqType type); |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 385 | void putDoubleResultToJSNumberCellOrJSImmediate(XMMRegisterID xmmSource, RegisterID jsNumberCell, unsigned dst, JmpSrc* wroteJSNumberCell, XMMRegisterID tempXmm, RegisterID tempReg1, RegisterID tempReg2); |
ggaren@apple.com | 47d3f05 | 2008-11-15 21:37:49 +0000 | [diff] [blame] | 386 | void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i); |
| 387 | void compileBinaryArithOpSlowCase(Instruction*, OpcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 388 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 389 | void emitGetVirtualRegister(int src, RegisterID dst, unsigned i); |
| 390 | void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2, unsigned i); |
| 391 | void emitPutVirtualRegister(unsigned dst, RegisterID from = X86::eax); |
barraclough@apple.com | a552451 | 2008-11-15 02:51:39 +0000 | [diff] [blame] | 392 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 393 | void emitPutCTIArg(RegisterID src, unsigned offset); |
| 394 | void emitPutCTIArgFromVirtualRegister(unsigned src, unsigned offset, RegisterID scratch); |
barraclough@apple.com | a552451 | 2008-11-15 02:51:39 +0000 | [diff] [blame] | 395 | void emitPutCTIArgConstant(unsigned value, unsigned offset); |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 396 | void emitGetCTIArg(unsigned offset, RegisterID dst); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 397 | |
ggaren@apple.com | 107bd0e | 2008-09-24 00:27:18 +0000 | [diff] [blame] | 398 | void emitInitRegister(unsigned dst); |
oliver@apple.com | ecfd224 | 2008-09-20 03:00:43 +0000 | [diff] [blame] | 399 | |
barraclough@apple.com | ce5a0b3 | 2008-09-16 17:40:01 +0000 | [diff] [blame] | 400 | void emitPutCTIParam(void* value, unsigned name); |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 401 | void emitPutCTIParam(RegisterID from, unsigned name); |
| 402 | void emitGetCTIParam(unsigned name, RegisterID to); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 403 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 404 | void emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry); |
| 405 | void emitGetFromCallFrameHeader(RegisterFile::CallFrameHeaderEntry entry, RegisterID to); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 406 | |
darin@apple.com | 44331f8 | 2008-10-24 16:22:51 +0000 | [diff] [blame] | 407 | JSValue* getConstantImmediateNumericArg(unsigned src); |
| 408 | unsigned getDeTaggedConstantImmediate(JSValue* imm); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 409 | |
mjs@apple.com | e32adbc | 2008-11-13 12:53:35 +0000 | [diff] [blame] | 410 | bool linkSlowCaseIfNotJSCell(const Vector<SlowCaseEntry>::iterator&, int vReg); |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 411 | void emitJumpSlowCaseIfNotJSCell(RegisterID, unsigned bytecodeIndex); |
| 412 | void emitJumpSlowCaseIfNotJSCell(RegisterID, unsigned bytecodeIndex, int VReg); |
weinig@apple.com | 262302f | 2008-09-16 03:46:58 +0000 | [diff] [blame] | 413 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 414 | void emitJumpSlowCaseIfNotImmNum(RegisterID, unsigned bytecodeIndex); |
| 415 | void emitJumpSlowCaseIfNotImmNums(RegisterID, RegisterID, unsigned bytecodeIndex); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 416 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 417 | void emitFastArithDeTagImmediate(RegisterID); |
| 418 | JmpSrc emitFastArithDeTagImmediateJumpIfZero(RegisterID); |
| 419 | void emitFastArithReTagImmediate(RegisterID); |
| 420 | void emitFastArithPotentiallyReTagImmediate(RegisterID); |
| 421 | void emitFastArithImmToInt(RegisterID); |
| 422 | void emitFastArithIntToImmOrSlowCase(RegisterID, unsigned bytecodeIndex); |
| 423 | void emitFastArithIntToImmNoCheck(RegisterID); |
| 424 | JmpSrc emitArithIntToImmWithJump(RegisterID reg); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 425 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 426 | void emitTagAsBoolImmediate(RegisterID reg); |
mjs@apple.com | 4032873 | 2008-09-21 10:39:29 +0000 | [diff] [blame] | 427 | |
oliver@apple.com | 487b61b | 2008-10-30 04:33:21 +0000 | [diff] [blame] | 428 | void emitAllocateNumber(JSGlobalData*, unsigned); |
| 429 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 430 | JmpSrc emitNakedCall(unsigned bytecodeIndex, RegisterID); |
| 431 | JmpSrc emitNakedCall(unsigned bytecodeIndex, void* function); |
| 432 | JmpSrc emitNakedFastCall(unsigned bytecodeIndex, void*); |
| 433 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_j); |
| 434 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_o); |
| 435 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_p); |
| 436 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_v); |
| 437 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_s); |
| 438 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_b); |
| 439 | JmpSrc emitCTICall(Instruction*, unsigned bytecodeIndex, CTIHelper_2); |
barraclough@apple.com | 79c9ae1 | 2008-10-07 20:27:50 +0000 | [diff] [blame] | 440 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 441 | void emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst); |
| 442 | void emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index); |
oliver@apple.com | 957eefc | 2008-09-10 09:23:35 +0000 | [diff] [blame] | 443 | |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 444 | void emitSlowScriptCheck(Instruction*, unsigned bytecodeIndex); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 445 | #ifndef NDEBUG |
ggaren@apple.com | 77dd3c6 | 2008-11-15 20:34:40 +0000 | [diff] [blame] | 446 | void printBytecodeOperandTypes(unsigned src1, unsigned src2); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 447 | #endif |
| 448 | |
cwzwarich@webkit.org | eacadfb | 2008-11-13 11:26:38 +0000 | [diff] [blame] | 449 | void killLastResultRegister(); |
| 450 | |
ggaren@apple.com | 4d997cb | 2008-11-15 22:43:27 +0000 | [diff] [blame] | 451 | X86Assembler m_assembler; |
ggaren@apple.com | 031563e | 2008-11-17 02:21:16 +0000 | [diff] [blame] | 452 | Interpreter* m_interpreter; |
barraclough@apple.com | 7c876fc | 2008-11-11 05:09:46 +0000 | [diff] [blame] | 453 | JSGlobalData* m_globalData; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 454 | CodeBlock* m_codeBlock; |
| 455 | |
| 456 | Vector<CallRecord> m_calls; |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 457 | Vector<JmpDst> m_labels; |
barraclough@apple.com | e964265 | 2008-10-23 22:29:54 +0000 | [diff] [blame] | 458 | Vector<StructureStubCompilationInfo> m_propertyAccessCompilationInfo; |
| 459 | Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 460 | Vector<JmpTable> m_jmpTable; |
| 461 | |
| 462 | struct JSRInfo { |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 463 | JmpDst addrPosition; |
| 464 | JmpDst target; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 465 | |
ggaren@apple.com | 0bbea11 | 2008-11-17 03:21:12 +0000 | [diff] [blame] | 466 | JSRInfo(const JmpDst& storeLocation, const JmpDst& targetLocation) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 467 | : addrPosition(storeLocation) |
| 468 | , target(targetLocation) |
| 469 | { |
| 470 | } |
| 471 | }; |
| 472 | |
| 473 | Vector<JSRInfo> m_jsrSites; |
| 474 | Vector<SlowCaseEntry> m_slowCases; |
| 475 | Vector<SwitchRecord> m_switches; |
| 476 | |
cwzwarich@webkit.org | eacadfb | 2008-11-13 11:26:38 +0000 | [diff] [blame] | 477 | int m_lastResultBytecodeRegister; |
| 478 | unsigned m_jumpTargetsPosition; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 479 | }; |
| 480 | } |
| 481 | |
ggaren@apple.com | f272d2d | 2008-11-17 04:25:37 +0000 | [diff] [blame^] | 482 | #endif // ENABLE(JIT) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 483 | |
| 484 | #endif // CTI_h |