fpizlo@apple.com | 64b9285 | 2012-02-26 00:19:07 +0000 | [diff] [blame] | 1 | # Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 2 | # |
| 3 | # Redistribution and use in source and binary forms, with or without |
| 4 | # modification, are permitted provided that the following conditions |
| 5 | # are met: |
| 6 | # 1. Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # 2. Redistributions in binary form must reproduce the above copyright |
| 9 | # notice, this list of conditions and the following disclaimer in the |
| 10 | # documentation and/or other materials provided with the distribution. |
| 11 | # |
| 12 | # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 13 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 14 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 15 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 16 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 17 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 18 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 19 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 20 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 21 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 22 | # THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | |
| 24 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 25 | # Some value representation constants. |
| 26 | const TagBitTypeOther = 0x2 |
| 27 | const TagBitBool = 0x4 |
| 28 | const TagBitUndefined = 0x8 |
| 29 | const ValueEmpty = 0x0 |
| 30 | const ValueFalse = TagBitTypeOther | TagBitBool |
| 31 | const ValueTrue = TagBitTypeOther | TagBitBool | 1 |
| 32 | const ValueUndefined = TagBitTypeOther | TagBitUndefined |
| 33 | const ValueNull = TagBitTypeOther |
| 34 | |
| 35 | # Utilities. |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 36 | macro jumpToInstruction() |
| 37 | jmp [PB, PC, 8] |
| 38 | end |
| 39 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 40 | macro dispatch(advance) |
| 41 | addp advance, PC |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 42 | jumpToInstruction() |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 43 | end |
| 44 | |
| 45 | macro dispatchInt(advance) |
| 46 | addi advance, PC |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 47 | jumpToInstruction() |
| 48 | end |
| 49 | |
| 50 | macro dispatchIntIndirect(offset) |
| 51 | dispatchInt(offset * 8[PB, PC, 8]) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 52 | end |
| 53 | |
| 54 | macro dispatchAfterCall() |
| 55 | loadi ArgumentCount + TagOffset[cfr], PC |
| 56 | loadp CodeBlock[cfr], PB |
| 57 | loadp CodeBlock::m_instructions[PB], PB |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 58 | jumpToInstruction() |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 59 | end |
| 60 | |
| 61 | macro cCall2(function, arg1, arg2) |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 62 | if X86_64 |
| 63 | move arg1, t5 |
| 64 | move arg2, t4 |
| 65 | call function |
commit-queue@webkit.org | e13567f | 2012-09-01 17:36:51 +0000 | [diff] [blame] | 66 | elsif C_LOOP |
| 67 | cloopCallSlowPath function, arg1, arg2 |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 68 | else |
| 69 | error |
| 70 | end |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 71 | end |
| 72 | |
| 73 | # This barely works. arg3 and arg4 should probably be immediates. |
| 74 | macro cCall4(function, arg1, arg2, arg3, arg4) |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 75 | if X86_64 |
| 76 | move arg1, t5 |
| 77 | move arg2, t4 |
| 78 | move arg3, t1 |
| 79 | move arg4, t2 |
| 80 | call function |
commit-queue@webkit.org | e13567f | 2012-09-01 17:36:51 +0000 | [diff] [blame] | 81 | elsif C_LOOP |
| 82 | error |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 83 | else |
| 84 | error |
| 85 | end |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 86 | end |
| 87 | |
| 88 | macro prepareStateForCCall() |
| 89 | leap [PB, PC, 8], PC |
| 90 | move PB, t3 |
| 91 | end |
| 92 | |
| 93 | macro restoreStateAfterCCall() |
| 94 | move t0, PC |
| 95 | move t1, cfr |
| 96 | move t3, PB |
| 97 | subp PB, PC |
mark.lam@apple.com | 996d628 | 2012-10-31 22:40:43 +0000 | [diff] [blame] | 98 | rshiftp 3, PC |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 99 | end |
| 100 | |
| 101 | macro callSlowPath(slowPath) |
| 102 | prepareStateForCCall() |
| 103 | cCall2(slowPath, cfr, PC) |
| 104 | restoreStateAfterCCall() |
| 105 | end |
| 106 | |
| 107 | macro traceOperand(fromWhere, operand) |
| 108 | prepareStateForCCall() |
| 109 | cCall4(_llint_trace_operand, cfr, PC, fromWhere, operand) |
| 110 | restoreStateAfterCCall() |
| 111 | end |
| 112 | |
| 113 | macro traceValue(fromWhere, operand) |
| 114 | prepareStateForCCall() |
| 115 | cCall4(_llint_trace_value, cfr, PC, fromWhere, operand) |
| 116 | restoreStateAfterCCall() |
| 117 | end |
| 118 | |
| 119 | # Call a slow path for call call opcodes. |
| 120 | macro callCallSlowPath(advance, slowPath, action) |
| 121 | addi advance, PC, t0 |
| 122 | storei t0, ArgumentCount + TagOffset[cfr] |
| 123 | prepareStateForCCall() |
| 124 | cCall2(slowPath, cfr, PC) |
| 125 | move t1, cfr |
| 126 | action(t0) |
| 127 | end |
| 128 | |
mark.lam@apple.com | dff6b22 | 2013-04-17 22:37:45 +0000 | [diff] [blame^] | 129 | macro callWatchdogTimerHandler() |
| 130 | storei PC, ArgumentCount + TagOffset[cfr] |
| 131 | prepareStateForCCall() |
| 132 | cCall2(_llint_slow_path_handle_watchdog_timer, cfr, PC) |
| 133 | move t1, cfr |
| 134 | btpnz t0, _llint_throw_from_slow_path_trampoline |
| 135 | move t3, PB |
| 136 | loadi ArgumentCount + TagOffset[cfr], PC |
| 137 | end |
| 138 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 139 | macro checkSwitchToJITForLoop() |
| 140 | checkSwitchToJIT( |
| 141 | 1, |
| 142 | macro() |
| 143 | storei PC, ArgumentCount + TagOffset[cfr] |
| 144 | prepareStateForCCall() |
| 145 | cCall2(_llint_loop_osr, cfr, PC) |
| 146 | move t1, cfr |
| 147 | btpz t0, .recover |
| 148 | jmp t0 |
| 149 | .recover: |
fpizlo@apple.com | 2c2536e | 2012-03-21 01:29:28 +0000 | [diff] [blame] | 150 | move t3, PB |
| 151 | loadi ArgumentCount + TagOffset[cfr], PC |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 152 | end) |
| 153 | end |
| 154 | |
| 155 | # Index and value must be different registers. Index may be clobbered. |
| 156 | macro loadConstantOrVariable(index, value) |
| 157 | bpgteq index, FirstConstantRegisterIndex, .constant |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 158 | loadq [cfr, index, 8], value |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 159 | jmp .done |
| 160 | .constant: |
| 161 | loadp CodeBlock[cfr], value |
| 162 | loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value |
| 163 | subp FirstConstantRegisterIndex, index |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 164 | loadq [value, index, 8], value |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 165 | .done: |
| 166 | end |
| 167 | |
| 168 | macro loadConstantOrVariableInt32(index, value, slow) |
| 169 | loadConstantOrVariable(index, value) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 170 | bqb value, tagTypeNumber, slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 171 | end |
| 172 | |
| 173 | macro loadConstantOrVariableCell(index, value, slow) |
| 174 | loadConstantOrVariable(index, value) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 175 | btqnz value, tagMask, slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 176 | end |
| 177 | |
| 178 | macro writeBarrier(value) |
| 179 | # Nothing to do, since we don't have a generational or incremental collector. |
| 180 | end |
| 181 | |
| 182 | macro valueProfile(value, profile) |
| 183 | if VALUE_PROFILER |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 184 | storeq value, ValueProfile::m_buckets[profile] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 185 | end |
| 186 | end |
| 187 | |
| 188 | |
| 189 | # Entrypoints into the interpreter. |
| 190 | |
| 191 | # Expects that CodeBlock is in t1, which is what prologue() leaves behind. |
| 192 | macro functionArityCheck(doneLabel, slow_path) |
| 193 | loadi PayloadOffset + ArgumentCount[cfr], t0 |
| 194 | biaeq t0, CodeBlock::m_numParameters[t1], doneLabel |
| 195 | prepareStateForCCall() |
| 196 | cCall2(slow_path, cfr, PC) # This slow_path has a simple protocol: t0 = 0 => no error, t0 != 0 => error |
| 197 | move t1, cfr |
| 198 | btiz t0, .continue |
| 199 | loadp JITStackFrame::globalData[sp], t1 |
| 200 | loadp JSGlobalData::callFrameForThrow[t1], t0 |
| 201 | jmp JSGlobalData::targetMachinePCForThrow[t1] |
| 202 | .continue: |
| 203 | # Reload CodeBlock and reset PC, since the slow_path clobbered them. |
| 204 | loadp CodeBlock[cfr], t1 |
| 205 | loadp CodeBlock::m_instructions[t1], PB |
| 206 | move 0, PC |
| 207 | jmp doneLabel |
| 208 | end |
| 209 | |
| 210 | |
| 211 | # Instruction implementations |
| 212 | |
| 213 | _llint_op_enter: |
| 214 | traceExecution() |
commit-queue@webkit.org | 782c20b | 2012-07-14 00:44:47 +0000 | [diff] [blame] | 215 | loadp CodeBlock[cfr], t2 // t2<CodeBlock> = cfr.CodeBlock |
| 216 | loadi CodeBlock::m_numVars[t2], t2 // t2<size_t> = t2<CodeBlock>.m_numVars |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 217 | btiz t2, .opEnterDone |
| 218 | move ValueUndefined, t0 |
| 219 | .opEnterLoop: |
| 220 | subi 1, t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 221 | storeq t0, [cfr, t2, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 222 | btinz t2, .opEnterLoop |
| 223 | .opEnterDone: |
| 224 | dispatch(1) |
| 225 | |
| 226 | |
| 227 | _llint_op_create_activation: |
| 228 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 229 | loadisFromInstruction(1, t0) |
| 230 | bqneq [cfr, t0, 8], ValueEmpty, .opCreateActivationDone |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 231 | callSlowPath(_llint_slow_path_create_activation) |
| 232 | .opCreateActivationDone: |
| 233 | dispatch(2) |
| 234 | |
| 235 | |
| 236 | _llint_op_init_lazy_reg: |
| 237 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 238 | loadisFromInstruction(1, t0) |
| 239 | storeq ValueEmpty, [cfr, t0, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 240 | dispatch(2) |
| 241 | |
| 242 | |
| 243 | _llint_op_create_arguments: |
| 244 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 245 | loadisFromInstruction(1, t0) |
| 246 | bqneq [cfr, t0, 8], ValueEmpty, .opCreateArgumentsDone |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 247 | callSlowPath(_llint_slow_path_create_arguments) |
| 248 | .opCreateArgumentsDone: |
| 249 | dispatch(2) |
| 250 | |
| 251 | |
| 252 | _llint_op_create_this: |
| 253 | traceExecution() |
fpizlo@apple.com | a1fe26b | 2012-11-13 06:04:51 +0000 | [diff] [blame] | 254 | loadisFromInstruction(2, t0) |
| 255 | loadp [cfr, t0, 8], t0 |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 256 | loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_allocator[t0], t1 |
| 257 | loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_structure[t0], t2 |
| 258 | btpz t1, .opCreateThisSlow |
| 259 | allocateJSObject(t1, t2, t0, t3, .opCreateThisSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 260 | loadisFromInstruction(1, t1) |
| 261 | storeq t0, [cfr, t1, 8] |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 262 | dispatch(4) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 263 | |
| 264 | .opCreateThisSlow: |
| 265 | callSlowPath(_llint_slow_path_create_this) |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 266 | dispatch(4) |
fpizlo@apple.com | a1fe26b | 2012-11-13 06:04:51 +0000 | [diff] [blame] | 267 | |
| 268 | |
| 269 | _llint_op_get_callee: |
| 270 | traceExecution() |
fpizlo@apple.com | 868ba36 | 2012-11-13 08:42:47 +0000 | [diff] [blame] | 271 | loadisFromInstruction(1, t0) |
| 272 | loadpFromInstruction(2, t2) |
fpizlo@apple.com | a1fe26b | 2012-11-13 06:04:51 +0000 | [diff] [blame] | 273 | loadp Callee[cfr], t1 |
fpizlo@apple.com | 868ba36 | 2012-11-13 08:42:47 +0000 | [diff] [blame] | 274 | valueProfile(t1, t2) |
fpizlo@apple.com | a1fe26b | 2012-11-13 06:04:51 +0000 | [diff] [blame] | 275 | storep t1, [cfr, t0, 8] |
fpizlo@apple.com | 868ba36 | 2012-11-13 08:42:47 +0000 | [diff] [blame] | 276 | dispatch(3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 277 | |
| 278 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 279 | _llint_op_convert_this: |
| 280 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 281 | loadisFromInstruction(1, t0) |
| 282 | loadq [cfr, t0, 8], t0 |
| 283 | btqnz t0, tagMask, .opConvertThisSlow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 284 | loadp JSCell::m_structure[t0], t0 |
| 285 | bbb Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 286 | loadpFromInstruction(2, t1) |
fpizlo@apple.com | 016fd68 | 2012-05-25 20:19:55 +0000 | [diff] [blame] | 287 | valueProfile(t0, t1) |
| 288 | dispatch(3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 289 | |
| 290 | .opConvertThisSlow: |
| 291 | callSlowPath(_llint_slow_path_convert_this) |
fpizlo@apple.com | 016fd68 | 2012-05-25 20:19:55 +0000 | [diff] [blame] | 292 | dispatch(3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 293 | |
| 294 | |
| 295 | _llint_op_new_object: |
| 296 | traceExecution() |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 297 | loadpFromInstruction(3, t0) |
| 298 | loadp ObjectAllocationProfile::m_allocator[t0], t1 |
| 299 | loadp ObjectAllocationProfile::m_structure[t0], t2 |
| 300 | allocateJSObject(t1, t2, t0, t3, .opNewObjectSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 301 | loadisFromInstruction(1, t1) |
| 302 | storeq t0, [cfr, t1, 8] |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 303 | dispatch(4) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 304 | |
| 305 | .opNewObjectSlow: |
| 306 | callSlowPath(_llint_slow_path_new_object) |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 307 | dispatch(4) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 308 | |
| 309 | |
| 310 | _llint_op_mov: |
| 311 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 312 | loadisFromInstruction(2, t1) |
| 313 | loadisFromInstruction(1, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 314 | loadConstantOrVariable(t1, t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 315 | storeq t2, [cfr, t0, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 316 | dispatch(3) |
| 317 | |
| 318 | |
| 319 | _llint_op_not: |
| 320 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 321 | loadisFromInstruction(2, t0) |
| 322 | loadisFromInstruction(1, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 323 | loadConstantOrVariable(t0, t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 324 | xorq ValueFalse, t2 |
| 325 | btqnz t2, ~1, .opNotSlow |
| 326 | xorq ValueTrue, t2 |
| 327 | storeq t2, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 328 | dispatch(3) |
| 329 | |
| 330 | .opNotSlow: |
| 331 | callSlowPath(_llint_slow_path_not) |
| 332 | dispatch(3) |
| 333 | |
| 334 | |
| 335 | macro equalityComparison(integerComparison, slowPath) |
| 336 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 337 | loadisFromInstruction(3, t0) |
| 338 | loadisFromInstruction(2, t2) |
| 339 | loadisFromInstruction(1, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 340 | loadConstantOrVariableInt32(t0, t1, .slow) |
| 341 | loadConstantOrVariableInt32(t2, t0, .slow) |
| 342 | integerComparison(t0, t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 343 | orq ValueFalse, t0 |
| 344 | storeq t0, [cfr, t3, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 345 | dispatch(4) |
| 346 | |
| 347 | .slow: |
| 348 | callSlowPath(slowPath) |
| 349 | dispatch(4) |
| 350 | end |
| 351 | |
| 352 | _llint_op_eq: |
| 353 | equalityComparison( |
| 354 | macro (left, right, result) cieq left, right, result end, |
| 355 | _llint_slow_path_eq) |
| 356 | |
| 357 | |
| 358 | _llint_op_neq: |
| 359 | equalityComparison( |
| 360 | macro (left, right, result) cineq left, right, result end, |
| 361 | _llint_slow_path_neq) |
| 362 | |
| 363 | |
| 364 | macro equalNullComparison() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 365 | loadisFromInstruction(2, t0) |
| 366 | loadq [cfr, t0, 8], t0 |
| 367 | btqnz t0, tagMask, .immediate |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 368 | loadp JSCell::m_structure[t0], t2 |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 369 | btbnz Structure::m_typeInfo + TypeInfo::m_flags[t2], MasqueradesAsUndefined, .masqueradesAsUndefined |
| 370 | move 0, t0 |
| 371 | jmp .done |
| 372 | .masqueradesAsUndefined: |
| 373 | loadp CodeBlock[cfr], t0 |
| 374 | loadp CodeBlock::m_globalObject[t0], t0 |
| 375 | cpeq Structure::m_globalObject[t2], t0, t0 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 376 | jmp .done |
| 377 | .immediate: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 378 | andq ~TagBitUndefined, t0 |
| 379 | cqeq t0, ValueNull, t0 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 380 | .done: |
| 381 | end |
| 382 | |
| 383 | _llint_op_eq_null: |
| 384 | traceExecution() |
| 385 | equalNullComparison() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 386 | loadisFromInstruction(1, t1) |
| 387 | orq ValueFalse, t0 |
| 388 | storeq t0, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 389 | dispatch(3) |
| 390 | |
| 391 | |
| 392 | _llint_op_neq_null: |
| 393 | traceExecution() |
| 394 | equalNullComparison() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 395 | loadisFromInstruction(1, t1) |
| 396 | xorq ValueTrue, t0 |
| 397 | storeq t0, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 398 | dispatch(3) |
| 399 | |
| 400 | |
| 401 | macro strictEq(equalityOperation, slowPath) |
| 402 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 403 | loadisFromInstruction(3, t0) |
| 404 | loadisFromInstruction(2, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 405 | loadConstantOrVariable(t0, t1) |
| 406 | loadConstantOrVariable(t2, t0) |
| 407 | move t0, t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 408 | orq t1, t2 |
| 409 | btqz t2, tagMask, .slow |
| 410 | bqaeq t0, tagTypeNumber, .leftOK |
| 411 | btqnz t0, tagTypeNumber, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 412 | .leftOK: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 413 | bqaeq t1, tagTypeNumber, .rightOK |
| 414 | btqnz t1, tagTypeNumber, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 415 | .rightOK: |
| 416 | equalityOperation(t0, t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 417 | loadisFromInstruction(1, t1) |
| 418 | orq ValueFalse, t0 |
| 419 | storeq t0, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 420 | dispatch(4) |
| 421 | |
| 422 | .slow: |
| 423 | callSlowPath(slowPath) |
| 424 | dispatch(4) |
| 425 | end |
| 426 | |
| 427 | _llint_op_stricteq: |
| 428 | strictEq( |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 429 | macro (left, right, result) cqeq left, right, result end, |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 430 | _llint_slow_path_stricteq) |
| 431 | |
| 432 | |
| 433 | _llint_op_nstricteq: |
| 434 | strictEq( |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 435 | macro (left, right, result) cqneq left, right, result end, |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 436 | _llint_slow_path_nstricteq) |
| 437 | |
| 438 | |
| 439 | macro preOp(arithmeticOperation, slowPath) |
| 440 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 441 | loadisFromInstruction(1, t0) |
| 442 | loadq [cfr, t0, 8], t1 |
| 443 | bqb t1, tagTypeNumber, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 444 | arithmeticOperation(t1, .slow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 445 | orq tagTypeNumber, t1 |
| 446 | storeq t1, [cfr, t0, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 447 | dispatch(2) |
| 448 | |
| 449 | .slow: |
| 450 | callSlowPath(slowPath) |
| 451 | dispatch(2) |
| 452 | end |
| 453 | |
| 454 | _llint_op_pre_inc: |
| 455 | preOp( |
| 456 | macro (value, slow) baddio 1, value, slow end, |
| 457 | _llint_slow_path_pre_inc) |
| 458 | |
| 459 | |
| 460 | _llint_op_pre_dec: |
| 461 | preOp( |
| 462 | macro (value, slow) bsubio 1, value, slow end, |
| 463 | _llint_slow_path_pre_dec) |
| 464 | |
| 465 | |
| 466 | macro postOp(arithmeticOperation, slowPath) |
| 467 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 468 | loadisFromInstruction(2, t0) |
| 469 | loadisFromInstruction(1, t1) |
| 470 | loadq [cfr, t0, 8], t2 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 471 | bieq t0, t1, .done |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 472 | bqb t2, tagTypeNumber, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 473 | move t2, t3 |
| 474 | arithmeticOperation(t3, .slow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 475 | orq tagTypeNumber, t3 |
| 476 | storeq t2, [cfr, t1, 8] |
| 477 | storeq t3, [cfr, t0, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 478 | .done: |
| 479 | dispatch(3) |
| 480 | |
| 481 | .slow: |
| 482 | callSlowPath(slowPath) |
| 483 | dispatch(3) |
| 484 | end |
| 485 | |
| 486 | _llint_op_post_inc: |
| 487 | postOp( |
| 488 | macro (value, slow) baddio 1, value, slow end, |
| 489 | _llint_slow_path_post_inc) |
| 490 | |
| 491 | |
| 492 | _llint_op_post_dec: |
| 493 | postOp( |
| 494 | macro (value, slow) bsubio 1, value, slow end, |
| 495 | _llint_slow_path_post_dec) |
| 496 | |
| 497 | |
| 498 | _llint_op_to_jsnumber: |
| 499 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 500 | loadisFromInstruction(2, t0) |
| 501 | loadisFromInstruction(1, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 502 | loadConstantOrVariable(t0, t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 503 | bqaeq t2, tagTypeNumber, .opToJsnumberIsImmediate |
| 504 | btqz t2, tagTypeNumber, .opToJsnumberSlow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 505 | .opToJsnumberIsImmediate: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 506 | storeq t2, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 507 | dispatch(3) |
| 508 | |
| 509 | .opToJsnumberSlow: |
| 510 | callSlowPath(_llint_slow_path_to_jsnumber) |
| 511 | dispatch(3) |
| 512 | |
| 513 | |
| 514 | _llint_op_negate: |
| 515 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 516 | loadisFromInstruction(2, t0) |
| 517 | loadisFromInstruction(1, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 518 | loadConstantOrVariable(t0, t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 519 | bqb t2, tagTypeNumber, .opNegateNotInt |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 520 | btiz t2, 0x7fffffff, .opNegateSlow |
| 521 | negi t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 522 | orq tagTypeNumber, t2 |
| 523 | storeq t2, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 524 | dispatch(3) |
| 525 | .opNegateNotInt: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 526 | btqz t2, tagTypeNumber, .opNegateSlow |
| 527 | xorq 0x8000000000000000, t2 |
| 528 | storeq t2, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 529 | dispatch(3) |
| 530 | |
| 531 | .opNegateSlow: |
| 532 | callSlowPath(_llint_slow_path_negate) |
| 533 | dispatch(3) |
| 534 | |
| 535 | |
| 536 | macro binaryOpCustomStore(integerOperationAndStore, doubleOperation, slowPath) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 537 | loadisFromInstruction(3, t0) |
| 538 | loadisFromInstruction(2, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 539 | loadConstantOrVariable(t0, t1) |
| 540 | loadConstantOrVariable(t2, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 541 | bqb t0, tagTypeNumber, .op1NotInt |
| 542 | bqb t1, tagTypeNumber, .op2NotInt |
| 543 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 544 | integerOperationAndStore(t1, t0, .slow, t2) |
| 545 | dispatch(5) |
| 546 | |
| 547 | .op1NotInt: |
| 548 | # First operand is definitely not an int, the second operand could be anything. |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 549 | btqz t0, tagTypeNumber, .slow |
| 550 | bqaeq t1, tagTypeNumber, .op1NotIntOp2Int |
| 551 | btqz t1, tagTypeNumber, .slow |
| 552 | addq tagTypeNumber, t1 |
| 553 | fq2d t1, ft1 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 554 | jmp .op1NotIntReady |
| 555 | .op1NotIntOp2Int: |
| 556 | ci2d t1, ft1 |
| 557 | .op1NotIntReady: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 558 | loadisFromInstruction(1, t2) |
| 559 | addq tagTypeNumber, t0 |
| 560 | fq2d t0, ft0 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 561 | doubleOperation(ft1, ft0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 562 | fd2q ft0, t0 |
| 563 | subq tagTypeNumber, t0 |
| 564 | storeq t0, [cfr, t2, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 565 | dispatch(5) |
| 566 | |
| 567 | .op2NotInt: |
| 568 | # First operand is definitely an int, the second is definitely not. |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 569 | loadisFromInstruction(1, t2) |
| 570 | btqz t1, tagTypeNumber, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 571 | ci2d t0, ft0 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 572 | addq tagTypeNumber, t1 |
| 573 | fq2d t1, ft1 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 574 | doubleOperation(ft1, ft0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 575 | fd2q ft0, t0 |
| 576 | subq tagTypeNumber, t0 |
| 577 | storeq t0, [cfr, t2, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 578 | dispatch(5) |
| 579 | |
| 580 | .slow: |
| 581 | callSlowPath(slowPath) |
| 582 | dispatch(5) |
| 583 | end |
| 584 | |
| 585 | macro binaryOp(integerOperation, doubleOperation, slowPath) |
| 586 | binaryOpCustomStore( |
| 587 | macro (left, right, slow, index) |
| 588 | integerOperation(left, right, slow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 589 | orq tagTypeNumber, right |
| 590 | storeq right, [cfr, index, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 591 | end, |
| 592 | doubleOperation, slowPath) |
| 593 | end |
| 594 | |
| 595 | _llint_op_add: |
| 596 | traceExecution() |
| 597 | binaryOp( |
| 598 | macro (left, right, slow) baddio left, right, slow end, |
| 599 | macro (left, right) addd left, right end, |
| 600 | _llint_slow_path_add) |
| 601 | |
| 602 | |
| 603 | _llint_op_mul: |
| 604 | traceExecution() |
| 605 | binaryOpCustomStore( |
| 606 | macro (left, right, slow, index) |
| 607 | # Assume t3 is scratchable. |
| 608 | move right, t3 |
| 609 | bmulio left, t3, slow |
| 610 | btinz t3, .done |
| 611 | bilt left, 0, slow |
| 612 | bilt right, 0, slow |
| 613 | .done: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 614 | orq tagTypeNumber, t3 |
| 615 | storeq t3, [cfr, index, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 616 | end, |
| 617 | macro (left, right) muld left, right end, |
| 618 | _llint_slow_path_mul) |
| 619 | |
| 620 | |
| 621 | _llint_op_sub: |
| 622 | traceExecution() |
| 623 | binaryOp( |
| 624 | macro (left, right, slow) bsubio left, right, slow end, |
| 625 | macro (left, right) subd left, right end, |
| 626 | _llint_slow_path_sub) |
| 627 | |
| 628 | |
| 629 | _llint_op_div: |
| 630 | traceExecution() |
| 631 | binaryOpCustomStore( |
| 632 | macro (left, right, slow, index) |
| 633 | # Assume t3 is scratchable. |
| 634 | btiz left, slow |
fpizlo@apple.com | f207997 | 2012-03-20 05:15:50 +0000 | [diff] [blame] | 635 | bineq left, -1, .notNeg2TwoThe31DivByNeg1 |
| 636 | bieq right, -2147483648, .slow |
| 637 | .notNeg2TwoThe31DivByNeg1: |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 638 | btinz right, .intOK |
| 639 | bilt left, 0, slow |
| 640 | .intOK: |
| 641 | move left, t3 |
| 642 | move right, t0 |
| 643 | cdqi |
| 644 | idivi t3 |
| 645 | btinz t1, slow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 646 | orq tagTypeNumber, t0 |
| 647 | storeq t0, [cfr, index, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 648 | end, |
| 649 | macro (left, right) divd left, right end, |
| 650 | _llint_slow_path_div) |
| 651 | |
| 652 | |
| 653 | macro bitOp(operation, slowPath, advance) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 654 | loadisFromInstruction(3, t0) |
| 655 | loadisFromInstruction(2, t2) |
| 656 | loadisFromInstruction(1, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 657 | loadConstantOrVariable(t0, t1) |
| 658 | loadConstantOrVariable(t2, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 659 | bqb t0, tagTypeNumber, .slow |
| 660 | bqb t1, tagTypeNumber, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 661 | operation(t1, t0, .slow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 662 | orq tagTypeNumber, t0 |
| 663 | storeq t0, [cfr, t3, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 664 | dispatch(advance) |
| 665 | |
| 666 | .slow: |
| 667 | callSlowPath(slowPath) |
| 668 | dispatch(advance) |
| 669 | end |
| 670 | |
| 671 | _llint_op_lshift: |
| 672 | traceExecution() |
| 673 | bitOp( |
| 674 | macro (left, right, slow) lshifti left, right end, |
| 675 | _llint_slow_path_lshift, |
| 676 | 4) |
| 677 | |
| 678 | |
| 679 | _llint_op_rshift: |
| 680 | traceExecution() |
| 681 | bitOp( |
| 682 | macro (left, right, slow) rshifti left, right end, |
| 683 | _llint_slow_path_rshift, |
| 684 | 4) |
| 685 | |
| 686 | |
| 687 | _llint_op_urshift: |
| 688 | traceExecution() |
| 689 | bitOp( |
| 690 | macro (left, right, slow) |
| 691 | urshifti left, right |
| 692 | bilt right, 0, slow |
| 693 | end, |
| 694 | _llint_slow_path_urshift, |
| 695 | 4) |
| 696 | |
| 697 | |
| 698 | _llint_op_bitand: |
| 699 | traceExecution() |
| 700 | bitOp( |
| 701 | macro (left, right, slow) andi left, right end, |
| 702 | _llint_slow_path_bitand, |
| 703 | 5) |
| 704 | |
| 705 | |
| 706 | _llint_op_bitxor: |
| 707 | traceExecution() |
| 708 | bitOp( |
| 709 | macro (left, right, slow) xori left, right end, |
| 710 | _llint_slow_path_bitxor, |
| 711 | 5) |
| 712 | |
| 713 | |
| 714 | _llint_op_bitor: |
| 715 | traceExecution() |
| 716 | bitOp( |
| 717 | macro (left, right, slow) ori left, right end, |
| 718 | _llint_slow_path_bitor, |
| 719 | 5) |
| 720 | |
| 721 | |
| 722 | _llint_op_check_has_instance: |
| 723 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 724 | loadisFromInstruction(3, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 725 | loadConstantOrVariableCell(t1, t0, .opCheckHasInstanceSlow) |
| 726 | loadp JSCell::m_structure[t0], t0 |
barraclough@apple.com | b46d57b4 | 2012-09-22 00:43:03 +0000 | [diff] [blame] | 727 | btbz Structure::m_typeInfo + TypeInfo::m_flags[t0], ImplementsDefaultHasInstance, .opCheckHasInstanceSlow |
| 728 | dispatch(5) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 729 | |
| 730 | .opCheckHasInstanceSlow: |
| 731 | callSlowPath(_llint_slow_path_check_has_instance) |
barraclough@apple.com | b46d57b4 | 2012-09-22 00:43:03 +0000 | [diff] [blame] | 732 | dispatch(0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 733 | |
| 734 | |
| 735 | _llint_op_instanceof: |
| 736 | traceExecution() |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 737 | # Actually do the work. |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 738 | loadisFromInstruction(3, t0) |
| 739 | loadisFromInstruction(1, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 740 | loadConstantOrVariableCell(t0, t1, .opInstanceofSlow) |
| 741 | loadp JSCell::m_structure[t1], t2 |
| 742 | bbb Structure::m_typeInfo + TypeInfo::m_type[t2], ObjectType, .opInstanceofSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 743 | loadisFromInstruction(2, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 744 | loadConstantOrVariableCell(t0, t2, .opInstanceofSlow) |
| 745 | |
| 746 | # Register state: t1 = prototype, t2 = value |
| 747 | move 1, t0 |
| 748 | .opInstanceofLoop: |
| 749 | loadp JSCell::m_structure[t2], t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 750 | loadq Structure::m_prototype[t2], t2 |
| 751 | bqeq t2, t1, .opInstanceofDone |
| 752 | btqz t2, tagMask, .opInstanceofLoop |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 753 | |
| 754 | move 0, t0 |
| 755 | .opInstanceofDone: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 756 | orq ValueFalse, t0 |
| 757 | storeq t0, [cfr, t3, 8] |
barraclough@apple.com | 094dbd9 | 2012-09-22 01:18:54 +0000 | [diff] [blame] | 758 | dispatch(4) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 759 | |
| 760 | .opInstanceofSlow: |
| 761 | callSlowPath(_llint_slow_path_instanceof) |
barraclough@apple.com | 094dbd9 | 2012-09-22 01:18:54 +0000 | [diff] [blame] | 762 | dispatch(4) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 763 | |
| 764 | |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 765 | _llint_op_is_undefined: |
| 766 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 767 | loadisFromInstruction(2, t1) |
| 768 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 769 | loadConstantOrVariable(t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 770 | btqz t0, tagMask, .opIsUndefinedCell |
| 771 | cqeq t0, ValueUndefined, t3 |
| 772 | orq ValueFalse, t3 |
| 773 | storeq t3, [cfr, t2, 8] |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 774 | dispatch(3) |
| 775 | .opIsUndefinedCell: |
| 776 | loadp JSCell::m_structure[t0], t0 |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 777 | btbnz Structure::m_typeInfo + TypeInfo::m_flags[t0], MasqueradesAsUndefined, .masqueradesAsUndefined |
| 778 | move ValueFalse, t1 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 779 | storeq t1, [cfr, t2, 8] |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 780 | dispatch(3) |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 781 | .masqueradesAsUndefined: |
| 782 | loadp CodeBlock[cfr], t1 |
| 783 | loadp CodeBlock::m_globalObject[t1], t1 |
| 784 | cpeq Structure::m_globalObject[t0], t1, t3 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 785 | orq ValueFalse, t3 |
| 786 | storeq t3, [cfr, t2, 8] |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 787 | dispatch(3) |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 788 | |
| 789 | |
| 790 | _llint_op_is_boolean: |
| 791 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 792 | loadisFromInstruction(2, t1) |
| 793 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 794 | loadConstantOrVariable(t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 795 | xorq ValueFalse, t0 |
| 796 | tqz t0, ~1, t0 |
| 797 | orq ValueFalse, t0 |
| 798 | storeq t0, [cfr, t2, 8] |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 799 | dispatch(3) |
| 800 | |
| 801 | |
| 802 | _llint_op_is_number: |
| 803 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 804 | loadisFromInstruction(2, t1) |
| 805 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 806 | loadConstantOrVariable(t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 807 | tqnz t0, tagTypeNumber, t1 |
| 808 | orq ValueFalse, t1 |
| 809 | storeq t1, [cfr, t2, 8] |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 810 | dispatch(3) |
| 811 | |
| 812 | |
| 813 | _llint_op_is_string: |
| 814 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 815 | loadisFromInstruction(2, t1) |
| 816 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 817 | loadConstantOrVariable(t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 818 | btqnz t0, tagMask, .opIsStringNotCell |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 819 | loadp JSCell::m_structure[t0], t0 |
| 820 | cbeq Structure::m_typeInfo + TypeInfo::m_type[t0], StringType, t1 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 821 | orq ValueFalse, t1 |
| 822 | storeq t1, [cfr, t2, 8] |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 823 | dispatch(3) |
| 824 | .opIsStringNotCell: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 825 | storeq ValueFalse, [cfr, t2, 8] |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 826 | dispatch(3) |
| 827 | |
| 828 | |
ggaren@apple.com | 20b4bfc | 2012-10-04 04:03:14 +0000 | [diff] [blame] | 829 | macro loadPropertyAtVariableOffsetKnownNotInline(propertyOffsetAsPointer, objectAndStorage, value) |
| 830 | assert(macro (ok) bigteq propertyOffsetAsPointer, firstOutOfLineOffset, ok end) |
fpizlo@apple.com | 961a956 | 2012-07-24 02:13:19 +0000 | [diff] [blame] | 831 | negp propertyOffsetAsPointer |
fpizlo@apple.com | d8dd053 | 2012-09-13 04:18:52 +0000 | [diff] [blame] | 832 | loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 833 | loadq (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffsetAsPointer, 8], value |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 834 | end |
| 835 | |
fpizlo@apple.com | 961a956 | 2012-07-24 02:13:19 +0000 | [diff] [blame] | 836 | macro loadPropertyAtVariableOffset(propertyOffsetAsInt, objectAndStorage, value) |
ggaren@apple.com | 20b4bfc | 2012-10-04 04:03:14 +0000 | [diff] [blame] | 837 | bilt propertyOffsetAsInt, firstOutOfLineOffset, .isInline |
fpizlo@apple.com | d8dd053 | 2012-09-13 04:18:52 +0000 | [diff] [blame] | 838 | loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage |
fpizlo@apple.com | 961a956 | 2012-07-24 02:13:19 +0000 | [diff] [blame] | 839 | negi propertyOffsetAsInt |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 840 | sxi2q propertyOffsetAsInt, propertyOffsetAsInt |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 841 | jmp .ready |
| 842 | .isInline: |
ggaren@apple.com | ac950c4 | 2012-10-11 20:56:31 +0000 | [diff] [blame] | 843 | addp sizeof JSObject - (firstOutOfLineOffset - 2) * 8, objectAndStorage |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 844 | .ready: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 845 | loadq (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffsetAsInt, 8], value |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 846 | end |
| 847 | |
oliver@apple.com | 62f4d0e | 2012-09-14 00:43:04 +0000 | [diff] [blame] | 848 | _llint_op_init_global_const: |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 849 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 850 | loadisFromInstruction(2, t1) |
| 851 | loadpFromInstruction(1, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 852 | loadConstantOrVariable(t1, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 853 | writeBarrier(t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 854 | storeq t2, [t0] |
oliver@apple.com | f0c01b8 | 2012-11-07 00:13:54 +0000 | [diff] [blame] | 855 | dispatch(5) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 856 | |
| 857 | |
oliver@apple.com | 62f4d0e | 2012-09-14 00:43:04 +0000 | [diff] [blame] | 858 | _llint_op_init_global_const_check: |
fpizlo@apple.com | b75911b | 2012-06-13 20:53:52 +0000 | [diff] [blame] | 859 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 860 | loadpFromInstruction(3, t2) |
| 861 | loadisFromInstruction(2, t1) |
| 862 | loadpFromInstruction(1, t0) |
oliver@apple.com | c909f5f | 2012-10-18 23:37:40 +0000 | [diff] [blame] | 863 | btbnz [t2], .opInitGlobalConstCheckSlow |
fpizlo@apple.com | b75911b | 2012-06-13 20:53:52 +0000 | [diff] [blame] | 864 | loadConstantOrVariable(t1, t2) |
| 865 | writeBarrier(t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 866 | storeq t2, [t0] |
fpizlo@apple.com | b75911b | 2012-06-13 20:53:52 +0000 | [diff] [blame] | 867 | dispatch(5) |
oliver@apple.com | c909f5f | 2012-10-18 23:37:40 +0000 | [diff] [blame] | 868 | .opInitGlobalConstCheckSlow: |
| 869 | callSlowPath(_llint_slow_path_init_global_const_check) |
fpizlo@apple.com | b75911b | 2012-06-13 20:53:52 +0000 | [diff] [blame] | 870 | dispatch(5) |
| 871 | |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 872 | macro getById(getPropertyStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 873 | traceExecution() |
| 874 | # We only do monomorphic get_by_id caching for now, and we do not modify the |
| 875 | # opcode. We do, however, allow for the cache to change anytime if fails, since |
| 876 | # ping-ponging is free. At best we get lucky and the get_by_id will continue |
| 877 | # to take fast path on the new cache. At worst we take slow path, which is what |
| 878 | # we would have been doing anyway. |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 879 | loadisFromInstruction(2, t0) |
| 880 | loadpFromInstruction(4, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 881 | loadConstantOrVariableCell(t0, t3, .opGetByIdSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 882 | loadisFromInstruction(5, t2) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 883 | getPropertyStorage( |
| 884 | t3, |
| 885 | t0, |
| 886 | macro (propertyStorage, scratch) |
| 887 | bpneq JSCell::m_structure[t3], t1, .opGetByIdSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 888 | loadisFromInstruction(1, t1) |
| 889 | loadq [propertyStorage, t2], scratch |
| 890 | storeq scratch, [cfr, t1, 8] |
| 891 | loadpFromInstruction(8, t1) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 892 | valueProfile(scratch, t1) |
| 893 | dispatch(9) |
| 894 | end) |
| 895 | |
| 896 | .opGetByIdSlow: |
| 897 | callSlowPath(_llint_slow_path_get_by_id) |
| 898 | dispatch(9) |
| 899 | end |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 900 | |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 901 | _llint_op_get_by_id: |
| 902 | getById(withInlineStorage) |
| 903 | |
| 904 | |
| 905 | _llint_op_get_by_id_out_of_line: |
| 906 | getById(withOutOfLineStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 907 | |
| 908 | |
fpizlo@apple.com | 4cafdbd | 2012-09-11 20:00:31 +0000 | [diff] [blame] | 909 | _llint_op_get_array_length: |
| 910 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 911 | loadisFromInstruction(2, t0) |
| 912 | loadpFromInstruction(4, t1) |
fpizlo@apple.com | 4cafdbd | 2012-09-11 20:00:31 +0000 | [diff] [blame] | 913 | loadConstantOrVariableCell(t0, t3, .opGetArrayLengthSlow) |
| 914 | loadp JSCell::m_structure[t3], t2 |
fpizlo@apple.com | c7be5be0 | 2012-09-17 19:07:32 +0000 | [diff] [blame] | 915 | arrayProfile(t2, t1, t0) |
| 916 | btiz t2, IsArray, .opGetArrayLengthSlow |
fpizlo@apple.com | b9aa7ba | 2012-10-14 22:05:16 +0000 | [diff] [blame] | 917 | btiz t2, IndexingShapeMask, .opGetArrayLengthSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 918 | loadisFromInstruction(1, t1) |
| 919 | loadpFromInstruction(8, t2) |
fpizlo@apple.com | d8dd053 | 2012-09-13 04:18:52 +0000 | [diff] [blame] | 920 | loadp JSObject::m_butterfly[t3], t0 |
| 921 | loadi -sizeof IndexingHeader + IndexingHeader::m_publicLength[t0], t0 |
fpizlo@apple.com | 4cafdbd | 2012-09-11 20:00:31 +0000 | [diff] [blame] | 922 | bilt t0, 0, .opGetArrayLengthSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 923 | orq tagTypeNumber, t0 |
fpizlo@apple.com | 4cafdbd | 2012-09-11 20:00:31 +0000 | [diff] [blame] | 924 | valueProfile(t0, t2) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 925 | storeq t0, [cfr, t1, 8] |
fpizlo@apple.com | 4cafdbd | 2012-09-11 20:00:31 +0000 | [diff] [blame] | 926 | dispatch(9) |
| 927 | |
| 928 | .opGetArrayLengthSlow: |
| 929 | callSlowPath(_llint_slow_path_get_by_id) |
| 930 | dispatch(9) |
| 931 | |
| 932 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 933 | _llint_op_get_arguments_length: |
| 934 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 935 | loadisFromInstruction(2, t0) |
| 936 | loadisFromInstruction(1, t1) |
| 937 | btqnz [cfr, t0, 8], .opGetArgumentsLengthSlow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 938 | loadi ArgumentCount + PayloadOffset[cfr], t2 |
| 939 | subi 1, t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 940 | orq tagTypeNumber, t2 |
| 941 | storeq t2, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 942 | dispatch(4) |
| 943 | |
| 944 | .opGetArgumentsLengthSlow: |
| 945 | callSlowPath(_llint_slow_path_get_arguments_length) |
| 946 | dispatch(4) |
| 947 | |
| 948 | |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 949 | macro putById(getPropertyStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 950 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 951 | loadisFromInstruction(1, t3) |
| 952 | loadpFromInstruction(4, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 953 | loadConstantOrVariableCell(t3, t0, .opPutByIdSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 954 | loadisFromInstruction(3, t2) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 955 | getPropertyStorage( |
| 956 | t0, |
| 957 | t3, |
| 958 | macro (propertyStorage, scratch) |
| 959 | bpneq JSCell::m_structure[t0], t1, .opPutByIdSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 960 | loadisFromInstruction(5, t1) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 961 | loadConstantOrVariable(t2, scratch) |
| 962 | writeBarrier(t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 963 | storeq scratch, [propertyStorage, t1] |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 964 | dispatch(9) |
| 965 | end) |
| 966 | end |
| 967 | |
| 968 | _llint_op_put_by_id: |
| 969 | putById(withInlineStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 970 | |
| 971 | .opPutByIdSlow: |
| 972 | callSlowPath(_llint_slow_path_put_by_id) |
| 973 | dispatch(9) |
| 974 | |
| 975 | |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 976 | _llint_op_put_by_id_out_of_line: |
| 977 | putById(withOutOfLineStorage) |
| 978 | |
| 979 | |
| 980 | macro putByIdTransition(additionalChecks, getPropertyStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 981 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 982 | loadisFromInstruction(1, t3) |
| 983 | loadpFromInstruction(4, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 984 | loadConstantOrVariableCell(t3, t0, .opPutByIdSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 985 | loadisFromInstruction(3, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 986 | bpneq JSCell::m_structure[t0], t1, .opPutByIdSlow |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 987 | additionalChecks(t1, t3) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 988 | loadisFromInstruction(5, t1) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 989 | getPropertyStorage( |
| 990 | t0, |
| 991 | t3, |
| 992 | macro (propertyStorage, scratch) |
| 993 | addp t1, propertyStorage, t3 |
| 994 | loadConstantOrVariable(t2, t1) |
| 995 | writeBarrier(t1) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 996 | storeq t1, [t3] |
| 997 | loadpFromInstruction(6, t1) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 998 | storep t1, JSCell::m_structure[t0] |
| 999 | dispatch(9) |
| 1000 | end) |
| 1001 | end |
| 1002 | |
| 1003 | macro noAdditionalChecks(oldStructure, scratch) |
| 1004 | end |
| 1005 | |
| 1006 | macro structureChainChecks(oldStructure, scratch) |
| 1007 | const protoCell = oldStructure # Reusing the oldStructure register for the proto |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1008 | loadpFromInstruction(7, scratch) |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1009 | assert(macro (ok) btpnz scratch, ok end) |
| 1010 | loadp StructureChain::m_vector[scratch], scratch |
| 1011 | assert(macro (ok) btpnz scratch, ok end) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1012 | bqeq Structure::m_prototype[oldStructure], ValueNull, .done |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1013 | .loop: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1014 | loadq Structure::m_prototype[oldStructure], protoCell |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1015 | loadp JSCell::m_structure[protoCell], oldStructure |
| 1016 | bpneq oldStructure, [scratch], .opPutByIdSlow |
| 1017 | addp 8, scratch |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1018 | bqneq Structure::m_prototype[oldStructure], ValueNull, .loop |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1019 | .done: |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1020 | end |
| 1021 | |
| 1022 | _llint_op_put_by_id_transition_direct: |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1023 | putByIdTransition(noAdditionalChecks, withInlineStorage) |
| 1024 | |
| 1025 | |
| 1026 | _llint_op_put_by_id_transition_direct_out_of_line: |
| 1027 | putByIdTransition(noAdditionalChecks, withOutOfLineStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1028 | |
| 1029 | |
| 1030 | _llint_op_put_by_id_transition_normal: |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1031 | putByIdTransition(structureChainChecks, withInlineStorage) |
| 1032 | |
| 1033 | |
| 1034 | _llint_op_put_by_id_transition_normal_out_of_line: |
| 1035 | putByIdTransition(structureChainChecks, withOutOfLineStorage) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1036 | |
| 1037 | |
| 1038 | _llint_op_get_by_val: |
| 1039 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1040 | loadisFromInstruction(2, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1041 | loadConstantOrVariableCell(t2, t0, .opGetByValSlow) |
fpizlo@apple.com | c7be5be0 | 2012-09-17 19:07:32 +0000 | [diff] [blame] | 1042 | loadp JSCell::m_structure[t0], t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1043 | loadpFromInstruction(4, t3) |
fpizlo@apple.com | c7be5be0 | 2012-09-17 19:07:32 +0000 | [diff] [blame] | 1044 | arrayProfile(t2, t3, t1) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1045 | loadisFromInstruction(3, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1046 | loadConstantOrVariableInt32(t3, t1, .opGetByValSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1047 | sxi2q t1, t1 |
fpizlo@apple.com | d8dd053 | 2012-09-13 04:18:52 +0000 | [diff] [blame] | 1048 | loadp JSObject::m_butterfly[t0], t3 |
fpizlo@apple.com | b9aa7ba | 2012-10-14 22:05:16 +0000 | [diff] [blame] | 1049 | andi IndexingShapeMask, t2 |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1050 | bieq t2, Int32Shape, .opGetByValIsContiguous |
fpizlo@apple.com | b9aa7ba | 2012-10-14 22:05:16 +0000 | [diff] [blame] | 1051 | bineq t2, ContiguousShape, .opGetByValNotContiguous |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1052 | .opGetByValIsContiguous: |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1053 | |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1054 | biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_publicLength[t3], .opGetByValOutOfBounds |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1055 | loadisFromInstruction(1, t0) |
| 1056 | loadq [t3, t1, 8], t2 |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1057 | btqz t2, .opGetByValOutOfBounds |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1058 | jmp .opGetByValDone |
| 1059 | |
| 1060 | .opGetByValNotContiguous: |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1061 | bineq t2, DoubleShape, .opGetByValNotDouble |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1062 | biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_publicLength[t3], .opGetByValOutOfBounds |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1063 | loadis 8[PB, PC, 8], t0 |
| 1064 | loadd [t3, t1, 8], ft0 |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1065 | bdnequn ft0, ft0, .opGetByValOutOfBounds |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1066 | fd2q ft0, t2 |
| 1067 | subq tagTypeNumber, t2 |
| 1068 | jmp .opGetByValDone |
| 1069 | |
| 1070 | .opGetByValNotDouble: |
fpizlo@apple.com | b9aa7ba | 2012-10-14 22:05:16 +0000 | [diff] [blame] | 1071 | subi ArrayStorageShape, t2 |
| 1072 | bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1073 | biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t3], .opGetByValOutOfBounds |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1074 | loadisFromInstruction(1, t0) |
| 1075 | loadq ArrayStorage::m_vector[t3, t1, 8], t2 |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1076 | btqz t2, .opGetByValOutOfBounds |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1077 | |
| 1078 | .opGetByValDone: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1079 | storeq t2, [cfr, t0, 8] |
| 1080 | loadpFromInstruction(5, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1081 | valueProfile(t2, t0) |
fpizlo@apple.com | f24804c | 2012-08-15 02:48:35 +0000 | [diff] [blame] | 1082 | dispatch(6) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1083 | |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1084 | .opGetByValOutOfBounds: |
| 1085 | if VALUE_PROFILER |
| 1086 | loadpFromInstruction(4, t0) |
| 1087 | storeb 1, ArrayProfile::m_outOfBounds[t0] |
| 1088 | end |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1089 | .opGetByValSlow: |
| 1090 | callSlowPath(_llint_slow_path_get_by_val) |
fpizlo@apple.com | f24804c | 2012-08-15 02:48:35 +0000 | [diff] [blame] | 1091 | dispatch(6) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1092 | |
| 1093 | |
| 1094 | _llint_op_get_argument_by_val: |
fpizlo@apple.com | f24804c | 2012-08-15 02:48:35 +0000 | [diff] [blame] | 1095 | # FIXME: At some point we should array profile this. Right now it isn't necessary |
| 1096 | # since the DFG will never turn a get_argument_by_val into a GetByVal. |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1097 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1098 | loadisFromInstruction(2, t0) |
| 1099 | loadisFromInstruction(3, t1) |
| 1100 | btqnz [cfr, t0, 8], .opGetArgumentByValSlow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1101 | loadConstantOrVariableInt32(t1, t2, .opGetArgumentByValSlow) |
| 1102 | addi 1, t2 |
| 1103 | loadi ArgumentCount + PayloadOffset[cfr], t1 |
| 1104 | biaeq t2, t1, .opGetArgumentByValSlow |
| 1105 | negi t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1106 | sxi2q t2, t2 |
| 1107 | loadisFromInstruction(1, t3) |
| 1108 | loadpFromInstruction(4, t1) |
| 1109 | loadq ThisArgumentOffset[cfr, t2, 8], t0 |
| 1110 | storeq t0, [cfr, t3, 8] |
fpizlo@apple.com | 6d4456e | 2012-05-23 03:48:52 +0000 | [diff] [blame] | 1111 | valueProfile(t0, t1) |
fpizlo@apple.com | f24804c | 2012-08-15 02:48:35 +0000 | [diff] [blame] | 1112 | dispatch(6) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1113 | |
| 1114 | .opGetArgumentByValSlow: |
| 1115 | callSlowPath(_llint_slow_path_get_argument_by_val) |
fpizlo@apple.com | f24804c | 2012-08-15 02:48:35 +0000 | [diff] [blame] | 1116 | dispatch(6) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1117 | |
| 1118 | |
| 1119 | _llint_op_get_by_pname: |
| 1120 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1121 | loadisFromInstruction(3, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1122 | loadConstantOrVariable(t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1123 | loadisFromInstruction(4, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1124 | assertNotConstant(t1) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1125 | bqneq t0, [cfr, t1, 8], .opGetByPnameSlow |
| 1126 | loadisFromInstruction(2, t2) |
| 1127 | loadisFromInstruction(5, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1128 | loadConstantOrVariableCell(t2, t0, .opGetByPnameSlow) |
| 1129 | assertNotConstant(t3) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1130 | loadq [cfr, t3, 8], t1 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1131 | loadp JSCell::m_structure[t0], t2 |
| 1132 | bpneq t2, JSPropertyNameIterator::m_cachedStructure[t1], .opGetByPnameSlow |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1133 | loadisFromInstruction(6, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1134 | loadi PayloadOffset[cfr, t3, 8], t3 |
| 1135 | subi 1, t3 |
| 1136 | biaeq t3, JSPropertyNameIterator::m_numCacheableSlots[t1], .opGetByPnameSlow |
ggaren@apple.com | 20b4bfc | 2012-10-04 04:03:14 +0000 | [diff] [blame] | 1137 | bilt t3, JSPropertyNameIterator::m_cachedStructureInlineCapacity[t1], .opGetByPnameInlineProperty |
| 1138 | addi firstOutOfLineOffset, t3 |
| 1139 | subi JSPropertyNameIterator::m_cachedStructureInlineCapacity[t1], t3 |
| 1140 | .opGetByPnameInlineProperty: |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 1141 | loadPropertyAtVariableOffset(t3, t0, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1142 | loadisFromInstruction(1, t1) |
| 1143 | storeq t0, [cfr, t1, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1144 | dispatch(7) |
| 1145 | |
| 1146 | .opGetByPnameSlow: |
| 1147 | callSlowPath(_llint_slow_path_get_by_pname) |
| 1148 | dispatch(7) |
| 1149 | |
| 1150 | |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1151 | macro contiguousPutByVal(storeCallback) |
| 1152 | biaeq t3, -sizeof IndexingHeader + IndexingHeader::m_publicLength[t0], .outOfBounds |
| 1153 | .storeResult: |
| 1154 | loadisFromInstruction(3, t2) |
| 1155 | storeCallback(t2, t1, [t0, t3, 8]) |
| 1156 | dispatch(5) |
| 1157 | |
| 1158 | .outOfBounds: |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1159 | biaeq t3, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t0], .opPutByValOutOfBounds |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1160 | if VALUE_PROFILER |
| 1161 | loadp 32[PB, PC, 8], t2 |
| 1162 | storeb 1, ArrayProfile::m_mayStoreToHole[t2] |
| 1163 | end |
| 1164 | addi 1, t3, t2 |
| 1165 | storei t2, -sizeof IndexingHeader + IndexingHeader::m_publicLength[t0] |
| 1166 | jmp .storeResult |
| 1167 | end |
| 1168 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1169 | _llint_op_put_by_val: |
| 1170 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1171 | loadisFromInstruction(1, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1172 | loadConstantOrVariableCell(t0, t1, .opPutByValSlow) |
fpizlo@apple.com | c7be5be0 | 2012-09-17 19:07:32 +0000 | [diff] [blame] | 1173 | loadp JSCell::m_structure[t1], t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1174 | loadpFromInstruction(4, t3) |
fpizlo@apple.com | 69e2784 | 2012-09-19 21:43:10 +0000 | [diff] [blame] | 1175 | arrayProfile(t2, t3, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1176 | loadisFromInstruction(2, t0) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1177 | loadConstantOrVariableInt32(t0, t3, .opPutByValSlow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1178 | sxi2q t3, t3 |
fpizlo@apple.com | d8dd053 | 2012-09-13 04:18:52 +0000 | [diff] [blame] | 1179 | loadp JSObject::m_butterfly[t1], t0 |
fpizlo@apple.com | b9aa7ba | 2012-10-14 22:05:16 +0000 | [diff] [blame] | 1180 | andi IndexingShapeMask, t2 |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1181 | bineq t2, Int32Shape, .opPutByValNotInt32 |
| 1182 | contiguousPutByVal( |
| 1183 | macro (operand, scratch, address) |
| 1184 | loadConstantOrVariable(operand, scratch) |
| 1185 | bpb scratch, tagTypeNumber, .opPutByValSlow |
| 1186 | storep scratch, address |
| 1187 | end) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1188 | |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 1189 | .opPutByValNotInt32: |
| 1190 | bineq t2, DoubleShape, .opPutByValNotDouble |
| 1191 | contiguousPutByVal( |
| 1192 | macro (operand, scratch, address) |
| 1193 | loadConstantOrVariable(operand, scratch) |
| 1194 | bqb scratch, tagTypeNumber, .notInt |
| 1195 | ci2d scratch, ft0 |
| 1196 | jmp .ready |
| 1197 | .notInt: |
| 1198 | addp tagTypeNumber, scratch |
| 1199 | fq2d scratch, ft0 |
| 1200 | bdnequn ft0, ft0, .opPutByValSlow |
| 1201 | .ready: |
| 1202 | stored ft0, address |
| 1203 | end) |
| 1204 | |
| 1205 | .opPutByValNotDouble: |
| 1206 | bineq t2, ContiguousShape, .opPutByValNotContiguous |
| 1207 | contiguousPutByVal( |
| 1208 | macro (operand, scratch, address) |
| 1209 | loadConstantOrVariable(operand, scratch) |
| 1210 | writeBarrier(scratch) |
| 1211 | storep scratch, address |
| 1212 | end) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1213 | |
| 1214 | .opPutByValNotContiguous: |
fpizlo@apple.com | b9aa7ba | 2012-10-14 22:05:16 +0000 | [diff] [blame] | 1215 | bineq t2, ArrayStorageShape, .opPutByValSlow |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1216 | biaeq t3, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t0], .opPutByValOutOfBounds |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1217 | btqz ArrayStorage::m_vector[t0, t3, 8], .opPutByValArrayStorageEmpty |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1218 | .opPutByValArrayStorageStoreResult: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1219 | loadisFromInstruction(3, t2) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1220 | loadConstantOrVariable(t2, t1) |
| 1221 | writeBarrier(t1) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1222 | storeq t1, ArrayStorage::m_vector[t0, t3, 8] |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1223 | dispatch(5) |
| 1224 | |
| 1225 | .opPutByValArrayStorageEmpty: |
| 1226 | if VALUE_PROFILER |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1227 | loadpFromInstruction(4, t1) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1228 | storeb 1, ArrayProfile::m_mayStoreToHole[t1] |
mark.lam@apple.com | a39652e | 2012-09-24 23:53:11 +0000 | [diff] [blame] | 1229 | end |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1230 | addi 1, ArrayStorage::m_numValuesInVector[t0] |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1231 | bib t3, -sizeof IndexingHeader + IndexingHeader::m_publicLength[t0], .opPutByValArrayStorageStoreResult |
| 1232 | addi 1, t3, t1 |
fpizlo@apple.com | d8dd053 | 2012-09-13 04:18:52 +0000 | [diff] [blame] | 1233 | storei t1, -sizeof IndexingHeader + IndexingHeader::m_publicLength[t0] |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1234 | jmp .opPutByValArrayStorageStoreResult |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1235 | |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 1236 | .opPutByValOutOfBounds: |
| 1237 | if VALUE_PROFILER |
| 1238 | loadpFromInstruction(4, t0) |
| 1239 | storeb 1, ArrayProfile::m_outOfBounds[t0] |
| 1240 | end |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1241 | .opPutByValSlow: |
| 1242 | callSlowPath(_llint_slow_path_put_by_val) |
fpizlo@apple.com | f24804c | 2012-08-15 02:48:35 +0000 | [diff] [blame] | 1243 | dispatch(5) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1244 | |
| 1245 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1246 | _llint_op_jmp: |
| 1247 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1248 | dispatchIntIndirect(1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1249 | |
| 1250 | |
| 1251 | macro jumpTrueOrFalse(conditionOp, slow) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1252 | loadisFromInstruction(1, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1253 | loadConstantOrVariable(t1, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1254 | xorq ValueFalse, t0 |
| 1255 | btqnz t0, -1, .slow |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1256 | conditionOp(t0, .target) |
| 1257 | dispatch(3) |
| 1258 | |
| 1259 | .target: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1260 | dispatchIntIndirect(2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1261 | |
| 1262 | .slow: |
| 1263 | callSlowPath(slow) |
| 1264 | dispatch(0) |
| 1265 | end |
| 1266 | |
| 1267 | |
| 1268 | macro equalNull(cellHandler, immediateHandler) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1269 | loadisFromInstruction(1, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1270 | assertNotConstant(t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1271 | loadq [cfr, t0, 8], t0 |
| 1272 | btqnz t0, tagMask, .immediate |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1273 | loadp JSCell::m_structure[t0], t2 |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 1274 | cellHandler(t2, Structure::m_typeInfo + TypeInfo::m_flags[t2], .target) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1275 | dispatch(3) |
| 1276 | |
| 1277 | .target: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1278 | dispatchIntIndirect(2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1279 | |
| 1280 | .immediate: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1281 | andq ~TagBitUndefined, t0 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1282 | immediateHandler(t0, .target) |
| 1283 | dispatch(3) |
| 1284 | end |
| 1285 | |
| 1286 | _llint_op_jeq_null: |
| 1287 | traceExecution() |
| 1288 | equalNull( |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 1289 | macro (structure, value, target) |
| 1290 | btbz value, MasqueradesAsUndefined, .notMasqueradesAsUndefined |
| 1291 | loadp CodeBlock[cfr], t0 |
| 1292 | loadp CodeBlock::m_globalObject[t0], t0 |
| 1293 | bpeq Structure::m_globalObject[structure], t0, target |
| 1294 | .notMasqueradesAsUndefined: |
| 1295 | end, |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1296 | macro (value, target) bqeq value, ValueNull, target end) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1297 | |
| 1298 | |
| 1299 | _llint_op_jneq_null: |
| 1300 | traceExecution() |
| 1301 | equalNull( |
mhahnenberg@apple.com | 3b9069c | 2012-08-23 23:00:31 +0000 | [diff] [blame] | 1302 | macro (structure, value, target) |
| 1303 | btbz value, MasqueradesAsUndefined, target |
| 1304 | loadp CodeBlock[cfr], t0 |
| 1305 | loadp CodeBlock::m_globalObject[t0], t0 |
| 1306 | bpneq Structure::m_globalObject[structure], t0, target |
| 1307 | end, |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1308 | macro (value, target) bqneq value, ValueNull, target end) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1309 | |
| 1310 | |
| 1311 | _llint_op_jneq_ptr: |
| 1312 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1313 | loadisFromInstruction(1, t0) |
| 1314 | loadisFromInstruction(2, t1) |
fpizlo@apple.com | 1271fa3 | 2012-09-27 00:04:48 +0000 | [diff] [blame] | 1315 | loadp CodeBlock[cfr], t2 |
| 1316 | loadp CodeBlock::m_globalObject[t2], t2 |
| 1317 | loadp JSGlobalObject::m_specialPointers[t2, t1, 8], t1 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1318 | bpneq t1, [cfr, t0, 8], .opJneqPtrTarget |
| 1319 | dispatch(4) |
| 1320 | |
| 1321 | .opJneqPtrTarget: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1322 | dispatchIntIndirect(3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1323 | |
| 1324 | |
| 1325 | macro compare(integerCompare, doubleCompare, slowPath) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1326 | loadisFromInstruction(1, t2) |
| 1327 | loadisFromInstruction(2, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1328 | loadConstantOrVariable(t2, t0) |
| 1329 | loadConstantOrVariable(t3, t1) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1330 | bqb t0, tagTypeNumber, .op1NotInt |
| 1331 | bqb t1, tagTypeNumber, .op2NotInt |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1332 | integerCompare(t0, t1, .jumpTarget) |
| 1333 | dispatch(4) |
| 1334 | |
| 1335 | .op1NotInt: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1336 | btqz t0, tagTypeNumber, .slow |
| 1337 | bqb t1, tagTypeNumber, .op1NotIntOp2NotInt |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1338 | ci2d t1, ft1 |
| 1339 | jmp .op1NotIntReady |
| 1340 | .op1NotIntOp2NotInt: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1341 | btqz t1, tagTypeNumber, .slow |
| 1342 | addq tagTypeNumber, t1 |
| 1343 | fq2d t1, ft1 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1344 | .op1NotIntReady: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1345 | addq tagTypeNumber, t0 |
| 1346 | fq2d t0, ft0 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1347 | doubleCompare(ft0, ft1, .jumpTarget) |
| 1348 | dispatch(4) |
| 1349 | |
| 1350 | .op2NotInt: |
| 1351 | ci2d t0, ft0 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1352 | btqz t1, tagTypeNumber, .slow |
| 1353 | addq tagTypeNumber, t1 |
| 1354 | fq2d t1, ft1 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1355 | doubleCompare(ft0, ft1, .jumpTarget) |
| 1356 | dispatch(4) |
| 1357 | |
| 1358 | .jumpTarget: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1359 | dispatchIntIndirect(3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1360 | |
| 1361 | .slow: |
| 1362 | callSlowPath(slowPath) |
| 1363 | dispatch(0) |
| 1364 | end |
| 1365 | |
| 1366 | |
| 1367 | _llint_op_switch_imm: |
| 1368 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1369 | loadisFromInstruction(3, t2) |
| 1370 | loadisFromInstruction(1, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1371 | loadConstantOrVariable(t2, t1) |
| 1372 | loadp CodeBlock[cfr], t2 |
| 1373 | loadp CodeBlock::m_rareData[t2], t2 |
| 1374 | muli sizeof SimpleJumpTable, t3 # FIXME: would be nice to peephole this! |
| 1375 | loadp CodeBlock::RareData::m_immediateSwitchJumpTables + VectorBufferOffset[t2], t2 |
| 1376 | addp t3, t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1377 | bqb t1, tagTypeNumber, .opSwitchImmNotInt |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1378 | subi SimpleJumpTable::min[t2], t1 |
| 1379 | biaeq t1, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchImmFallThrough |
| 1380 | loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t3 |
| 1381 | loadis [t3, t1, 4], t1 |
| 1382 | btiz t1, .opSwitchImmFallThrough |
| 1383 | dispatch(t1) |
| 1384 | |
| 1385 | .opSwitchImmNotInt: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1386 | btqnz t1, tagTypeNumber, .opSwitchImmSlow # Go slow if it's a double. |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1387 | .opSwitchImmFallThrough: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1388 | dispatchIntIndirect(2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1389 | |
| 1390 | .opSwitchImmSlow: |
| 1391 | callSlowPath(_llint_slow_path_switch_imm) |
| 1392 | dispatch(0) |
| 1393 | |
| 1394 | |
| 1395 | _llint_op_switch_char: |
| 1396 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1397 | loadisFromInstruction(3, t2) |
| 1398 | loadisFromInstruction(1, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1399 | loadConstantOrVariable(t2, t1) |
| 1400 | loadp CodeBlock[cfr], t2 |
| 1401 | loadp CodeBlock::m_rareData[t2], t2 |
| 1402 | muli sizeof SimpleJumpTable, t3 |
| 1403 | loadp CodeBlock::RareData::m_characterSwitchJumpTables + VectorBufferOffset[t2], t2 |
| 1404 | addp t3, t2 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1405 | btqnz t1, tagMask, .opSwitchCharFallThrough |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1406 | loadp JSCell::m_structure[t1], t0 |
| 1407 | bbneq Structure::m_typeInfo + TypeInfo::m_type[t0], StringType, .opSwitchCharFallThrough |
oliver@apple.com | f9353c2 | 2012-05-07 22:52:52 +0000 | [diff] [blame] | 1408 | bineq JSString::m_length[t1], 1, .opSwitchCharFallThrough |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1409 | loadp JSString::m_value[t1], t0 |
oliver@apple.com | f9353c2 | 2012-05-07 22:52:52 +0000 | [diff] [blame] | 1410 | btpz t0, .opSwitchOnRope |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1411 | loadp StringImpl::m_data8[t0], t1 |
| 1412 | btinz StringImpl::m_hashAndFlags[t0], HashFlags8BitBuffer, .opSwitchChar8Bit |
| 1413 | loadh [t1], t0 |
| 1414 | jmp .opSwitchCharReady |
| 1415 | .opSwitchChar8Bit: |
| 1416 | loadb [t1], t0 |
| 1417 | .opSwitchCharReady: |
| 1418 | subi SimpleJumpTable::min[t2], t0 |
| 1419 | biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchCharFallThrough |
| 1420 | loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t2 |
| 1421 | loadis [t2, t0, 4], t1 |
| 1422 | btiz t1, .opSwitchCharFallThrough |
| 1423 | dispatch(t1) |
| 1424 | |
| 1425 | .opSwitchCharFallThrough: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1426 | dispatchIntIndirect(2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1427 | |
oliver@apple.com | f9353c2 | 2012-05-07 22:52:52 +0000 | [diff] [blame] | 1428 | .opSwitchOnRope: |
| 1429 | callSlowPath(_llint_slow_path_switch_char) |
| 1430 | dispatch(0) |
| 1431 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1432 | |
| 1433 | _llint_op_new_func: |
| 1434 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1435 | loadisFromInstruction(3, t2) |
| 1436 | btiz t2, .opNewFuncUnchecked |
| 1437 | loadisFromInstruction(1, t1) |
| 1438 | btqnz [cfr, t1, 8], .opNewFuncDone |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1439 | .opNewFuncUnchecked: |
| 1440 | callSlowPath(_llint_slow_path_new_func) |
| 1441 | .opNewFuncDone: |
| 1442 | dispatch(4) |
| 1443 | |
| 1444 | |
fpizlo@apple.com | 198140d | 2012-08-25 23:58:48 +0000 | [diff] [blame] | 1445 | macro arrayProfileForCall() |
| 1446 | if VALUE_PROFILER |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1447 | loadisFromInstruction(3, t3) |
| 1448 | loadq ThisArgumentOffset[cfr, t3, 8], t0 |
| 1449 | btqnz t0, tagMask, .done |
fpizlo@apple.com | 198140d | 2012-08-25 23:58:48 +0000 | [diff] [blame] | 1450 | loadp JSCell::m_structure[t0], t0 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1451 | loadpFromInstruction(5, t1) |
fpizlo@apple.com | 198140d | 2012-08-25 23:58:48 +0000 | [diff] [blame] | 1452 | storep t0, ArrayProfile::m_lastSeenStructure[t1] |
| 1453 | .done: |
| 1454 | end |
| 1455 | end |
| 1456 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1457 | macro doCall(slowPath) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1458 | loadisFromInstruction(1, t0) |
| 1459 | loadpFromInstruction(4, t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1460 | loadp LLIntCallLinkInfo::callee[t1], t2 |
| 1461 | loadConstantOrVariable(t0, t3) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1462 | bqneq t3, t2, .opCallSlow |
| 1463 | loadisFromInstruction(3, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1464 | addi 6, PC |
| 1465 | lshifti 3, t3 |
| 1466 | addp cfr, t3 |
ggaren@apple.com | b11e787 | 2012-08-30 22:50:00 +0000 | [diff] [blame] | 1467 | loadp JSFunction::m_scope[t2], t0 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1468 | storeq t2, Callee[t3] |
| 1469 | storeq t0, ScopeChain[t3] |
| 1470 | loadisFromInstruction(-4, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1471 | storei PC, ArgumentCount + TagOffset[cfr] |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1472 | storeq cfr, CallerFrame[t3] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1473 | storei t2, ArgumentCount + PayloadOffset[t3] |
| 1474 | move t3, cfr |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 1475 | callTargetFunction(t1) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1476 | |
| 1477 | .opCallSlow: |
| 1478 | slowPathForCall(6, slowPath) |
| 1479 | end |
| 1480 | |
| 1481 | |
| 1482 | _llint_op_tear_off_activation: |
| 1483 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1484 | loadisFromInstruction(1, t0) |
| 1485 | btqz [cfr, t0, 8], .opTearOffActivationNotCreated |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1486 | callSlowPath(_llint_slow_path_tear_off_activation) |
| 1487 | .opTearOffActivationNotCreated: |
ggaren@apple.com | 63a291e | 2012-09-10 20:23:50 +0000 | [diff] [blame] | 1488 | dispatch(2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1489 | |
| 1490 | |
| 1491 | _llint_op_tear_off_arguments: |
| 1492 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1493 | loadisFromInstruction(1, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1494 | subi 1, t0 # Get the unmodifiedArgumentsRegister |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1495 | btqz [cfr, t0, 8], .opTearOffArgumentsNotCreated |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1496 | callSlowPath(_llint_slow_path_tear_off_arguments) |
| 1497 | .opTearOffArgumentsNotCreated: |
ggaren@apple.com | 63a291e | 2012-09-10 20:23:50 +0000 | [diff] [blame] | 1498 | dispatch(3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1499 | |
| 1500 | |
| 1501 | _llint_op_ret: |
| 1502 | traceExecution() |
| 1503 | checkSwitchToJITForEpilogue() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1504 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1505 | loadConstantOrVariable(t2, t0) |
| 1506 | doReturn() |
| 1507 | |
| 1508 | |
| 1509 | _llint_op_call_put_result: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1510 | loadisFromInstruction(1, t2) |
| 1511 | loadpFromInstruction(2, t3) |
| 1512 | storeq t0, [cfr, t2, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1513 | valueProfile(t0, t3) |
| 1514 | traceExecution() |
| 1515 | dispatch(3) |
| 1516 | |
| 1517 | |
| 1518 | _llint_op_ret_object_or_this: |
| 1519 | traceExecution() |
| 1520 | checkSwitchToJITForEpilogue() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1521 | loadisFromInstruction(1, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1522 | loadConstantOrVariable(t2, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1523 | btqnz t0, tagMask, .opRetObjectOrThisNotObject |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1524 | loadp JSCell::m_structure[t0], t2 |
| 1525 | bbb Structure::m_typeInfo + TypeInfo::m_type[t2], ObjectType, .opRetObjectOrThisNotObject |
| 1526 | doReturn() |
| 1527 | |
| 1528 | .opRetObjectOrThisNotObject: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1529 | loadisFromInstruction(2, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1530 | loadConstantOrVariable(t2, t0) |
| 1531 | doReturn() |
| 1532 | |
| 1533 | |
| 1534 | _llint_op_to_primitive: |
| 1535 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1536 | loadisFromInstruction(2, t2) |
| 1537 | loadisFromInstruction(1, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1538 | loadConstantOrVariable(t2, t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1539 | btqnz t0, tagMask, .opToPrimitiveIsImm |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1540 | loadp JSCell::m_structure[t0], t2 |
| 1541 | bbneq Structure::m_typeInfo + TypeInfo::m_type[t2], StringType, .opToPrimitiveSlowCase |
| 1542 | .opToPrimitiveIsImm: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1543 | storeq t0, [cfr, t3, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1544 | dispatch(3) |
| 1545 | |
| 1546 | .opToPrimitiveSlowCase: |
| 1547 | callSlowPath(_llint_slow_path_to_primitive) |
| 1548 | dispatch(3) |
| 1549 | |
| 1550 | |
| 1551 | _llint_op_next_pname: |
| 1552 | traceExecution() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1553 | loadisFromInstruction(3, t1) |
| 1554 | loadisFromInstruction(4, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1555 | assertNotConstant(t1) |
| 1556 | assertNotConstant(t2) |
| 1557 | loadi PayloadOffset[cfr, t1, 8], t0 |
| 1558 | bieq t0, PayloadOffset[cfr, t2, 8], .opNextPnameEnd |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1559 | loadisFromInstruction(5, t2) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1560 | assertNotConstant(t2) |
| 1561 | loadp [cfr, t2, 8], t2 |
| 1562 | loadp JSPropertyNameIterator::m_jsStrings[t2], t3 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1563 | loadq [t3, t0, 8], t3 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1564 | addi 1, t0 |
| 1565 | storei t0, PayloadOffset[cfr, t1, 8] |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1566 | loadisFromInstruction(1, t1) |
| 1567 | storeq t3, [cfr, t1, 8] |
| 1568 | loadisFromInstruction(2, t3) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1569 | assertNotConstant(t3) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1570 | loadq [cfr, t3, 8], t3 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1571 | loadp JSCell::m_structure[t3], t1 |
| 1572 | bpneq t1, JSPropertyNameIterator::m_cachedStructure[t2], .opNextPnameSlow |
| 1573 | loadp JSPropertyNameIterator::m_cachedPrototypeChain[t2], t0 |
| 1574 | loadp StructureChain::m_vector[t0], t0 |
| 1575 | btpz [t0], .opNextPnameTarget |
| 1576 | .opNextPnameCheckPrototypeLoop: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1577 | bqeq Structure::m_prototype[t1], ValueNull, .opNextPnameSlow |
| 1578 | loadq Structure::m_prototype[t1], t2 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1579 | loadp JSCell::m_structure[t2], t1 |
| 1580 | bpneq t1, [t0], .opNextPnameSlow |
| 1581 | addp 8, t0 |
| 1582 | btpnz [t0], .opNextPnameCheckPrototypeLoop |
| 1583 | .opNextPnameTarget: |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1584 | dispatchIntIndirect(6) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1585 | |
| 1586 | .opNextPnameEnd: |
| 1587 | dispatch(7) |
| 1588 | |
| 1589 | .opNextPnameSlow: |
| 1590 | callSlowPath(_llint_slow_path_next_pname) # This either keeps the PC where it was (causing us to loop) or sets it to target. |
| 1591 | dispatch(0) |
| 1592 | |
| 1593 | |
| 1594 | _llint_op_catch: |
| 1595 | # This is where we end up from the JIT's throw trampoline (because the |
| 1596 | # machine code return address will be set to _llint_op_catch), and from |
| 1597 | # the interpreter's throw trampoline (see _llint_throw_trampoline). |
| 1598 | # The JIT throwing protocol calls for the cfr to be in t0. The throwing |
| 1599 | # code must have known that we were throwing to the interpreter, and have |
| 1600 | # set JSGlobalData::targetInterpreterPCForThrow. |
| 1601 | move t0, cfr |
| 1602 | loadp CodeBlock[cfr], PB |
| 1603 | loadp CodeBlock::m_instructions[PB], PB |
| 1604 | loadp JITStackFrame::globalData[sp], t3 |
| 1605 | loadp JSGlobalData::targetInterpreterPCForThrow[t3], PC |
| 1606 | subp PB, PC |
mark.lam@apple.com | 996d628 | 2012-10-31 22:40:43 +0000 | [diff] [blame] | 1607 | rshiftp 3, PC |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1608 | loadq JSGlobalData::exception[t3], t0 |
| 1609 | storeq 0, JSGlobalData::exception[t3] |
| 1610 | loadisFromInstruction(1, t2) |
| 1611 | storeq t0, [cfr, t2, 8] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1612 | traceExecution() |
| 1613 | dispatch(2) |
| 1614 | |
| 1615 | |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1616 | _llint_op_end: |
| 1617 | traceExecution() |
| 1618 | checkSwitchToJITForEpilogue() |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1619 | loadisFromInstruction(1, t0) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1620 | assertNotConstant(t0) |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1621 | loadq [cfr, t0, 8], t0 |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1622 | doReturn() |
| 1623 | |
| 1624 | |
| 1625 | _llint_throw_from_slow_path_trampoline: |
| 1626 | # When throwing from the interpreter (i.e. throwing from LLIntSlowPaths), so |
| 1627 | # the throw target is not necessarily interpreted code, we come to here. |
| 1628 | # This essentially emulates the JIT's throwing protocol. |
| 1629 | loadp JITStackFrame::globalData[sp], t1 |
| 1630 | loadp JSGlobalData::callFrameForThrow[t1], t0 |
| 1631 | jmp JSGlobalData::targetMachinePCForThrow[t1] |
| 1632 | |
| 1633 | |
| 1634 | _llint_throw_during_call_trampoline: |
| 1635 | preserveReturnAddressAfterCall(t2) |
| 1636 | loadp JITStackFrame::globalData[sp], t1 |
| 1637 | loadp JSGlobalData::callFrameForThrow[t1], t0 |
| 1638 | jmp JSGlobalData::targetMachinePCForThrow[t1] |
| 1639 | |
oliver@apple.com | 75f804e | 2013-03-07 00:25:20 +0000 | [diff] [blame] | 1640 | # Gives you the scope in t0, while allowing you to optionally perform additional checks on the |
| 1641 | # scopes as they are traversed. scopeCheck() is called with two arguments: the register |
| 1642 | # holding the scope, and a register that can be used for scratch. Note that this does not |
| 1643 | # use t3, so you can hold stuff in t3 if need be. |
| 1644 | macro getDeBruijnScope(deBruijinIndexOperand, scopeCheck) |
| 1645 | loadp ScopeChain[cfr], t0 |
| 1646 | loadis deBruijinIndexOperand, t2 |
| 1647 | |
| 1648 | btiz t2, .done |
| 1649 | |
| 1650 | loadp CodeBlock[cfr], t1 |
| 1651 | bineq CodeBlock::m_codeType[t1], FunctionCode, .loop |
| 1652 | btbz CodeBlock::m_needsActivation[t1], .loop |
| 1653 | |
| 1654 | loadis CodeBlock::m_activationRegister[t1], t1 |
| 1655 | |
| 1656 | # Need to conditionally skip over one scope. |
| 1657 | btpz [cfr, t1, 8], .noActivation |
| 1658 | scopeCheck(t0, t1) |
| 1659 | loadp JSScope::m_next[t0], t0 |
| 1660 | .noActivation: |
| 1661 | subi 1, t2 |
| 1662 | |
| 1663 | btiz t2, .done |
| 1664 | .loop: |
| 1665 | scopeCheck(t0, t1) |
| 1666 | loadp JSScope::m_next[t0], t0 |
| 1667 | subi 1, t2 |
| 1668 | btinz t2, .loop |
| 1669 | |
| 1670 | .done: |
| 1671 | end |
| 1672 | |
| 1673 | _llint_op_get_scoped_var: |
| 1674 | traceExecution() |
| 1675 | # Operands are as follows: |
| 1676 | # pc[1]: Destination for the load |
| 1677 | # pc[2]: Index of register in the scope |
| 1678 | # 24[PB, PC, 8] De Bruijin index. |
| 1679 | getDeBruijnScope(24[PB, PC, 8], macro (scope, scratch) end) |
| 1680 | loadisFromInstruction(1, t1) |
| 1681 | loadisFromInstruction(2, t2) |
| 1682 | |
| 1683 | loadp JSVariableObject::m_registers[t0], t0 |
| 1684 | loadp [t0, t2, 8], t3 |
| 1685 | storep t3, [cfr, t1, 8] |
| 1686 | loadp 32[PB, PC, 8], t1 |
| 1687 | valueProfile(t3, t1) |
| 1688 | dispatch(5) |
| 1689 | |
| 1690 | |
| 1691 | _llint_op_put_scoped_var: |
| 1692 | traceExecution() |
| 1693 | getDeBruijnScope(16[PB, PC, 8], macro (scope, scratch) end) |
| 1694 | loadis 24[PB, PC, 8], t1 |
| 1695 | loadConstantOrVariable(t1, t3) |
| 1696 | loadis 8[PB, PC, 8], t1 |
| 1697 | writeBarrier(t3) |
| 1698 | loadp JSVariableObject::m_registers[t0], t0 |
| 1699 | storep t3, [t0, t1, 8] |
| 1700 | dispatch(4) |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1701 | |
| 1702 | macro nativeCallTrampoline(executableOffsetToFunction) |
| 1703 | storep 0, CodeBlock[cfr] |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 1704 | if X86_64 |
| 1705 | loadp JITStackFrame::globalData + 8[sp], t0 |
| 1706 | storep cfr, JSGlobalData::topCallFrame[t0] |
| 1707 | loadp CallerFrame[cfr], t0 |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1708 | loadq ScopeChain[t0], t1 |
| 1709 | storeq t1, ScopeChain[cfr] |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 1710 | peek 0, t1 |
| 1711 | storep t1, ReturnPC[cfr] |
| 1712 | move cfr, t5 # t5 = rdi |
| 1713 | subp 16 - 8, sp |
| 1714 | loadp Callee[cfr], t4 # t4 = rsi |
| 1715 | loadp JSFunction::m_executable[t4], t1 |
| 1716 | move t0, cfr # Restore cfr to avoid loading from stack |
| 1717 | call executableOffsetToFunction[t1] |
| 1718 | addp 16 - 8, sp |
| 1719 | loadp JITStackFrame::globalData + 8[sp], t3 |
commit-queue@webkit.org | e13567f | 2012-09-01 17:36:51 +0000 | [diff] [blame] | 1720 | |
| 1721 | elsif C_LOOP |
| 1722 | loadp CallerFrame[cfr], t0 |
| 1723 | loadp ScopeChain[t0], t1 |
| 1724 | storep t1, ScopeChain[cfr] |
| 1725 | |
| 1726 | loadp JITStackFrame::globalData[sp], t3 |
| 1727 | storep cfr, JSGlobalData::topCallFrame[t3] |
| 1728 | |
| 1729 | move t0, t2 |
| 1730 | preserveReturnAddressAfterCall(t3) |
| 1731 | storep t3, ReturnPC[cfr] |
| 1732 | move cfr, t0 |
| 1733 | loadp Callee[cfr], t1 |
| 1734 | loadp JSFunction::m_executable[t1], t1 |
| 1735 | move t2, cfr |
| 1736 | cloopCallNative executableOffsetToFunction[t1] |
| 1737 | |
| 1738 | restoreReturnAddressBeforeReturn(t3) |
| 1739 | loadp JITStackFrame::globalData[sp], t3 |
commit-queue@webkit.org | eebad5d | 2012-08-31 23:25:28 +0000 | [diff] [blame] | 1740 | else |
| 1741 | error |
| 1742 | end |
| 1743 | |
yuqiang.xian@intel.com | 5afb67e | 2012-11-06 03:12:25 +0000 | [diff] [blame] | 1744 | btqnz JSGlobalData::exception[t3], .exception |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1745 | ret |
| 1746 | .exception: |
| 1747 | preserveReturnAddressAfterCall(t1) |
fpizlo@apple.com | 602257c | 2012-04-19 19:08:58 +0000 | [diff] [blame] | 1748 | loadi ArgumentCount + TagOffset[cfr], PC |
| 1749 | loadp CodeBlock[cfr], PB |
| 1750 | loadp CodeBlock::m_instructions[PB], PB |
oliver@apple.com | b5196ab | 2012-04-20 00:17:41 +0000 | [diff] [blame] | 1751 | loadp JITStackFrame::globalData[sp], t0 |
| 1752 | storep cfr, JSGlobalData::topCallFrame[t0] |
fpizlo@apple.com | 685a420 | 2012-03-11 00:33:20 +0000 | [diff] [blame] | 1753 | callSlowPath(_llint_throw_from_native_call) |
| 1754 | jmp _llint_throw_from_slow_path_trampoline |
| 1755 | end |
fpizlo@apple.com | 64b9285 | 2012-02-26 00:19:07 +0000 | [diff] [blame] | 1756 | |