mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 1 | /* |
fpizlo@apple.com | 947ec62 | 2013-01-02 08:48:18 +0000 | [diff] [blame] | 2 | * Copyright (C) 2008, 2012, 2013 Apple Inc. All rights reserved. |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
ggaren@apple.com | cc0f1f1 | 2008-11-17 23:16:00 +0000 | [diff] [blame] | 26 | #ifndef JIT_h |
| 27 | #define JIT_h |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 28 | |
ggaren@apple.com | f272d2d | 2008-11-17 04:25:37 +0000 | [diff] [blame] | 29 | #if ENABLE(JIT) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 30 | |
barraclough@apple.com | 433cd15 | 2009-05-13 00:27:24 +0000 | [diff] [blame] | 31 | // We've run into some problems where changing the size of the class JIT leads to |
| 32 | // performance fluctuations. Try forcing alignment in an attempt to stabalize this. |
| 33 | #if COMPILER(GCC) |
| 34 | #define JIT_CLASS_ALIGNMENT __attribute__ ((aligned (32))) |
| 35 | #else |
| 36 | #define JIT_CLASS_ALIGNMENT |
| 37 | #endif |
| 38 | |
xan@webkit.org | 773abaf | 2011-02-21 21:14:57 +0000 | [diff] [blame] | 39 | #define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(expected), static_cast<int>(actual)); |
barraclough@apple.com | 71c5a9a | 2009-10-28 07:13:37 +0000 | [diff] [blame] | 40 | |
ggaren@apple.com | d8fccca | 2009-05-08 20:51:53 +0000 | [diff] [blame] | 41 | #include "CodeBlock.h" |
fpizlo@apple.com | 7f6c680 | 2011-09-13 01:33:43 +0000 | [diff] [blame] | 42 | #include "CompactJITCodeMap.h" |
ggaren@apple.com | 901a8a2 | 2008-11-17 20:57:18 +0000 | [diff] [blame] | 43 | #include "Interpreter.h" |
fpizlo@apple.com | 1949f32 | 2012-11-22 00:46:57 +0000 | [diff] [blame] | 44 | #include "JITDisassembler.h" |
fpizlo@apple.com | 5ba0788 | 2013-10-19 23:13:23 +0000 | [diff] [blame] | 45 | #include "JITInlineCacheGenerator.h" |
oliver@apple.com | ec0e400 | 2010-04-27 03:45:47 +0000 | [diff] [blame] | 46 | #include "JSInterfaceJIT.h" |
fpizlo@apple.com | 77ea29a | 2012-12-04 22:30:28 +0000 | [diff] [blame] | 47 | #include "LegacyProfiler.h" |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 48 | #include "Opcode.h" |
ossy@webkit.org | 7269f91 | 2013-02-18 07:18:56 +0000 | [diff] [blame] | 49 | #include "ResultType.h" |
ap@apple.com | 9416323 | 2013-10-20 00:01:17 +0000 | [diff] [blame^] | 50 | #include "SamplingTool.h" |
msaboff@apple.com | ec1cd57 | 2012-12-20 23:20:30 +0000 | [diff] [blame] | 51 | #include "UnusedPointer.h" |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 52 | |
cwzwarich@webkit.org | 3f782f6 | 2008-09-08 01:28:33 +0000 | [diff] [blame] | 53 | namespace JSC { |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 54 | |
mark.lam@apple.com | 5d7e708 | 2013-10-11 19:03:39 +0000 | [diff] [blame] | 55 | class ArrayAllocationProfile; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 56 | class CodeBlock; |
oliver@apple.com | e843bc0 | 2011-08-05 20:03:19 +0000 | [diff] [blame] | 57 | class FunctionExecutable; |
ggaren@apple.com | d8fccca | 2009-05-08 20:51:53 +0000 | [diff] [blame] | 58 | class JIT; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 59 | class JSPropertyNameIterator; |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 60 | class Identifier; |
ggaren@apple.com | 031563e | 2008-11-17 02:21:16 +0000 | [diff] [blame] | 61 | class Interpreter; |
ggaren@apple.com | b11e787 | 2012-08-30 22:50:00 +0000 | [diff] [blame] | 62 | class JSScope; |
mark.lam@apple.com | 4fbb9c3 | 2012-10-09 07:12:56 +0000 | [diff] [blame] | 63 | class JSStack; |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 64 | class MarkedAllocator; |
mark.lam@apple.com | 4fbb9c3 | 2012-10-09 07:12:56 +0000 | [diff] [blame] | 65 | class Register; |
darin@apple.com | a9778f9 | 2008-11-16 04:40:06 +0000 | [diff] [blame] | 66 | class StructureChain; |
darin@apple.com | 5a49442 | 2008-10-18 23:08:12 +0000 | [diff] [blame] | 67 | |
barraclough@apple.com | e964265 | 2008-10-23 22:29:54 +0000 | [diff] [blame] | 68 | struct CallLinkInfo; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 69 | struct Instruction; |
barraclough@apple.com | b8b15e2 | 2008-09-27 01:44:15 +0000 | [diff] [blame] | 70 | struct OperandTypes; |
barraclough@apple.com | bc0fea6 | 2008-11-22 03:34:43 +0000 | [diff] [blame] | 71 | struct PolymorphicAccessStructureList; |
levin@chromium.org | 93604aa | 2009-07-29 08:04:19 +0000 | [diff] [blame] | 72 | struct SimpleJumpTable; |
| 73 | struct StringJumpTable; |
barraclough@apple.com | f5f7482 | 2008-11-21 05:04:19 +0000 | [diff] [blame] | 74 | struct StructureStubInfo; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 75 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 76 | struct CallRecord { |
barraclough@apple.com | 8c4ea6b | 2009-02-11 04:57:08 +0000 | [diff] [blame] | 77 | MacroAssembler::Call from; |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 78 | unsigned bytecodeOffset; |
barraclough@apple.com | 249befb | 2008-12-13 03:18:10 +0000 | [diff] [blame] | 79 | void* to; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 80 | |
| 81 | CallRecord() |
| 82 | { |
| 83 | } |
| 84 | |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 85 | CallRecord(MacroAssembler::Call from, unsigned bytecodeOffset, void* to = 0) |
barraclough@apple.com | 249befb | 2008-12-13 03:18:10 +0000 | [diff] [blame] | 86 | : from(from) |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 87 | , bytecodeOffset(bytecodeOffset) |
barraclough@apple.com | 249befb | 2008-12-13 03:18:10 +0000 | [diff] [blame] | 88 | , to(to) |
ggaren@apple.com | 107bd0e | 2008-09-24 00:27:18 +0000 | [diff] [blame] | 89 | { |
| 90 | } |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
barraclough@apple.com | a2a2e13 | 2008-12-13 23:58:58 +0000 | [diff] [blame] | 93 | struct JumpTable { |
| 94 | MacroAssembler::Jump from; |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 95 | unsigned toBytecodeOffset; |
barraclough@apple.com | a2a2e13 | 2008-12-13 23:58:58 +0000 | [diff] [blame] | 96 | |
| 97 | JumpTable(MacroAssembler::Jump f, unsigned t) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 98 | : from(f) |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 99 | , toBytecodeOffset(t) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 100 | { |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | struct SlowCaseEntry { |
barraclough@apple.com | 4f46a50 | 2008-12-13 01:39:38 +0000 | [diff] [blame] | 105 | MacroAssembler::Jump from; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 106 | unsigned to; |
| 107 | unsigned hint; |
| 108 | |
barraclough@apple.com | 4f46a50 | 2008-12-13 01:39:38 +0000 | [diff] [blame] | 109 | SlowCaseEntry(MacroAssembler::Jump f, unsigned t, unsigned h = 0) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 110 | : from(f) |
| 111 | , to(t) |
| 112 | , hint(h) |
| 113 | { |
| 114 | } |
| 115 | }; |
| 116 | |
| 117 | struct SwitchRecord { |
| 118 | enum Type { |
| 119 | Immediate, |
| 120 | Character, |
| 121 | String |
| 122 | }; |
| 123 | |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 124 | Type type; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 125 | |
| 126 | union { |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 127 | SimpleJumpTable* simpleJumpTable; |
| 128 | StringJumpTable* stringJumpTable; |
| 129 | } jumpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 130 | |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 131 | unsigned bytecodeOffset; |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 132 | unsigned defaultOffset; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 133 | |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 134 | SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset, Type type) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 135 | : type(type) |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 136 | , bytecodeOffset(bytecodeOffset) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 137 | , defaultOffset(defaultOffset) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 138 | { |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 139 | this->jumpTable.simpleJumpTable = jumpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 140 | } |
| 141 | |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 142 | SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 143 | : type(String) |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 144 | , bytecodeOffset(bytecodeOffset) |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 145 | , defaultOffset(defaultOffset) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 146 | { |
cwzwarich@webkit.org | e882773 | 2008-11-11 18:31:51 +0000 | [diff] [blame] | 147 | this->jumpTable.stringJumpTable = jumpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 148 | } |
| 149 | }; |
| 150 | |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 151 | struct ByValCompilationInfo { |
| 152 | ByValCompilationInfo() { } |
| 153 | |
| 154 | ByValCompilationInfo(unsigned bytecodeIndex, MacroAssembler::PatchableJump badTypeJump, JITArrayMode arrayMode, MacroAssembler::Label doneTarget) |
| 155 | : bytecodeIndex(bytecodeIndex) |
| 156 | , badTypeJump(badTypeJump) |
| 157 | , arrayMode(arrayMode) |
| 158 | , doneTarget(doneTarget) |
| 159 | { |
| 160 | } |
| 161 | |
| 162 | unsigned bytecodeIndex; |
| 163 | MacroAssembler::PatchableJump badTypeJump; |
| 164 | JITArrayMode arrayMode; |
| 165 | MacroAssembler::Label doneTarget; |
| 166 | MacroAssembler::Label slowPathTarget; |
| 167 | MacroAssembler::Call returnAddress; |
| 168 | }; |
| 169 | |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 170 | struct StructureStubCompilationInfo { |
barraclough@apple.com | 289318a | 2008-12-22 01:00:07 +0000 | [diff] [blame] | 171 | MacroAssembler::DataLabelPtr hotPathBegin; |
barraclough@apple.com | 8c4ea6b | 2009-02-11 04:57:08 +0000 | [diff] [blame] | 172 | MacroAssembler::Call hotPathOther; |
| 173 | MacroAssembler::Call callReturnLocation; |
ggaren@apple.com | 539d1bb | 2011-11-14 19:21:40 +0000 | [diff] [blame] | 174 | CallLinkInfo::CallType callType; |
oliver@apple.com | 1386ec9 | 2011-10-07 18:39:45 +0000 | [diff] [blame] | 175 | unsigned bytecodeIndex; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 176 | }; |
| 177 | |
barraclough@apple.com | 97bacef | 2009-06-05 07:55:38 +0000 | [diff] [blame] | 178 | // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions. |
barraclough@apple.com | 1444b28 | 2009-07-22 22:17:10 +0000 | [diff] [blame] | 179 | void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction); |
| 180 | void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction); |
| 181 | void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 182 | |
oliver@apple.com | ec0e400 | 2010-04-27 03:45:47 +0000 | [diff] [blame] | 183 | class JIT : private JSInterfaceJIT { |
oliver@apple.com | 7ca7143 | 2013-07-25 04:02:44 +0000 | [diff] [blame] | 184 | friend class JITSlowPathCall; |
ggaren@apple.com | d8fccca | 2009-05-08 20:51:53 +0000 | [diff] [blame] | 185 | friend class JITStubCall; |
ggaren@apple.com | d8fccca | 2009-05-08 20:51:53 +0000 | [diff] [blame] | 186 | |
barraclough@apple.com | d13288c | 2008-12-05 23:57:43 +0000 | [diff] [blame] | 187 | using MacroAssembler::Jump; |
| 188 | using MacroAssembler::JumpList; |
| 189 | using MacroAssembler::Label; |
| 190 | |
msaboff@apple.com | ec1cd57 | 2012-12-20 23:20:30 +0000 | [diff] [blame] | 191 | static const uintptr_t patchGetByIdDefaultStructure = unusedPointer; |
oliver@apple.com | 2c012fa | 2011-05-17 20:02:41 +0000 | [diff] [blame] | 192 | static const int patchGetByIdDefaultOffset = 0; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 193 | // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler |
weinig@apple.com | 76b0f8a | 2008-12-22 21:21:18 +0000 | [diff] [blame] | 194 | // will compress the displacement, and we may not be able to fit a patched offset. |
oliver@apple.com | 2c012fa | 2011-05-17 20:02:41 +0000 | [diff] [blame] | 195 | static const int patchPutByIdDefaultOffset = 256; |
barraclough@apple.com | 71500d5 | 2008-09-15 02:18:13 +0000 | [diff] [blame] | 196 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 197 | public: |
fpizlo@apple.com | 1342e7a | 2013-08-29 19:28:55 +0000 | [diff] [blame] | 198 | static CompilationResult compile(VM* vm, CodeBlock* codeBlock, JITCompilationEffort effort) |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 199 | { |
fpizlo@apple.com | 1342e7a | 2013-08-29 19:28:55 +0000 | [diff] [blame] | 200 | return JIT(vm, codeBlock).privateCompile(effort); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 201 | } |
fpizlo@apple.com | 947ec62 | 2013-01-02 08:48:18 +0000 | [diff] [blame] | 202 | |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 203 | static void compileClosureCall(VM* vm, CallLinkInfo* callLinkInfo, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, Structure* expectedStructure, ExecutableBase* expectedExecutable, MacroAssemblerCodePtr codePtr) |
fpizlo@apple.com | 947ec62 | 2013-01-02 08:48:18 +0000 | [diff] [blame] | 204 | { |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 205 | JIT jit(vm, callerCodeBlock); |
fpizlo@apple.com | 947ec62 | 2013-01-02 08:48:18 +0000 | [diff] [blame] | 206 | jit.m_bytecodeOffset = callLinkInfo->codeOrigin.bytecodeIndex; |
| 207 | jit.privateCompileClosureCall(callLinkInfo, calleeCodeBlock, expectedStructure, expectedExecutable, codePtr); |
| 208 | } |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 209 | |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 210 | static void compileGetByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 211 | { |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 212 | JIT jit(vm, codeBlock); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 213 | jit.m_bytecodeOffset = byValInfo->bytecodeIndex; |
| 214 | jit.privateCompileGetByVal(byValInfo, returnAddress, arrayMode); |
| 215 | } |
| 216 | |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 217 | static void compilePutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 218 | { |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 219 | JIT jit(vm, codeBlock); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 220 | jit.m_bytecodeOffset = byValInfo->bytecodeIndex; |
| 221 | jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode); |
| 222 | } |
oliver@apple.com | e050d64 | 2013-10-19 00:09:28 +0000 | [diff] [blame] | 223 | |
| 224 | static void compileDirectPutByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode) |
| 225 | { |
| 226 | JIT jit(vm, codeBlock); |
| 227 | jit.m_bytecodeOffset = byValInfo->bytecodeIndex; |
| 228 | jit.privateCompilePutByVal(byValInfo, returnAddress, arrayMode); |
| 229 | } |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 230 | |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 231 | static CodeRef compileCTINativeCall(VM* vm, NativeFunction func) |
barraclough@apple.com | 8cc4669 | 2010-05-19 06:04:18 +0000 | [diff] [blame] | 232 | { |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 233 | if (!vm->canUseJIT()) { |
fpizlo@apple.com | e6e29a6f | 2012-03-06 06:54:23 +0000 | [diff] [blame] | 234 | #if ENABLE(LLINT) |
| 235 | return CodeRef::createLLIntCodeRef(llint_native_call_trampoline); |
| 236 | #else |
fpizlo@apple.com | e6a7f5f | 2011-09-11 05:49:36 +0000 | [diff] [blame] | 237 | return CodeRef(); |
fpizlo@apple.com | e6e29a6f | 2012-03-06 06:54:23 +0000 | [diff] [blame] | 238 | #endif |
| 239 | } |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 240 | JIT jit(vm, 0); |
| 241 | return jit.privateCompileCTINativeCall(vm, func); |
barraclough@apple.com | 8cc4669 | 2010-05-19 06:04:18 +0000 | [diff] [blame] | 242 | } |
| 243 | |
oliver@apple.com | d2cdd31 | 2013-07-25 04:01:00 +0000 | [diff] [blame] | 244 | static void linkFor(ExecState*, JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, CodePtr, CallLinkInfo*, VM*, CodeSpecializationKind); |
fpizlo@apple.com | 947ec62 | 2013-01-02 08:48:18 +0000 | [diff] [blame] | 245 | static void linkSlowCall(CodeBlock* callerCodeBlock, CallLinkInfo*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 246 | |
| 247 | private: |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 248 | JIT(VM*, CodeBlock* = 0); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 249 | |
| 250 | void privateCompileMainPass(); |
| 251 | void privateCompileLinkPass(); |
| 252 | void privateCompileSlowCases(); |
fpizlo@apple.com | 1342e7a | 2013-08-29 19:28:55 +0000 | [diff] [blame] | 253 | CompilationResult privateCompile(JITCompilationEffort); |
fpizlo@apple.com | 33fbf1f | 2012-11-05 03:13:26 +0000 | [diff] [blame] | 254 | |
fpizlo@apple.com | 947ec62 | 2013-01-02 08:48:18 +0000 | [diff] [blame] | 255 | void privateCompileClosureCall(CallLinkInfo*, CodeBlock* calleeCodeBlock, Structure*, ExecutableBase*, MacroAssemblerCodePtr); |
| 256 | |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 257 | void privateCompileGetByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode); |
| 258 | void privateCompilePutByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 259 | |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 260 | Label privateCompileCTINativeCall(VM*, bool isConstruct = false); |
| 261 | CodeRef privateCompileCTINativeCall(VM*, NativeFunction); |
barraclough@apple.com | ce1490e | 2010-08-26 23:21:24 +0000 | [diff] [blame] | 262 | void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 263 | |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 264 | // Add a call out from JIT code, without an exception check. |
| 265 | Call appendCall(const FunctionPtr& function) |
| 266 | { |
| 267 | Call functionCall = call(); |
| 268 | m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value())); |
fpizlo@apple.com | 203b78b | 2013-10-17 03:01:49 +0000 | [diff] [blame] | 269 | #if USE(JSVALUE32_64) |
| 270 | unmap(); |
| 271 | #else |
| 272 | killLastResultRegister(); |
| 273 | #endif |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 274 | return functionCall; |
| 275 | } |
| 276 | |
msaboff@apple.com | 8f4bb0c | 2013-10-02 23:33:46 +0000 | [diff] [blame] | 277 | void exceptionCheck(Jump jumpToHandler) |
| 278 | { |
| 279 | m_exceptionChecks.append(jumpToHandler); |
| 280 | } |
| 281 | |
| 282 | void exceptionCheck() |
| 283 | { |
| 284 | m_exceptionChecks.append(emitExceptionCheck()); |
| 285 | } |
| 286 | |
msaboff@apple.com | 5ca16c4 | 2013-10-07 18:20:27 +0000 | [diff] [blame] | 287 | void exceptionCheckWithCallFrameRollback() |
| 288 | { |
| 289 | m_exceptionChecksWithCallFrameRollback.append(emitExceptionCheck()); |
| 290 | } |
| 291 | |
msaboff@apple.com | 8f4bb0c | 2013-10-02 23:33:46 +0000 | [diff] [blame] | 292 | void privateCompileExceptionHandlers(); |
| 293 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 294 | void addSlowCase(Jump); |
| 295 | void addSlowCase(JumpList); |
fpizlo@apple.com | 9b0b31e | 2011-09-19 22:27:38 +0000 | [diff] [blame] | 296 | void addSlowCase(); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 297 | void addJump(Jump, int); |
| 298 | void emitJumpSlowToHot(Jump, int); |
| 299 | |
ggaren@apple.com | 539d1bb | 2011-11-14 19:21:40 +0000 | [diff] [blame] | 300 | void compileOpCall(OpcodeID, Instruction*, unsigned callLinkInfoIndex); |
| 301 | void compileOpCallSlowCase(OpcodeID, Instruction*, Vector<SlowCaseEntry>::iterator&, unsigned callLinkInfoIndex); |
| 302 | void compileLoadVarargs(Instruction*); |
oliver@apple.com | cf0e6c4 | 2013-07-25 04:01:45 +0000 | [diff] [blame] | 303 | void compileCallEval(Instruction*); |
| 304 | void compileCallEvalSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 305 | void emitPutCallResult(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 306 | |
| 307 | enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq }; |
| 308 | void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type); |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 309 | bool isOperandConstantImmediateDouble(int src); |
oliver@apple.com | 8d18163 | 2009-09-25 02:40:59 +0000 | [diff] [blame] | 310 | |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 311 | void emitLoadDouble(int index, FPRegisterID value); |
| 312 | void emitLoadInt32ToDouble(int index, FPRegisterID value); |
barraclough@apple.com | b8bcc94 | 2011-09-07 17:55:50 +0000 | [diff] [blame] | 313 | Jump emitJumpIfNotObject(RegisterID structureReg); |
oliver@apple.com | 8d18163 | 2009-09-25 02:40:59 +0000 | [diff] [blame] | 314 | |
fpizlo@apple.com | 33fbf1f | 2012-11-05 03:13:26 +0000 | [diff] [blame] | 315 | Jump addStructureTransitionCheck(JSCell*, Structure*, StructureStubInfo*, RegisterID scratch); |
| 316 | void addStructureTransitionCheck(JSCell*, Structure*, StructureStubInfo*, JumpList& failureCases, RegisterID scratch); |
| 317 | void testPrototype(JSValue, JumpList& failureCases, StructureStubInfo*); |
ggaren@apple.com | 9dc3ab7a | 2009-10-19 22:59:41 +0000 | [diff] [blame] | 318 | |
oliver@apple.com | 0cae693 | 2011-09-23 22:05:24 +0000 | [diff] [blame] | 319 | enum WriteBarrierMode { UnconditionalWriteBarrier, ShouldFilterImmediates }; |
| 320 | // value register in write barrier is used before any scratch registers |
| 321 | // so may safely be the same as either of the scratch registers. |
| 322 | void emitWriteBarrier(RegisterID owner, RegisterID valueTag, RegisterID scratch, RegisterID scratch2, WriteBarrierMode, WriteBarrierUseKind); |
| 323 | void emitWriteBarrier(JSCell* owner, RegisterID value, RegisterID scratch, WriteBarrierMode, WriteBarrierUseKind); |
oliver@apple.com | e843bc0 | 2011-08-05 20:03:19 +0000 | [diff] [blame] | 324 | |
ggaren@apple.com | c862eac | 2013-01-29 05:48:01 +0000 | [diff] [blame] | 325 | template<typename StructureType> // StructureType can be RegisterID or ImmPtr. |
| 326 | void emitAllocateJSObject(RegisterID allocator, StructureType, RegisterID result, RegisterID scratch); |
fpizlo@apple.com | 95a9f0d | 2011-08-20 02:17:49 +0000 | [diff] [blame] | 327 | |
fpizlo@apple.com | 95a9f0d | 2011-08-20 02:17:49 +0000 | [diff] [blame] | 328 | #if ENABLE(VALUE_PROFILER) |
| 329 | // This assumes that the value to profile is in regT0 and that regT3 is available for |
| 330 | // scratch. |
oliver@apple.com | a17ff5b | 2013-07-25 04:03:07 +0000 | [diff] [blame] | 331 | void emitValueProfilingSite(ValueProfile*, RegisterID); |
| 332 | void emitValueProfilingSite(unsigned bytecodeOffset, RegisterID); |
| 333 | void emitValueProfilingSite(RegisterID); |
fpizlo@apple.com | 95a9f0d | 2011-08-20 02:17:49 +0000 | [diff] [blame] | 334 | #else |
oliver@apple.com | a17ff5b | 2013-07-25 04:03:07 +0000 | [diff] [blame] | 335 | void emitValueProfilingSite(unsigned, RegisterID) { } |
| 336 | void emitValueProfilingSite(RegisterID) { } |
fpizlo@apple.com | 95a9f0d | 2011-08-20 02:17:49 +0000 | [diff] [blame] | 337 | #endif |
fpizlo@apple.com | c7be5be0 | 2012-09-17 19:07:32 +0000 | [diff] [blame] | 338 | void emitArrayProfilingSite(RegisterID structureAndIndexingType, RegisterID scratch, ArrayProfile*); |
| 339 | void emitArrayProfilingSiteForBytecodeIndex(RegisterID structureAndIndexingType, RegisterID scratch, unsigned bytecodeIndex); |
fpizlo@apple.com | 69e2784 | 2012-09-19 21:43:10 +0000 | [diff] [blame] | 340 | void emitArrayProfileStoreToHoleSpecialCase(ArrayProfile*); |
fpizlo@apple.com | 304fbca | 2012-12-17 21:38:51 +0000 | [diff] [blame] | 341 | void emitArrayProfileOutOfBoundsSpecialCase(ArrayProfile*); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 342 | |
| 343 | JITArrayMode chooseArrayMode(ArrayProfile*); |
| 344 | |
| 345 | // Property is in regT1, base is in regT0. regT2 contains indexing type. |
| 346 | // Property is int-checked and zero extended. Base is cell checked. |
| 347 | // Structure is already profiled. Returns the slow cases. Fall-through |
| 348 | // case contains result in regT0, and it is not yet profiled. |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 349 | JumpList emitInt32GetByVal(Instruction* instruction, PatchableJump& badType) { return emitContiguousGetByVal(instruction, badType, Int32Shape); } |
| 350 | JumpList emitDoubleGetByVal(Instruction*, PatchableJump& badType); |
| 351 | JumpList emitContiguousGetByVal(Instruction*, PatchableJump& badType, IndexingType expectedShape = ContiguousShape); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 352 | JumpList emitArrayStorageGetByVal(Instruction*, PatchableJump& badType); |
fpizlo@apple.com | 0e0d931 | 2013-08-15 20:43:06 +0000 | [diff] [blame] | 353 | JumpList emitIntTypedArrayGetByVal(Instruction*, PatchableJump& badType, TypedArrayType); |
| 354 | JumpList emitFloatTypedArrayGetByVal(Instruction*, PatchableJump& badType, TypedArrayType); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 355 | |
| 356 | // Property is in regT0, base is in regT0. regT2 contains indecing type. |
| 357 | // The value to store is not yet loaded. Property is int-checked and |
| 358 | // zero-extended. Base is cell checked. Structure is already profiled. |
| 359 | // returns the slow cases. |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 360 | JumpList emitInt32PutByVal(Instruction* currentInstruction, PatchableJump& badType) |
| 361 | { |
ossy@webkit.org | 2460fa1 | 2012-11-14 16:18:10 +0000 | [diff] [blame] | 362 | return emitGenericContiguousPutByVal(currentInstruction, badType, Int32Shape); |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 363 | } |
| 364 | JumpList emitDoublePutByVal(Instruction* currentInstruction, PatchableJump& badType) |
| 365 | { |
ossy@webkit.org | 2460fa1 | 2012-11-14 16:18:10 +0000 | [diff] [blame] | 366 | return emitGenericContiguousPutByVal(currentInstruction, badType, DoubleShape); |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 367 | } |
| 368 | JumpList emitContiguousPutByVal(Instruction* currentInstruction, PatchableJump& badType) |
| 369 | { |
ossy@webkit.org | 2460fa1 | 2012-11-14 16:18:10 +0000 | [diff] [blame] | 370 | return emitGenericContiguousPutByVal(currentInstruction, badType); |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 371 | } |
ossy@webkit.org | 2460fa1 | 2012-11-14 16:18:10 +0000 | [diff] [blame] | 372 | JumpList emitGenericContiguousPutByVal(Instruction*, PatchableJump& badType, IndexingType indexingShape = ContiguousShape); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 373 | JumpList emitArrayStoragePutByVal(Instruction*, PatchableJump& badType); |
fpizlo@apple.com | 0e0d931 | 2013-08-15 20:43:06 +0000 | [diff] [blame] | 374 | JumpList emitIntTypedArrayPutByVal(Instruction*, PatchableJump& badType, TypedArrayType); |
| 375 | JumpList emitFloatTypedArrayPutByVal(Instruction*, PatchableJump& badType, TypedArrayType); |
fpizlo@apple.com | c14c8d3 | 2012-10-10 02:14:42 +0000 | [diff] [blame] | 376 | |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 377 | enum FinalObjectMode { MayBeFinal, KnownNotFinal }; |
| 378 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 379 | #if USE(JSVALUE32_64) |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 380 | bool getOperandConstantImmediateInt(int op1, int op2, int& op, int32_t& constant); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 381 | |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 382 | void emitLoadTag(int index, RegisterID tag); |
| 383 | void emitLoadPayload(int index, RegisterID payload); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 384 | |
| 385 | void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload); |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 386 | void emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister); |
| 387 | void emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 388 | |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 389 | void emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister); |
| 390 | void emitStore(int index, const JSValue constant, RegisterID base = callFrameRegister); |
| 391 | void emitStoreInt32(int index, RegisterID payload, bool indexIsInt32 = false); |
| 392 | void emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32 = false); |
| 393 | void emitStoreAndMapInt32(int index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength); |
| 394 | void emitStoreCell(int index, RegisterID payload, bool indexIsCell = false); |
| 395 | void emitStoreBool(int index, RegisterID payload, bool indexIsBool = false); |
| 396 | void emitStoreDouble(int index, FPRegisterID value); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 397 | |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 398 | bool isLabeled(unsigned bytecodeOffset); |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 399 | void map(unsigned bytecodeOffset, int virtualRegisterIndex, RegisterID tag, RegisterID payload); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 400 | void unmap(RegisterID); |
| 401 | void unmap(); |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 402 | bool isMapped(int virtualRegisterIndex); |
| 403 | bool getMappedPayload(int virtualRegisterIndex, RegisterID& payload); |
| 404 | bool getMappedTag(int virtualRegisterIndex, RegisterID& tag); |
fpizlo@apple.com | b75911b | 2012-06-13 20:53:52 +0000 | [diff] [blame] | 405 | |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 406 | void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex); |
| 407 | void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 408 | |
oliver@apple.com | 9b65276 | 2013-08-12 22:39:13 +0000 | [diff] [blame] | 409 | void compileGetByIdHotPath(const Identifier*); |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 410 | void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset); |
| 411 | void compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset); |
| 412 | void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset, FinalObjectMode = MayBeFinal); |
| 413 | void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, PropertyOffset cachedOffset); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 414 | |
| 415 | // Arithmetic opcode helpers |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 416 | void emitAdd32Constant(int dst, int op, int32_t constant, ResultType opType); |
| 417 | void emitSub32Constant(int dst, int op, int32_t constant, ResultType opType); |
| 418 | void emitBinaryDoubleOp(OpcodeID, int dst, int op1, int op2, OperandTypes, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters = true, bool op2IsInRegisters = true); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 419 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 420 | #else // USE(JSVALUE32_64) |
| 421 | void emitGetVirtualRegister(int src, RegisterID dst); |
msaboff@apple.com | 62aa8b7 | 2013-09-26 22:53:54 +0000 | [diff] [blame] | 422 | void emitGetVirtualRegister(VirtualRegister src, RegisterID dst); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 423 | void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2); |
msaboff@apple.com | 62aa8b7 | 2013-09-26 22:53:54 +0000 | [diff] [blame] | 424 | void emitGetVirtualRegisters(VirtualRegister src1, RegisterID dst1, VirtualRegister src2, RegisterID dst2); |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 425 | void emitPutVirtualRegister(int dst, RegisterID from = regT0); |
msaboff@apple.com | 62aa8b7 | 2013-09-26 22:53:54 +0000 | [diff] [blame] | 426 | void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0); |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 427 | void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false) |
oliver@apple.com | e843bc0 | 2011-08-05 20:03:19 +0000 | [diff] [blame] | 428 | { |
| 429 | emitPutVirtualRegister(dst, payload); |
| 430 | } |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 431 | void emitStoreCell(VirtualRegister dst, RegisterID payload) |
| 432 | { |
| 433 | emitPutVirtualRegister(dst, payload); |
| 434 | } |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 435 | |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 436 | int32_t getConstantOperandImmediateInt(int src); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 437 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 438 | void killLastResultRegister(); |
| 439 | |
| 440 | Jump emitJumpIfJSCell(RegisterID); |
| 441 | Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID); |
| 442 | void emitJumpSlowCaseIfJSCell(RegisterID); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 443 | void emitJumpSlowCaseIfNotJSCell(RegisterID); |
| 444 | void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg); |
barraclough@apple.com | b8bcc94 | 2011-09-07 17:55:50 +0000 | [diff] [blame] | 445 | Jump emitJumpIfImmediateInteger(RegisterID); |
| 446 | Jump emitJumpIfNotImmediateInteger(RegisterID); |
| 447 | Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 448 | void emitJumpSlowCaseIfNotImmediateInteger(RegisterID); |
oliver@apple.com | 8d18163 | 2009-09-25 02:40:59 +0000 | [diff] [blame] | 449 | void emitJumpSlowCaseIfNotImmediateNumber(RegisterID); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 450 | void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID); |
| 451 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 452 | void emitFastArithReTagImmediate(RegisterID src, RegisterID dest); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 453 | |
| 454 | void emitTagAsBoolImmediate(RegisterID reg); |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 455 | void compileBinaryArithOp(OpcodeID, int dst, int src1, int src2, OperandTypes opi); |
| 456 | void compileBinaryArithOpSlowCase(Instruction*, OpcodeID, Vector<SlowCaseEntry>::iterator&, int dst, int src1, int src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 457 | |
oliver@apple.com | 9b65276 | 2013-08-12 22:39:13 +0000 | [diff] [blame] | 458 | void compileGetByIdHotPath(int baseVReg, const Identifier*); |
fpizlo@apple.com | d68b1f8 | 2012-07-05 22:55:51 +0000 | [diff] [blame] | 459 | void compileGetDirectOffset(RegisterID base, RegisterID result, PropertyOffset cachedOffset); |
| 460 | void compileGetDirectOffset(JSObject* base, RegisterID result, PropertyOffset cachedOffset); |
| 461 | void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch, FinalObjectMode = MayBeFinal); |
| 462 | void compilePutDirectOffset(RegisterID base, RegisterID value, PropertyOffset cachedOffset); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 463 | |
zoltan@webkit.org | 723ba02 | 2009-11-14 01:07:01 +0000 | [diff] [blame] | 464 | #endif // USE(JSVALUE32_64) |
barraclough@apple.com | 970af2c | 2009-08-13 05:58:36 +0000 | [diff] [blame] | 465 | |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 466 | void emit_compareAndJump(OpcodeID, int op1, int op2, unsigned target, RelationalCondition); |
msaboff@apple.com | c8dd3f7 | 2013-10-10 23:10:40 +0000 | [diff] [blame] | 467 | void emit_compareAndJumpSlow(int op1, int op2, unsigned target, DoubleCondition, size_t (JIT_OPERATION *operation)(ExecState*, EncodedJSValue, EncodedJSValue), bool invert, Vector<SlowCaseEntry>::iterator&); |
barraclough@apple.com | 3a8c64b | 2011-07-04 05:59:03 +0000 | [diff] [blame] | 468 | |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 469 | void emit_op_add(Instruction*); |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 470 | void emit_op_bitand(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 471 | void emit_op_bitor(Instruction*); |
| 472 | void emit_op_bitxor(Instruction*); |
| 473 | void emit_op_call(Instruction*); |
| 474 | void emit_op_call_eval(Instruction*); |
| 475 | void emit_op_call_varargs(Instruction*); |
| 476 | void emit_op_catch(Instruction*); |
| 477 | void emit_op_construct(Instruction*); |
fpizlo@apple.com | a1fe26b | 2012-11-13 06:04:51 +0000 | [diff] [blame] | 478 | void emit_op_get_callee(Instruction*); |
barraclough@apple.com | fd8c28a | 2010-05-25 03:04:43 +0000 | [diff] [blame] | 479 | void emit_op_create_this(Instruction*); |
oliver@apple.com | e2fe4ce | 2013-07-25 03:59:41 +0000 | [diff] [blame] | 480 | void emit_op_to_this(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 481 | void emit_op_create_arguments(Instruction*); |
| 482 | void emit_op_debug(Instruction*); |
| 483 | void emit_op_del_by_id(Instruction*); |
| 484 | void emit_op_div(Instruction*); |
| 485 | void emit_op_end(Instruction*); |
| 486 | void emit_op_enter(Instruction*); |
oliver@apple.com | f312e22 | 2010-10-04 22:43:18 +0000 | [diff] [blame] | 487 | void emit_op_create_activation(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 488 | void emit_op_eq(Instruction*); |
| 489 | void emit_op_eq_null(Instruction*); |
| 490 | void emit_op_get_by_id(Instruction*); |
oliver@apple.com | 74e00b0 | 2010-09-25 21:42:00 +0000 | [diff] [blame] | 491 | void emit_op_get_arguments_length(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 492 | void emit_op_get_by_val(Instruction*); |
oliver@apple.com | 74e00b0 | 2010-09-25 21:42:00 +0000 | [diff] [blame] | 493 | void emit_op_get_argument_by_val(Instruction*); |
oliver@apple.com | 0a4803c | 2009-10-29 01:25:02 +0000 | [diff] [blame] | 494 | void emit_op_get_by_pname(Instruction*); |
oliver@apple.com | f61c9a1 | 2010-09-24 19:06:29 +0000 | [diff] [blame] | 495 | void emit_op_init_lazy_reg(Instruction*); |
barraclough@apple.com | 8da6d97 | 2010-11-16 21:11:26 +0000 | [diff] [blame] | 496 | void emit_op_check_has_instance(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 497 | void emit_op_instanceof(Instruction*); |
fpizlo@apple.com | 1d21689 | 2012-04-12 00:55:44 +0000 | [diff] [blame] | 498 | void emit_op_is_undefined(Instruction*); |
| 499 | void emit_op_is_boolean(Instruction*); |
| 500 | void emit_op_is_number(Instruction*); |
| 501 | void emit_op_is_string(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 502 | void emit_op_jeq_null(Instruction*); |
| 503 | void emit_op_jfalse(Instruction*); |
| 504 | void emit_op_jmp(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 505 | void emit_op_jneq_null(Instruction*); |
| 506 | void emit_op_jneq_ptr(Instruction*); |
mjs@apple.com | a46c49c | 2009-12-06 09:42:03 +0000 | [diff] [blame] | 507 | void emit_op_jless(Instruction*); |
barraclough@apple.com | 3a8c64b | 2011-07-04 05:59:03 +0000 | [diff] [blame] | 508 | void emit_op_jlesseq(Instruction*); |
barraclough@apple.com | 57b4bdb8 | 2011-07-04 19:26:05 +0000 | [diff] [blame] | 509 | void emit_op_jgreater(Instruction*); |
| 510 | void emit_op_jgreatereq(Instruction*); |
| 511 | void emit_op_jnless(Instruction*); |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 512 | void emit_op_jnlesseq(Instruction*); |
barraclough@apple.com | 57b4bdb8 | 2011-07-04 19:26:05 +0000 | [diff] [blame] | 513 | void emit_op_jngreater(Instruction*); |
| 514 | void emit_op_jngreatereq(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 515 | void emit_op_jtrue(Instruction*); |
fpizlo@apple.com | a71ab05 | 2011-09-13 05:35:53 +0000 | [diff] [blame] | 516 | void emit_op_loop_hint(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 517 | void emit_op_lshift(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 518 | void emit_op_mod(Instruction*); |
| 519 | void emit_op_mov(Instruction*); |
| 520 | void emit_op_mul(Instruction*); |
| 521 | void emit_op_negate(Instruction*); |
| 522 | void emit_op_neq(Instruction*); |
| 523 | void emit_op_neq_null(Instruction*); |
| 524 | void emit_op_new_array(Instruction*); |
fpizlo@apple.com | 4500e35 | 2012-10-17 21:39:11 +0000 | [diff] [blame] | 525 | void emit_op_new_array_with_size(Instruction*); |
oliver@apple.com | a991d69 | 2011-06-14 23:39:25 +0000 | [diff] [blame] | 526 | void emit_op_new_array_buffer(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 527 | void emit_op_new_func(Instruction*); |
| 528 | void emit_op_new_func_exp(Instruction*); |
| 529 | void emit_op_new_object(Instruction*); |
oliver@apple.com | 22d55c3 | 2010-05-10 01:41:07 +0000 | [diff] [blame] | 530 | void emit_op_new_regexp(Instruction*); |
ggaren@apple.com | 5236be2 | 2009-10-17 05:52:20 +0000 | [diff] [blame] | 531 | void emit_op_get_pnames(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 532 | void emit_op_next_pname(Instruction*); |
| 533 | void emit_op_not(Instruction*); |
| 534 | void emit_op_nstricteq(Instruction*); |
| 535 | void emit_op_pop_scope(Instruction*); |
ggaren@apple.com | f303611 | 2013-04-27 23:14:04 +0000 | [diff] [blame] | 536 | void emit_op_dec(Instruction*); |
| 537 | void emit_op_inc(Instruction*); |
commit-queue@webkit.org | 90ba187 | 2010-11-17 08:05:39 +0000 | [diff] [blame] | 538 | void emit_op_profile_did_call(Instruction*); |
| 539 | void emit_op_profile_will_call(Instruction*); |
ggaren@apple.com | 170d6f2 | 2012-09-02 21:27:23 +0000 | [diff] [blame] | 540 | void emit_op_push_name_scope(Instruction*); |
| 541 | void emit_op_push_with_scope(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 542 | void emit_op_put_by_id(Instruction*); |
| 543 | void emit_op_put_by_index(Instruction*); |
| 544 | void emit_op_put_by_val(Instruction*); |
barraclough@apple.com | 09a5568 | 2012-01-30 18:28:39 +0000 | [diff] [blame] | 545 | void emit_op_put_getter_setter(Instruction*); |
oliver@apple.com | c909f5f | 2012-10-18 23:37:40 +0000 | [diff] [blame] | 546 | void emit_op_init_global_const(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 547 | void emit_op_ret(Instruction*); |
barraclough@apple.com | fd6a150 | 2010-05-20 05:36:17 +0000 | [diff] [blame] | 548 | void emit_op_ret_object_or_this(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 549 | void emit_op_rshift(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 550 | void emit_op_strcat(Instruction*); |
| 551 | void emit_op_stricteq(Instruction*); |
| 552 | void emit_op_sub(Instruction*); |
| 553 | void emit_op_switch_char(Instruction*); |
| 554 | void emit_op_switch_imm(Instruction*); |
| 555 | void emit_op_switch_string(Instruction*); |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 556 | void emit_op_tear_off_activation(Instruction*); |
| 557 | void emit_op_tear_off_arguments(Instruction*); |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 558 | void emit_op_throw(Instruction*); |
oliver@apple.com | f0c01b8 | 2012-11-07 00:13:54 +0000 | [diff] [blame] | 559 | void emit_op_throw_static_error(Instruction*); |
ggaren@apple.com | f303611 | 2013-04-27 23:14:04 +0000 | [diff] [blame] | 560 | void emit_op_to_number(Instruction*); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 561 | void emit_op_to_primitive(Instruction*); |
| 562 | void emit_op_unexpected_load(Instruction*); |
oliver@apple.com | 429ede0 | 2010-04-30 07:56:38 +0000 | [diff] [blame] | 563 | void emit_op_urshift(Instruction*); |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 564 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 565 | void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 566 | void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&); |
weinig@apple.com | 60a7409 | 2009-05-12 01:40:00 +0000 | [diff] [blame] | 567 | void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 568 | void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&); |
weinig@apple.com | 60a7409 | 2009-05-12 01:40:00 +0000 | [diff] [blame] | 569 | void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 570 | void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 571 | void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 572 | void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | e2fe4ce | 2013-07-25 03:59:41 +0000 | [diff] [blame] | 573 | void emitSlow_op_to_this(Instruction*, Vector<SlowCaseEntry>::iterator&); |
commit-queue@webkit.org | c9b19ab | 2011-07-18 18:55:48 +0000 | [diff] [blame] | 574 | void emitSlow_op_create_this(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 575 | void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 576 | void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
mhahnenberg@apple.com | 5f2e70b | 2013-09-25 00:37:57 +0000 | [diff] [blame] | 577 | void emitSlow_op_get_callee(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 578 | void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | 74e00b0 | 2010-09-25 21:42:00 +0000 | [diff] [blame] | 579 | void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 580 | void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | 74e00b0 | 2010-09-25 21:42:00 +0000 | [diff] [blame] | 581 | void emitSlow_op_get_argument_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | 0a4803c | 2009-10-29 01:25:02 +0000 | [diff] [blame] | 582 | void emitSlow_op_get_by_pname(Instruction*, Vector<SlowCaseEntry>::iterator&); |
barraclough@apple.com | 8da6d97 | 2010-11-16 21:11:26 +0000 | [diff] [blame] | 583 | void emitSlow_op_check_has_instance(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 584 | void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 585 | void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&); |
mjs@apple.com | a46c49c | 2009-12-06 09:42:03 +0000 | [diff] [blame] | 586 | void emitSlow_op_jless(Instruction*, Vector<SlowCaseEntry>::iterator&); |
barraclough@apple.com | 3a8c64b | 2011-07-04 05:59:03 +0000 | [diff] [blame] | 587 | void emitSlow_op_jlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
barraclough@apple.com | 57b4bdb8 | 2011-07-04 19:26:05 +0000 | [diff] [blame] | 588 | void emitSlow_op_jgreater(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 589 | void emitSlow_op_jgreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 590 | void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 591 | void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
barraclough@apple.com | 57b4bdb8 | 2011-07-04 19:26:05 +0000 | [diff] [blame] | 592 | void emitSlow_op_jngreater(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 593 | void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 594 | void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&); |
mark.lam@apple.com | a61ec35 | 2013-04-22 17:37:29 +0000 | [diff] [blame] | 595 | void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 596 | void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 597 | void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 598 | void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 599 | void emitSlow_op_negate(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 600 | void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
commit-queue@webkit.org | c9b19ab | 2011-07-18 18:55:48 +0000 | [diff] [blame] | 601 | void emitSlow_op_new_object(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 602 | void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 603 | void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | f303611 | 2013-04-27 23:14:04 +0000 | [diff] [blame] | 604 | void emitSlow_op_dec(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 605 | void emitSlow_op_inc(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 606 | void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 607 | void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 608 | void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 609 | void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 610 | void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | f303611 | 2013-04-27 23:14:04 +0000 | [diff] [blame] | 611 | void emitSlow_op_to_number(Instruction*, Vector<SlowCaseEntry>::iterator&); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 612 | void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | 429ede0 | 2010-04-30 07:56:38 +0000 | [diff] [blame] | 613 | void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | c909f5f | 2012-10-18 23:37:40 +0000 | [diff] [blame] | 614 | |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 615 | void emit_op_resolve_scope(Instruction*); |
| 616 | void emit_op_get_from_scope(Instruction*); |
| 617 | void emit_op_put_to_scope(Instruction*); |
| 618 | void emitSlow_op_resolve_scope(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 619 | void emitSlow_op_get_from_scope(Instruction*, Vector<SlowCaseEntry>::iterator&); |
| 620 | void emitSlow_op_put_to_scope(Instruction*, Vector<SlowCaseEntry>::iterator&); |
oliver@apple.com | c909f5f | 2012-10-18 23:37:40 +0000 | [diff] [blame] | 621 | |
oliver@apple.com | 429ede0 | 2010-04-30 07:56:38 +0000 | [diff] [blame] | 622 | void emitRightShift(Instruction*, bool isUnsigned); |
| 623 | void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned); |
weinig@apple.com | 60a7409 | 2009-05-12 01:40:00 +0000 | [diff] [blame] | 624 | |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 625 | void emitVarInjectionCheck(bool needsVarInjectionChecks); |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 626 | void emitResolveClosure(int dst, bool needsVarInjectionChecks, unsigned depth); |
| 627 | void emitLoadWithStructureCheck(int scope, Structure** structureSlot); |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 628 | void emitGetGlobalProperty(uintptr_t* operandSlot); |
| 629 | void emitGetGlobalVar(uintptr_t operand); |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 630 | void emitGetClosureVar(int scope, uintptr_t operand); |
| 631 | void emitPutGlobalProperty(uintptr_t* operandSlot, int value); |
| 632 | void emitPutGlobalVar(uintptr_t operand, int value); |
| 633 | void emitPutClosureVar(int scope, uintptr_t operand, int value); |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 634 | |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 635 | void emitInitRegister(int dst); |
oliver@apple.com | ecfd224 | 2008-09-20 03:00:43 +0000 | [diff] [blame] | 636 | |
mark.lam@apple.com | 4fbb9c3 | 2012-10-09 07:12:56 +0000 | [diff] [blame] | 637 | void emitPutIntToCallFrameHeader(RegisterID from, JSStack::CallFrameHeaderEntry); |
mark.lam@apple.com | 4fbb9c3 | 2012-10-09 07:12:56 +0000 | [diff] [blame] | 638 | void emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister); |
| 639 | void emitGetFromCallFrameHeader32(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister); |
yuqiang.xian@intel.com | 5b1cb73 | 2012-10-19 05:46:10 +0000 | [diff] [blame] | 640 | #if USE(JSVALUE64) |
| 641 | void emitGetFromCallFrameHeader64(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister); |
| 642 | #endif |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 643 | |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 644 | JSValue getConstantOperand(int src); |
| 645 | bool isOperandConstantImmediateInt(int src); |
| 646 | bool isOperandConstantImmediateChar(int src); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 647 | |
barraclough@apple.com | 4836c7a | 2011-05-01 22:20:59 +0000 | [diff] [blame] | 648 | bool atJumpTarget(); |
| 649 | |
barraclough@apple.com | 4f46a50 | 2008-12-13 01:39:38 +0000 | [diff] [blame] | 650 | Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter) |
| 651 | { |
| 652 | return iter++->from; |
| 653 | } |
| 654 | void linkSlowCase(Vector<SlowCaseEntry>::iterator& iter) |
| 655 | { |
| 656 | iter->from.link(this); |
| 657 | ++iter; |
| 658 | } |
fpizlo@apple.com | 9b0b31e | 2011-09-19 22:27:38 +0000 | [diff] [blame] | 659 | void linkDummySlowCase(Vector<SlowCaseEntry>::iterator& iter) |
| 660 | { |
| 661 | ASSERT(!iter->from.isSet()); |
| 662 | ++iter; |
| 663 | } |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 664 | void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex); |
weinig@apple.com | 262302f | 2008-09-16 03:46:58 +0000 | [diff] [blame] | 665 | |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 666 | MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&); |
msaboff@apple.com | 5ca16c4 | 2013-10-07 18:20:27 +0000 | [diff] [blame] | 667 | MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&); |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 668 | MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int); |
fpizlo@apple.com | 1cfa0a9 | 2013-10-16 02:19:20 +0000 | [diff] [blame] | 669 | MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr&, int); |
| 670 | |
| 671 | enum WithProfileTag { WithProfile }; |
| 672 | |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 673 | MacroAssembler::Call callOperation(C_JITOperation_E); |
| 674 | MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg); |
mark.lam@apple.com | 5d7e708 | 2013-10-11 19:03:39 +0000 | [diff] [blame] | 675 | MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*); |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 676 | MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t); |
| 677 | MacroAssembler::Call callOperation(F_JITOperation_EJJZ, GPRReg, GPRReg, int32_t); |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 678 | MacroAssembler::Call callOperation(J_JITOperation_E, int); |
mark.lam@apple.com | 5d7e708 | 2013-10-11 19:03:39 +0000 | [diff] [blame] | 679 | MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg); |
mark.lam@apple.com | 5d7e708 | 2013-10-11 19:03:39 +0000 | [diff] [blame] | 680 | MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, GPRReg, int32_t); |
| 681 | MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, const JSValue*, int32_t); |
| 682 | MacroAssembler::Call callOperation(J_JITOperation_EC, int, JSCell*); |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 683 | MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg); |
fpizlo@apple.com | 1cfa0a9 | 2013-10-16 02:19:20 +0000 | [diff] [blame] | 684 | #if USE(JSVALUE64) |
fpizlo@apple.com | d49bfe8 | 2013-10-19 02:20:14 +0000 | [diff] [blame] | 685 | MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, StringImpl*); |
fpizlo@apple.com | 1cfa0a9 | 2013-10-16 02:19:20 +0000 | [diff] [blame] | 686 | #else |
fpizlo@apple.com | d49bfe8 | 2013-10-19 02:20:14 +0000 | [diff] [blame] | 687 | MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, StringImpl*); |
fpizlo@apple.com | 1cfa0a9 | 2013-10-16 02:19:20 +0000 | [diff] [blame] | 688 | #endif |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 689 | MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, const Identifier*); |
| 690 | MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg); |
mark.lam@apple.com | 6529307 | 2013-10-17 07:20:20 +0000 | [diff] [blame] | 691 | #if USE(JSVALUE64) |
| 692 | MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg); |
| 693 | #else |
| 694 | MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg); |
| 695 | #endif |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 696 | MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*); |
fpizlo@apple.com | 1cfa0a9 | 2013-10-16 02:19:20 +0000 | [diff] [blame] | 697 | MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EPc, int, Instruction*); |
mark.lam@apple.com | 2a90d90 | 2013-10-15 03:03:45 +0000 | [diff] [blame] | 698 | MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t); |
| 699 | MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t); |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 700 | MacroAssembler::Call callOperation(P_JITOperation_EZ, int32_t); |
msaboff@apple.com | c8dd3f7 | 2013-10-10 23:10:40 +0000 | [diff] [blame] | 701 | MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID); |
| 702 | MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID); |
| 703 | MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID); |
| 704 | MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID); |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 705 | MacroAssembler::Call callOperation(V_JITOperation_E); |
| 706 | MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID); |
| 707 | MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID); |
| 708 | MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID); |
| 709 | MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, int32_t); |
| 710 | MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID); |
msaboff@apple.com | bdfcf6a | 2013-10-18 16:25:02 +0000 | [diff] [blame] | 711 | #if USE(JSVALUE64) |
| 712 | MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID); |
| 713 | #else |
| 714 | MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID, RegisterID); |
| 715 | #endif |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 716 | MacroAssembler::Call callOperation(V_JITOperation_EJIdJJ, RegisterID, const Identifier*, RegisterID, RegisterID); |
fpizlo@apple.com | d97d757 | 2013-10-14 18:39:45 +0000 | [diff] [blame] | 717 | #if USE(JSVALUE64) |
fpizlo@apple.com | d49bfe8 | 2013-10-19 02:20:14 +0000 | [diff] [blame] | 718 | MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, StringImpl*); |
fpizlo@apple.com | d97d757 | 2013-10-14 18:39:45 +0000 | [diff] [blame] | 719 | #else |
fpizlo@apple.com | d49bfe8 | 2013-10-19 02:20:14 +0000 | [diff] [blame] | 720 | MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, RegisterID, RegisterID, StringImpl*); |
fpizlo@apple.com | d97d757 | 2013-10-14 18:39:45 +0000 | [diff] [blame] | 721 | #endif |
msaboff@apple.com | 853b04f | 2013-10-17 01:23:56 +0000 | [diff] [blame] | 722 | MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID); |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 723 | MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, int32_t, RegisterID); |
| 724 | MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, int32_t); |
mark.lam@apple.com | 2a90d90 | 2013-10-15 03:03:45 +0000 | [diff] [blame] | 725 | MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*); |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 726 | MacroAssembler::Call callOperation(V_JITOperation_EZ, int32_t); |
msaboff@apple.com | 2b95ada | 2013-10-09 13:29:00 +0000 | [diff] [blame] | 727 | MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E); |
msaboff@apple.com | 5ca16c4 | 2013-10-07 18:20:27 +0000 | [diff] [blame] | 728 | MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*); |
| 729 | MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E); |
msaboff@apple.com | c8dd3f7 | 2013-10-10 23:10:40 +0000 | [diff] [blame] | 730 | #if USE(JSVALUE32_64) |
mark.lam@apple.com | 03944a0 | 2013-10-14 16:42:22 +0000 | [diff] [blame] | 731 | MacroAssembler::Call callOperation(F_JITOperation_EJJZ, GPRReg, GPRReg, GPRReg, GPRReg, int32_t); |
| 732 | MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg); |
| 733 | MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg, GPRReg); |
| 734 | MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*); |
| 735 | MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg); |
mark.lam@apple.com | 2a90d90 | 2013-10-15 03:03:45 +0000 | [diff] [blame] | 736 | MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t); |
msaboff@apple.com | c8dd3f7 | 2013-10-10 23:10:40 +0000 | [diff] [blame] | 737 | MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID); |
| 738 | MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID); |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 739 | MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, RegisterID, int32_t); |
| 740 | MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID); |
msaboff@apple.com | 853b04f | 2013-10-17 01:23:56 +0000 | [diff] [blame] | 741 | MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID); |
msaboff@apple.com | 4b6250f | 2013-10-15 18:33:04 +0000 | [diff] [blame] | 742 | MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t); |
| 743 | MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, RegisterID, int32_t, RegisterID, RegisterID); |
msaboff@apple.com | c8dd3f7 | 2013-10-10 23:10:40 +0000 | [diff] [blame] | 744 | #endif |
msaboff@apple.com | a482c54 | 2013-10-04 18:20:40 +0000 | [diff] [blame] | 745 | |
barraclough@apple.com | a2a2e13 | 2008-12-13 23:58:58 +0000 | [diff] [blame] | 746 | Jump checkStructure(RegisterID reg, Structure* structure); |
barraclough@apple.com | f5f7482 | 2008-11-21 05:04:19 +0000 | [diff] [blame] | 747 | |
commit-queue@webkit.org | 8481462 | 2011-08-25 01:25:38 +0000 | [diff] [blame] | 748 | void updateTopCallFrame(); |
barraclough@apple.com | 23f0c05 | 2008-12-16 04:48:16 +0000 | [diff] [blame] | 749 | |
barraclough@apple.com | 97bacef | 2009-06-05 07:55:38 +0000 | [diff] [blame] | 750 | Call emitNakedCall(CodePtr function = CodePtr()); |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 751 | |
oliver@apple.com | 5230bd3 | 2010-05-06 19:39:54 +0000 | [diff] [blame] | 752 | // Loads the character value of a single character string into dst. |
| 753 | void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures); |
| 754 | |
fpizlo@apple.com | 903c378 | 2011-09-15 23:24:27 +0000 | [diff] [blame] | 755 | #if ENABLE(DFG_JIT) |
mark.lam@apple.com | a61ec35 | 2013-04-22 17:37:29 +0000 | [diff] [blame] | 756 | void emitEnterOptimizationCheck(); |
fpizlo@apple.com | 594887a | 2011-09-06 09:23:55 +0000 | [diff] [blame] | 757 | #else |
mark.lam@apple.com | a61ec35 | 2013-04-22 17:37:29 +0000 | [diff] [blame] | 758 | void emitEnterOptimizationCheck() { } |
fpizlo@apple.com | 594887a | 2011-09-06 09:23:55 +0000 | [diff] [blame] | 759 | #endif |
mark.lam@apple.com | dff6b22 | 2013-04-17 22:37:45 +0000 | [diff] [blame] | 760 | |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 761 | #ifndef NDEBUG |
msaboff@apple.com | 7535bbd | 2013-09-10 06:01:03 +0000 | [diff] [blame] | 762 | void printBytecodeOperandTypes(int src1, int src2); |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 763 | #endif |
| 764 | |
barraclough@apple.com | 536c0db | 2009-05-12 06:21:56 +0000 | [diff] [blame] | 765 | #if ENABLE(SAMPLING_FLAGS) |
barraclough@apple.com | c32f32e | 2009-05-13 09:10:02 +0000 | [diff] [blame] | 766 | void setSamplingFlag(int32_t); |
| 767 | void clearSamplingFlag(int32_t); |
| 768 | #endif |
| 769 | |
| 770 | #if ENABLE(SAMPLING_COUNTERS) |
barraclough@apple.com | 6d410b0 | 2011-11-10 20:24:06 +0000 | [diff] [blame] | 771 | void emitCount(AbstractSamplingCounter&, int32_t = 1); |
barraclough@apple.com | 24a7abb | 2009-01-16 23:34:46 +0000 | [diff] [blame] | 772 | #endif |
| 773 | |
| 774 | #if ENABLE(OPCODE_SAMPLING) |
barraclough@apple.com | 536c0db | 2009-05-12 06:21:56 +0000 | [diff] [blame] | 775 | void sampleInstruction(Instruction*, bool = false); |
barraclough@apple.com | 24a7abb | 2009-01-16 23:34:46 +0000 | [diff] [blame] | 776 | #endif |
barraclough@apple.com | 536c0db | 2009-05-12 06:21:56 +0000 | [diff] [blame] | 777 | |
| 778 | #if ENABLE(CODEBLOCK_SAMPLING) |
| 779 | void sampleCodeBlock(CodeBlock*); |
barraclough@apple.com | 24a7abb | 2009-01-16 23:34:46 +0000 | [diff] [blame] | 780 | #else |
barraclough@apple.com | 536c0db | 2009-05-12 06:21:56 +0000 | [diff] [blame] | 781 | void sampleCodeBlock(CodeBlock*) {} |
barraclough@apple.com | 24a7abb | 2009-01-16 23:34:46 +0000 | [diff] [blame] | 782 | #endif |
| 783 | |
fpizlo@apple.com | 903c378 | 2011-09-15 23:24:27 +0000 | [diff] [blame] | 784 | #if ENABLE(DFG_JIT) |
fpizlo@apple.com | 98aa253 | 2011-09-25 23:40:51 +0000 | [diff] [blame] | 785 | bool canBeOptimized() { return m_canBeOptimized; } |
fpizlo@apple.com | 4d95ce6 | 2013-02-27 03:52:58 +0000 | [diff] [blame] | 786 | bool canBeOptimizedOrInlined() { return m_canBeOptimizedOrInlined; } |
fpizlo@apple.com | 5e3852d | 2012-05-24 00:05:21 +0000 | [diff] [blame] | 787 | bool shouldEmitProfiling() { return m_shouldEmitProfiling; } |
fpizlo@apple.com | 452cb41 | 2011-09-08 21:38:04 +0000 | [diff] [blame] | 788 | #else |
fpizlo@apple.com | 98aa253 | 2011-09-25 23:40:51 +0000 | [diff] [blame] | 789 | bool canBeOptimized() { return false; } |
commit-queue@webkit.org | 456305d | 2013-02-27 18:34:33 +0000 | [diff] [blame] | 790 | bool canBeOptimizedOrInlined() { return false; } |
fpizlo@apple.com | 452cb41 | 2011-09-08 21:38:04 +0000 | [diff] [blame] | 791 | // Enables use of value profiler with tiered compilation turned off, |
| 792 | // in which case all code gets profiled. |
fpizlo@apple.com | 8584632 | 2013-02-28 23:23:14 +0000 | [diff] [blame] | 793 | bool shouldEmitProfiling() { return false; } |
fpizlo@apple.com | 452cb41 | 2011-09-08 21:38:04 +0000 | [diff] [blame] | 794 | #endif |
| 795 | |
ggaren@apple.com | 031563e | 2008-11-17 02:21:16 +0000 | [diff] [blame] | 796 | Interpreter* m_interpreter; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 797 | |
| 798 | Vector<CallRecord> m_calls; |
barraclough@apple.com | a2a2e13 | 2008-12-13 23:58:58 +0000 | [diff] [blame] | 799 | Vector<Label> m_labels; |
fpizlo@apple.com | 5ba0788 | 2013-10-19 23:13:23 +0000 | [diff] [blame] | 800 | Vector<JITGetByIdGenerator> m_getByIds; |
| 801 | Vector<JITPutByIdGenerator> m_putByIds; |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 802 | Vector<ByValCompilationInfo> m_byValCompilationInfo; |
barraclough@apple.com | e964265 | 2008-10-23 22:29:54 +0000 | [diff] [blame] | 803 | Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo; |
barraclough@apple.com | a2a2e13 | 2008-12-13 23:58:58 +0000 | [diff] [blame] | 804 | Vector<JumpTable> m_jmpTable; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 805 | |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 806 | unsigned m_bytecodeOffset; |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 807 | Vector<SlowCaseEntry> m_slowCases; |
| 808 | Vector<SwitchRecord> m_switches; |
| 809 | |
msaboff@apple.com | 8f4bb0c | 2013-10-02 23:33:46 +0000 | [diff] [blame] | 810 | JumpList m_exceptionChecks; |
msaboff@apple.com | 5ca16c4 | 2013-10-07 18:20:27 +0000 | [diff] [blame] | 811 | JumpList m_exceptionChecksWithCallFrameRollback; |
msaboff@apple.com | 8f4bb0c | 2013-10-02 23:33:46 +0000 | [diff] [blame] | 812 | |
fpizlo@apple.com | 5ba0788 | 2013-10-19 23:13:23 +0000 | [diff] [blame] | 813 | unsigned m_getByIdIndex; |
| 814 | unsigned m_putByIdIndex; |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 815 | unsigned m_byValInstructionIndex; |
weinig@apple.com | 0d74a26 | 2009-05-12 01:06:58 +0000 | [diff] [blame] | 816 | unsigned m_callLinkInfoIndex; |
ggaren@apple.com | d8fccca | 2009-05-08 20:51:53 +0000 | [diff] [blame] | 817 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 818 | #if USE(JSVALUE32_64) |
| 819 | unsigned m_jumpTargetIndex; |
ggaren@apple.com | 1ba4981 | 2010-05-19 18:28:54 +0000 | [diff] [blame] | 820 | unsigned m_mappedBytecodeOffset; |
ggaren@apple.com | e1e4591 | 2011-11-14 19:44:32 +0000 | [diff] [blame] | 821 | int m_mappedVirtualRegisterIndex; |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 822 | RegisterID m_mappedTag; |
| 823 | RegisterID m_mappedPayload; |
| 824 | #else |
| 825 | int m_lastResultBytecodeRegister; |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 826 | #endif |
barraclough@apple.com | 4836c7a | 2011-05-01 22:20:59 +0000 | [diff] [blame] | 827 | unsigned m_jumpTargetsPosition; |
barraclough@apple.com | 970af2c | 2009-08-13 05:58:36 +0000 | [diff] [blame] | 828 | |
fpizlo@apple.com | 1949f32 | 2012-11-22 00:46:57 +0000 | [diff] [blame] | 829 | OwnPtr<JITDisassembler> m_disassembler; |
fpizlo@apple.com | d2deec8 | 2012-12-10 18:17:46 +0000 | [diff] [blame] | 830 | RefPtr<Profiler::Compilation> m_compilation; |
oliver@apple.com | 31df1c8 | 2011-05-20 01:33:46 +0000 | [diff] [blame] | 831 | WeakRandom m_randomGenerator; |
ggaren@apple.com | 9a9a4b5 | 2013-04-18 19:32:17 +0000 | [diff] [blame] | 832 | static CodeRef stringGetByValStubGenerator(VM*); |
barraclough@apple.com | e32d4ec | 2011-09-21 22:43:11 +0000 | [diff] [blame] | 833 | |
| 834 | #if ENABLE(VALUE_PROFILER) |
fpizlo@apple.com | 452cb41 | 2011-09-08 21:38:04 +0000 | [diff] [blame] | 835 | bool m_canBeOptimized; |
fpizlo@apple.com | 4d95ce6 | 2013-02-27 03:52:58 +0000 | [diff] [blame] | 836 | bool m_canBeOptimizedOrInlined; |
fpizlo@apple.com | 5e3852d | 2012-05-24 00:05:21 +0000 | [diff] [blame] | 837 | bool m_shouldEmitProfiling; |
barraclough@apple.com | e32d4ec | 2011-09-21 22:43:11 +0000 | [diff] [blame] | 838 | #endif |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 839 | } JIT_CLASS_ALIGNMENT; |
mjs@apple.com | be317ee | 2009-12-12 17:52:21 +0000 | [diff] [blame] | 840 | |
ggaren@apple.com | 540d71a6 | 2009-07-30 20:57:44 +0000 | [diff] [blame] | 841 | } // namespace JSC |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 842 | |
ggaren@apple.com | f272d2d | 2008-11-17 04:25:37 +0000 | [diff] [blame] | 843 | #endif // ENABLE(JIT) |
mrowe@apple.com | f88a463 | 2008-09-07 05:44:58 +0000 | [diff] [blame] | 844 | |
ggaren@apple.com | cc0f1f1 | 2008-11-17 23:16:00 +0000 | [diff] [blame] | 845 | #endif // JIT_h |