kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_IA32_LITHIUM_IA32_H_ |
| 29 | #define V8_IA32_LITHIUM_IA32_H_ |
| 30 | |
| 31 | #include "hydrogen.h" |
| 32 | #include "lithium-allocator.h" |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 33 | #include "lithium.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 34 | #include "safepoint-table.h" |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 35 | #include "utils.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 36 | |
| 37 | namespace v8 { |
| 38 | namespace internal { |
| 39 | |
| 40 | // Forward declarations. |
| 41 | class LCodeGen; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 42 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 43 | #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 44 | V(AccessArgumentsAt) \ |
| 45 | V(AddI) \ |
| 46 | V(ApplyArguments) \ |
| 47 | V(ArgumentsElements) \ |
| 48 | V(ArgumentsLength) \ |
| 49 | V(ArithmeticD) \ |
| 50 | V(ArithmeticT) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 51 | V(ArrayLiteral) \ |
| 52 | V(BitI) \ |
| 53 | V(BitNotI) \ |
| 54 | V(BoundsCheck) \ |
| 55 | V(Branch) \ |
| 56 | V(CallConstantFunction) \ |
| 57 | V(CallFunction) \ |
| 58 | V(CallGlobal) \ |
| 59 | V(CallKeyed) \ |
| 60 | V(CallKnownGlobal) \ |
| 61 | V(CallNamed) \ |
| 62 | V(CallNew) \ |
| 63 | V(CallRuntime) \ |
| 64 | V(CallStub) \ |
| 65 | V(CheckFunction) \ |
| 66 | V(CheckInstanceType) \ |
| 67 | V(CheckMap) \ |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 68 | V(CheckNonSmi) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 69 | V(CheckPrototypeMaps) \ |
| 70 | V(CheckSmi) \ |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 71 | V(ClampDToUint8) \ |
| 72 | V(ClampIToUint8) \ |
| 73 | V(ClampTToUint8) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 74 | V(ClassOfTestAndBranch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 75 | V(CmpIDAndBranch) \ |
lrn@chromium.org | ac2828d | 2011-06-23 06:29:21 +0000 | [diff] [blame] | 76 | V(CmpObjectEqAndBranch) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 77 | V(CmpMapAndBranch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 78 | V(CmpT) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 79 | V(CmpConstantEqAndBranch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 80 | V(ConstantD) \ |
| 81 | V(ConstantI) \ |
| 82 | V(ConstantT) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 83 | V(Context) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 84 | V(DeleteProperty) \ |
| 85 | V(Deoptimize) \ |
| 86 | V(DivI) \ |
| 87 | V(DoubleToI) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 88 | V(ElementsKind) \ |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 89 | V(FixedArrayBaseLength) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 90 | V(FunctionLiteral) \ |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 91 | V(GetCachedArrayIndex) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 92 | V(GlobalObject) \ |
| 93 | V(GlobalReceiver) \ |
| 94 | V(Goto) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 95 | V(HasCachedArrayIndexAndBranch) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 96 | V(HasInstanceTypeAndBranch) \ |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 97 | V(In) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 98 | V(InstanceOf) \ |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 99 | V(InstanceOfKnownGlobal) \ |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 100 | V(InstructionGap) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 101 | V(Integer32ToDouble) \ |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 102 | V(InvokeFunction) \ |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 103 | V(IsConstructCallAndBranch) \ |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 104 | V(IsNilAndBranch) \ |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 105 | V(IsObjectAndBranch) \ |
erikcorry | 0ad885c | 2011-11-21 13:51:57 +0000 | [diff] [blame] | 106 | V(IsStringAndBranch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 107 | V(IsSmiAndBranch) \ |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 108 | V(IsUndetectableAndBranch) \ |
erikcorry | 0ad885c | 2011-11-21 13:51:57 +0000 | [diff] [blame] | 109 | V(StringCompareAndBranch) \ |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 110 | V(JSArrayLength) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 111 | V(Label) \ |
| 112 | V(LazyBailout) \ |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 113 | V(LoadContextSlot) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 114 | V(LoadElements) \ |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 115 | V(LoadExternalArrayPointer) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 116 | V(LoadFunctionPrototype) \ |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 117 | V(LoadGlobalCell) \ |
| 118 | V(LoadGlobalGeneric) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 119 | V(LoadKeyedFastElement) \ |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 120 | V(LoadKeyedFastDoubleElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 121 | V(LoadKeyedGeneric) \ |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 122 | V(LoadKeyedSpecializedArrayElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 123 | V(LoadNamedField) \ |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 124 | V(LoadNamedFieldPolymorphic) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 125 | V(LoadNamedGeneric) \ |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 126 | V(MathPowHalf) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 127 | V(ModI) \ |
| 128 | V(MulI) \ |
| 129 | V(NumberTagD) \ |
| 130 | V(NumberTagI) \ |
| 131 | V(NumberUntagD) \ |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 132 | V(ObjectLiteralFast) \ |
| 133 | V(ObjectLiteralGeneric) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 134 | V(OsrEntry) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 135 | V(OuterContext) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 136 | V(Parameter) \ |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 137 | V(Power) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 138 | V(PushArgument) \ |
| 139 | V(RegExpLiteral) \ |
| 140 | V(Return) \ |
| 141 | V(ShiftI) \ |
| 142 | V(SmiTag) \ |
| 143 | V(SmiUntag) \ |
| 144 | V(StackCheck) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 145 | V(StoreContextSlot) \ |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 146 | V(StoreGlobalCell) \ |
| 147 | V(StoreGlobalGeneric) \ |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 148 | V(StoreKeyedFastDoubleElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 149 | V(StoreKeyedFastElement) \ |
| 150 | V(StoreKeyedGeneric) \ |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 151 | V(StoreKeyedSpecializedArrayElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 152 | V(StoreNamedField) \ |
| 153 | V(StoreNamedGeneric) \ |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 154 | V(StringAdd) \ |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 155 | V(StringCharCodeAt) \ |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 156 | V(StringCharFromCode) \ |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 157 | V(StringLength) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 158 | V(SubI) \ |
| 159 | V(TaggedToI) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 160 | V(ThisFunction) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 161 | V(Throw) \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 162 | V(ToFastProperties) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 163 | V(TransitionElementsKind) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 164 | V(Typeof) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 165 | V(TypeofIsAndBranch) \ |
| 166 | V(UnaryMathOperation) \ |
| 167 | V(UnknownOSRValue) \ |
| 168 | V(ValueOf) |
| 169 | |
| 170 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 171 | #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 172 | virtual Opcode opcode() const { return LInstruction::k##type; } \ |
| 173 | virtual void CompileToNative(LCodeGen* generator); \ |
| 174 | virtual const char* Mnemonic() const { return mnemonic; } \ |
| 175 | static L##type* cast(LInstruction* instr) { \ |
| 176 | ASSERT(instr->Is##type()); \ |
| 177 | return reinterpret_cast<L##type*>(instr); \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 181 | #define DECLARE_HYDROGEN_ACCESSOR(type) \ |
| 182 | H##type* hydrogen() const { \ |
| 183 | return H##type::cast(hydrogen_value()); \ |
| 184 | } |
| 185 | |
| 186 | |
| 187 | class LInstruction: public ZoneObject { |
| 188 | public: |
| 189 | LInstruction() |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 190 | : environment_(NULL), |
| 191 | hydrogen_value_(NULL), |
| 192 | is_call_(false), |
| 193 | is_save_doubles_(false) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 194 | virtual ~LInstruction() { } |
| 195 | |
| 196 | virtual void CompileToNative(LCodeGen* generator) = 0; |
| 197 | virtual const char* Mnemonic() const = 0; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 198 | virtual void PrintTo(StringStream* stream); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 199 | virtual void PrintDataTo(StringStream* stream); |
| 200 | virtual void PrintOutputOperandTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 201 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 202 | enum Opcode { |
| 203 | // Declare a unique enum value for each instruction. |
| 204 | #define DECLARE_OPCODE(type) k##type, |
| 205 | LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) |
| 206 | kNumberOfInstructions |
| 207 | #undef DECLARE_OPCODE |
| 208 | }; |
| 209 | |
| 210 | virtual Opcode opcode() const = 0; |
| 211 | |
| 212 | // Declare non-virtual type testers for all leaf IR classes. |
| 213 | #define DECLARE_PREDICATE(type) \ |
| 214 | bool Is##type() const { return opcode() == k##type; } |
| 215 | LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
| 216 | #undef DECLARE_PREDICATE |
| 217 | |
| 218 | // Declare virtual predicates for instructions that don't have |
| 219 | // an opcode. |
| 220 | virtual bool IsGap() const { return false; } |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 221 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 222 | virtual bool IsControl() const { return false; } |
| 223 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 224 | void set_environment(LEnvironment* env) { environment_ = env; } |
| 225 | LEnvironment* environment() const { return environment_; } |
| 226 | bool HasEnvironment() const { return environment_ != NULL; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 227 | |
| 228 | void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 229 | LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 230 | bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 231 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 232 | |
| 233 | void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 234 | HValue* hydrogen_value() const { return hydrogen_value_; } |
| 235 | |
fschneider@chromium.org | 1df6b47 | 2011-01-26 08:23:03 +0000 | [diff] [blame] | 236 | void set_deoptimization_environment(LEnvironment* env) { |
| 237 | deoptimization_environment_.set(env); |
| 238 | } |
| 239 | LEnvironment* deoptimization_environment() const { |
| 240 | return deoptimization_environment_.get(); |
| 241 | } |
| 242 | bool HasDeoptimizationEnvironment() const { |
| 243 | return deoptimization_environment_.is_set(); |
| 244 | } |
| 245 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 246 | void MarkAsCall() { is_call_ = true; } |
| 247 | void MarkAsSaveDoubles() { is_save_doubles_ = true; } |
| 248 | |
| 249 | // Interface to the register allocator and iterators. |
| 250 | bool IsMarkedAsCall() const { return is_call_; } |
| 251 | bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; } |
| 252 | |
| 253 | virtual bool HasResult() const = 0; |
| 254 | virtual LOperand* result() = 0; |
| 255 | |
| 256 | virtual int InputCount() = 0; |
| 257 | virtual LOperand* InputAt(int i) = 0; |
| 258 | virtual int TempCount() = 0; |
| 259 | virtual LOperand* TempAt(int i) = 0; |
| 260 | |
| 261 | LOperand* FirstInput() { return InputAt(0); } |
| 262 | LOperand* Output() { return HasResult() ? result() : NULL; } |
| 263 | |
| 264 | #ifdef DEBUG |
| 265 | void VerifyCall(); |
| 266 | #endif |
| 267 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 268 | private: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 269 | LEnvironment* environment_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 270 | SetOncePointer<LPointerMap> pointer_map_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 271 | HValue* hydrogen_value_; |
fschneider@chromium.org | 1df6b47 | 2011-01-26 08:23:03 +0000 | [diff] [blame] | 272 | SetOncePointer<LEnvironment> deoptimization_environment_; |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 273 | bool is_call_; |
| 274 | bool is_save_doubles_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 275 | }; |
| 276 | |
| 277 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 278 | // R = number of result operands (0 or 1). |
| 279 | // I = number of input operands. |
| 280 | // T = number of temporary operands. |
| 281 | template<int R, int I, int T> |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 282 | class LTemplateInstruction: public LInstruction { |
| 283 | public: |
| 284 | // Allow 0 or 1 output operands. |
| 285 | STATIC_ASSERT(R == 0 || R == 1); |
| 286 | virtual bool HasResult() const { return R != 0; } |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 287 | void set_result(LOperand* operand) { results_[0] = operand; } |
| 288 | LOperand* result() { return results_[0]; } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 289 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 290 | int InputCount() { return I; } |
| 291 | LOperand* InputAt(int i) { return inputs_[i]; } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 292 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 293 | int TempCount() { return T; } |
| 294 | LOperand* TempAt(int i) { return temps_[i]; } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 295 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 296 | protected: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 297 | EmbeddedContainer<LOperand*, R> results_; |
| 298 | EmbeddedContainer<LOperand*, I> inputs_; |
| 299 | EmbeddedContainer<LOperand*, T> temps_; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 300 | }; |
| 301 | |
| 302 | |
| 303 | class LGap: public LTemplateInstruction<0, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 304 | public: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 305 | explicit LGap(HBasicBlock* block) : block_(block) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 306 | parallel_moves_[BEFORE] = NULL; |
| 307 | parallel_moves_[START] = NULL; |
| 308 | parallel_moves_[END] = NULL; |
| 309 | parallel_moves_[AFTER] = NULL; |
| 310 | } |
| 311 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 312 | // Can't use the DECLARE-macro here because of sub-classes. |
| 313 | virtual bool IsGap() const { return true; } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 314 | virtual void PrintDataTo(StringStream* stream); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 315 | static LGap* cast(LInstruction* instr) { |
| 316 | ASSERT(instr->IsGap()); |
| 317 | return reinterpret_cast<LGap*>(instr); |
| 318 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 319 | |
| 320 | bool IsRedundant() const; |
| 321 | |
| 322 | HBasicBlock* block() const { return block_; } |
| 323 | |
| 324 | enum InnerPosition { |
| 325 | BEFORE, |
| 326 | START, |
| 327 | END, |
| 328 | AFTER, |
| 329 | FIRST_INNER_POSITION = BEFORE, |
| 330 | LAST_INNER_POSITION = AFTER |
| 331 | }; |
| 332 | |
| 333 | LParallelMove* GetOrCreateParallelMove(InnerPosition pos) { |
| 334 | if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove; |
| 335 | return parallel_moves_[pos]; |
| 336 | } |
| 337 | |
| 338 | LParallelMove* GetParallelMove(InnerPosition pos) { |
| 339 | return parallel_moves_[pos]; |
| 340 | } |
| 341 | |
| 342 | private: |
| 343 | LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; |
| 344 | HBasicBlock* block_; |
| 345 | }; |
| 346 | |
| 347 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 348 | class LInstructionGap: public LGap { |
| 349 | public: |
| 350 | explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } |
| 351 | |
| 352 | DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") |
| 353 | }; |
| 354 | |
| 355 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 356 | class LGoto: public LTemplateInstruction<0, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 357 | public: |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 358 | explicit LGoto(int block_id) : block_id_(block_id) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 359 | |
| 360 | DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 361 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 362 | virtual bool IsControl() const { return true; } |
| 363 | |
| 364 | int block_id() const { return block_id_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 365 | |
| 366 | private: |
| 367 | int block_id_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 368 | }; |
| 369 | |
| 370 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 371 | class LLazyBailout: public LTemplateInstruction<0, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 372 | public: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 373 | DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout") |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 374 | }; |
| 375 | |
| 376 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 377 | class LDeoptimize: public LTemplateInstruction<0, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 378 | public: |
| 379 | DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") |
| 380 | }; |
| 381 | |
| 382 | |
| 383 | class LLabel: public LGap { |
| 384 | public: |
| 385 | explicit LLabel(HBasicBlock* block) |
| 386 | : LGap(block), replacement_(NULL) { } |
| 387 | |
| 388 | DECLARE_CONCRETE_INSTRUCTION(Label, "label") |
| 389 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 390 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 391 | |
| 392 | int block_id() const { return block()->block_id(); } |
| 393 | bool is_loop_header() const { return block()->IsLoopHeader(); } |
| 394 | Label* label() { return &label_; } |
| 395 | LLabel* replacement() const { return replacement_; } |
| 396 | void set_replacement(LLabel* label) { replacement_ = label; } |
| 397 | bool HasReplacement() const { return replacement_ != NULL; } |
| 398 | |
| 399 | private: |
| 400 | Label label_; |
| 401 | LLabel* replacement_; |
| 402 | }; |
| 403 | |
| 404 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 405 | class LParameter: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 406 | public: |
| 407 | DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") |
| 408 | }; |
| 409 | |
| 410 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 411 | class LCallStub: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 412 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 413 | explicit LCallStub(LOperand* context) { |
| 414 | inputs_[0] = context; |
| 415 | } |
| 416 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 417 | DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub") |
| 418 | DECLARE_HYDROGEN_ACCESSOR(CallStub) |
| 419 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 420 | LOperand* context() { return inputs_[0]; } |
| 421 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 422 | TranscendentalCache::Type transcendental_type() { |
| 423 | return hydrogen()->transcendental_type(); |
| 424 | } |
| 425 | }; |
| 426 | |
| 427 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 428 | class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 429 | public: |
| 430 | DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
| 431 | }; |
| 432 | |
| 433 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 434 | template<int I, int T> |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 435 | class LControlInstruction: public LTemplateInstruction<0, I, T> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 436 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 437 | virtual bool IsControl() const { return true; } |
| 438 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 439 | int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
| 440 | HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
| 441 | int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } |
| 442 | int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 443 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 444 | private: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 445 | HControlInstruction* hydrogen() { |
| 446 | return HControlInstruction::cast(this->hydrogen_value()); |
| 447 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 448 | }; |
| 449 | |
| 450 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 451 | class LApplyArguments: public LTemplateInstruction<1, 4, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 452 | public: |
| 453 | LApplyArguments(LOperand* function, |
| 454 | LOperand* receiver, |
| 455 | LOperand* length, |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 456 | LOperand* elements, |
| 457 | LOperand* temp) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 458 | inputs_[0] = function; |
| 459 | inputs_[1] = receiver; |
| 460 | inputs_[2] = length; |
| 461 | inputs_[3] = elements; |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 462 | temps_[0] = temp; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 463 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 464 | |
| 465 | DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") |
| 466 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 467 | LOperand* function() { return inputs_[0]; } |
| 468 | LOperand* receiver() { return inputs_[1]; } |
| 469 | LOperand* length() { return inputs_[2]; } |
| 470 | LOperand* elements() { return inputs_[3]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 471 | }; |
| 472 | |
| 473 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 474 | class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 475 | public: |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 476 | LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 477 | inputs_[0] = arguments; |
| 478 | inputs_[1] = length; |
| 479 | inputs_[2] = index; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 480 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 481 | |
| 482 | DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") |
| 483 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 484 | LOperand* arguments() { return inputs_[0]; } |
| 485 | LOperand* length() { return inputs_[1]; } |
| 486 | LOperand* index() { return inputs_[2]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 487 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 488 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 489 | }; |
| 490 | |
| 491 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 492 | class LArgumentsLength: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 493 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 494 | explicit LArgumentsLength(LOperand* elements) { |
| 495 | inputs_[0] = elements; |
| 496 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 497 | |
| 498 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") |
| 499 | }; |
| 500 | |
| 501 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 502 | class LArgumentsElements: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 503 | public: |
| 504 | LArgumentsElements() { } |
| 505 | |
| 506 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") |
| 507 | }; |
| 508 | |
| 509 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 510 | class LModI: public LTemplateInstruction<1, 2, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 511 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 512 | LModI(LOperand* left, LOperand* right, LOperand* temp) { |
| 513 | inputs_[0] = left; |
| 514 | inputs_[1] = right; |
| 515 | temps_[0] = temp; |
| 516 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 517 | |
| 518 | DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") |
| 519 | DECLARE_HYDROGEN_ACCESSOR(Mod) |
| 520 | }; |
| 521 | |
| 522 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 523 | class LDivI: public LTemplateInstruction<1, 2, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 524 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 525 | LDivI(LOperand* left, LOperand* right, LOperand* temp) { |
| 526 | inputs_[0] = left; |
| 527 | inputs_[1] = right; |
| 528 | temps_[0] = temp; |
| 529 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 530 | |
| 531 | DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") |
| 532 | DECLARE_HYDROGEN_ACCESSOR(Div) |
| 533 | }; |
| 534 | |
| 535 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 536 | class LMulI: public LTemplateInstruction<1, 2, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 537 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 538 | LMulI(LOperand* left, LOperand* right, LOperand* temp) { |
| 539 | inputs_[0] = left; |
| 540 | inputs_[1] = right; |
| 541 | temps_[0] = temp; |
| 542 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 543 | |
| 544 | DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") |
| 545 | DECLARE_HYDROGEN_ACCESSOR(Mul) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 546 | }; |
| 547 | |
| 548 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 549 | class LCmpIDAndBranch: public LControlInstruction<2, 0> { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 550 | public: |
| 551 | LCmpIDAndBranch(LOperand* left, LOperand* right) { |
| 552 | inputs_[0] = left; |
| 553 | inputs_[1] = right; |
| 554 | } |
| 555 | |
| 556 | DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 557 | DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 558 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 559 | Token::Value op() const { return hydrogen()->token(); } |
| 560 | bool is_double() const { |
| 561 | return hydrogen()->GetInputRepresentation().IsDouble(); |
| 562 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 563 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 564 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 565 | }; |
| 566 | |
| 567 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 568 | class LUnaryMathOperation: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 569 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 570 | LUnaryMathOperation(LOperand* context, LOperand* value) { |
| 571 | inputs_[1] = context; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 572 | inputs_[0] = value; |
| 573 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 574 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 575 | LOperand* context() { return inputs_[1]; } |
| 576 | LOperand* value() { return inputs_[0]; } |
| 577 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 578 | DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation") |
| 579 | DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
| 580 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 581 | virtual void PrintDataTo(StringStream* stream); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 582 | BuiltinFunctionId op() const { return hydrogen()->op(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 583 | }; |
| 584 | |
| 585 | |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 586 | class LMathPowHalf: public LTemplateInstruction<1, 2, 1> { |
| 587 | public: |
| 588 | LMathPowHalf(LOperand* context, LOperand* value, LOperand* temp) { |
| 589 | inputs_[1] = context; |
| 590 | inputs_[0] = value; |
| 591 | temps_[0] = temp; |
| 592 | } |
| 593 | |
| 594 | LOperand* context() { return inputs_[1]; } |
| 595 | LOperand* value() { return inputs_[0]; } |
| 596 | LOperand* temp() { return temps_[0]; } |
| 597 | |
| 598 | DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half") |
| 599 | |
| 600 | virtual void PrintDataTo(StringStream* stream); |
| 601 | }; |
| 602 | |
| 603 | |
lrn@chromium.org | ac2828d | 2011-06-23 06:29:21 +0000 | [diff] [blame] | 604 | class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 605 | public: |
lrn@chromium.org | ac2828d | 2011-06-23 06:29:21 +0000 | [diff] [blame] | 606 | LCmpObjectEqAndBranch(LOperand* left, LOperand* right) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 607 | inputs_[0] = left; |
| 608 | inputs_[1] = right; |
| 609 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 610 | |
lrn@chromium.org | ac2828d | 2011-06-23 06:29:21 +0000 | [diff] [blame] | 611 | DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, |
| 612 | "cmp-object-eq-and-branch") |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 613 | }; |
| 614 | |
| 615 | |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 616 | class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> { |
| 617 | public: |
| 618 | explicit LCmpConstantEqAndBranch(LOperand* left) { |
| 619 | inputs_[0] = left; |
| 620 | } |
| 621 | |
| 622 | DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch, |
| 623 | "cmp-constant-eq-and-branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 624 | DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 625 | }; |
| 626 | |
| 627 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 628 | class LIsNilAndBranch: public LControlInstruction<1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 629 | public: |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 630 | LIsNilAndBranch(LOperand* value, LOperand* temp) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 631 | inputs_[0] = value; |
| 632 | temps_[0] = temp; |
| 633 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 634 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 635 | DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch") |
| 636 | DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 637 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 638 | EqualityKind kind() const { return hydrogen()->kind(); } |
| 639 | NilValue nil() const { return hydrogen()->nil(); } |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 640 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 641 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 642 | }; |
| 643 | |
| 644 | |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 645 | class LIsObjectAndBranch: public LControlInstruction<1, 1> { |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 646 | public: |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 647 | LIsObjectAndBranch(LOperand* value, LOperand* temp) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 648 | inputs_[0] = value; |
| 649 | temps_[0] = temp; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 650 | } |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 651 | |
| 652 | DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch") |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 653 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 654 | virtual void PrintDataTo(StringStream* stream); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 655 | }; |
| 656 | |
| 657 | |
erikcorry | 0ad885c | 2011-11-21 13:51:57 +0000 | [diff] [blame] | 658 | class LIsStringAndBranch: public LControlInstruction<1, 1> { |
| 659 | public: |
| 660 | LIsStringAndBranch(LOperand* value, LOperand* temp) { |
| 661 | inputs_[0] = value; |
| 662 | temps_[0] = temp; |
| 663 | } |
| 664 | |
| 665 | DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch") |
| 666 | |
| 667 | virtual void PrintDataTo(StringStream* stream); |
| 668 | }; |
| 669 | |
| 670 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 671 | class LIsSmiAndBranch: public LControlInstruction<1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 672 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 673 | explicit LIsSmiAndBranch(LOperand* value) { |
| 674 | inputs_[0] = value; |
| 675 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 676 | |
| 677 | DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 678 | DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 679 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 680 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 681 | }; |
| 682 | |
| 683 | |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 684 | class LIsUndetectableAndBranch: public LControlInstruction<1, 1> { |
| 685 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 686 | LIsUndetectableAndBranch(LOperand* value, LOperand* temp) { |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 687 | inputs_[0] = value; |
| 688 | temps_[0] = temp; |
| 689 | } |
| 690 | |
| 691 | DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch, |
| 692 | "is-undetectable-and-branch") |
| 693 | |
| 694 | virtual void PrintDataTo(StringStream* stream); |
| 695 | }; |
| 696 | |
| 697 | |
erikcorry | 0ad885c | 2011-11-21 13:51:57 +0000 | [diff] [blame] | 698 | class LStringCompareAndBranch: public LControlInstruction<3, 0> { |
| 699 | public: |
| 700 | LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) { |
| 701 | inputs_[0] = context; |
| 702 | inputs_[1] = left; |
| 703 | inputs_[2] = right; |
| 704 | } |
| 705 | |
| 706 | DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch, |
| 707 | "string-compare-and-branch") |
| 708 | DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch) |
| 709 | |
| 710 | virtual void PrintDataTo(StringStream* stream); |
| 711 | |
| 712 | Token::Value op() const { return hydrogen()->token(); } |
| 713 | }; |
| 714 | |
| 715 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 716 | class LHasInstanceTypeAndBranch: public LControlInstruction<1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 717 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 718 | LHasInstanceTypeAndBranch(LOperand* value, LOperand* temp) { |
| 719 | inputs_[0] = value; |
| 720 | temps_[0] = temp; |
| 721 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 722 | |
| 723 | DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch, |
| 724 | "has-instance-type-and-branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 725 | DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 726 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 727 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 728 | }; |
| 729 | |
| 730 | |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 731 | class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> { |
| 732 | public: |
| 733 | explicit LGetCachedArrayIndex(LOperand* value) { |
| 734 | inputs_[0] = value; |
| 735 | } |
| 736 | |
| 737 | DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index") |
| 738 | DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex) |
| 739 | }; |
| 740 | |
| 741 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 742 | class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 743 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 744 | explicit LHasCachedArrayIndexAndBranch(LOperand* value) { |
| 745 | inputs_[0] = value; |
| 746 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 747 | |
| 748 | DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, |
| 749 | "has-cached-array-index-and-branch") |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 750 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 751 | }; |
| 752 | |
| 753 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 754 | class LIsConstructCallAndBranch: public LControlInstruction<0, 1> { |
| 755 | public: |
| 756 | explicit LIsConstructCallAndBranch(LOperand* temp) { |
| 757 | temps_[0] = temp; |
| 758 | } |
| 759 | |
| 760 | DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, |
| 761 | "is-construct-call-and-branch") |
| 762 | }; |
| 763 | |
| 764 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 765 | class LClassOfTestAndBranch: public LControlInstruction<1, 2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 766 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 767 | LClassOfTestAndBranch(LOperand* value, LOperand* temp, LOperand* temp2) { |
| 768 | inputs_[0] = value; |
| 769 | temps_[0] = temp; |
| 770 | temps_[1] = temp2; |
| 771 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 772 | |
| 773 | DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch, |
| 774 | "class-of-test-and-branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 775 | DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 776 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 777 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 778 | }; |
| 779 | |
| 780 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 781 | class LCmpT: public LTemplateInstruction<1, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 782 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 783 | LCmpT(LOperand* context, LOperand* left, LOperand* right) { |
| 784 | inputs_[0] = context; |
| 785 | inputs_[1] = left; |
| 786 | inputs_[2] = right; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 787 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 788 | |
| 789 | DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 790 | DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 791 | |
| 792 | Token::Value op() const { return hydrogen()->token(); } |
| 793 | }; |
| 794 | |
| 795 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 796 | class LInstanceOf: public LTemplateInstruction<1, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 797 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 798 | LInstanceOf(LOperand* context, LOperand* left, LOperand* right) { |
| 799 | inputs_[0] = context; |
| 800 | inputs_[1] = left; |
| 801 | inputs_[2] = right; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 802 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 803 | |
| 804 | DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 805 | |
| 806 | LOperand* context() { return inputs_[0]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 807 | }; |
| 808 | |
| 809 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 810 | class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 2, 1> { |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 811 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 812 | LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) { |
| 813 | inputs_[0] = context; |
| 814 | inputs_[1] = value; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 815 | temps_[0] = temp; |
| 816 | } |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 817 | |
| 818 | DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
| 819 | "instance-of-known-global") |
| 820 | DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) |
| 821 | |
| 822 | Handle<JSFunction> function() const { return hydrogen()->function(); } |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 823 | }; |
| 824 | |
| 825 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 826 | class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 827 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 828 | LBoundsCheck(LOperand* index, LOperand* length) { |
| 829 | inputs_[0] = index; |
| 830 | inputs_[1] = length; |
| 831 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 832 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 833 | LOperand* index() { return inputs_[0]; } |
| 834 | LOperand* length() { return inputs_[1]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 835 | |
| 836 | DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") |
| 837 | }; |
| 838 | |
| 839 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 840 | class LBitI: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 841 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 842 | LBitI(LOperand* left, LOperand* right) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 843 | inputs_[0] = left; |
| 844 | inputs_[1] = right; |
| 845 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 846 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 847 | Token::Value op() const { return hydrogen()->op(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 848 | |
| 849 | DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 850 | DECLARE_HYDROGEN_ACCESSOR(Bitwise) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 851 | }; |
| 852 | |
| 853 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 854 | class LShiftI: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 855 | public: |
| 856 | LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 857 | : op_(op), can_deopt_(can_deopt) { |
| 858 | inputs_[0] = left; |
| 859 | inputs_[1] = right; |
| 860 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 861 | |
| 862 | Token::Value op() const { return op_; } |
| 863 | |
| 864 | bool can_deopt() const { return can_deopt_; } |
| 865 | |
| 866 | DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") |
| 867 | |
| 868 | private: |
| 869 | Token::Value op_; |
| 870 | bool can_deopt_; |
| 871 | }; |
| 872 | |
| 873 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 874 | class LSubI: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 875 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 876 | LSubI(LOperand* left, LOperand* right) { |
| 877 | inputs_[0] = left; |
| 878 | inputs_[1] = right; |
| 879 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 880 | |
| 881 | DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") |
| 882 | DECLARE_HYDROGEN_ACCESSOR(Sub) |
| 883 | }; |
| 884 | |
| 885 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 886 | class LConstantI: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 887 | public: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 888 | DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 889 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 890 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 891 | int32_t value() const { return hydrogen()->Integer32Value(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 892 | }; |
| 893 | |
| 894 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 895 | class LConstantD: public LTemplateInstruction<1, 0, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 896 | public: |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 897 | explicit LConstantD(LOperand* temp) { |
| 898 | temps_[0] = temp; |
| 899 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 900 | |
| 901 | DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 902 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 903 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 904 | double value() const { return hydrogen()->DoubleValue(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 905 | }; |
| 906 | |
| 907 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 908 | class LConstantT: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 909 | public: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 910 | DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 911 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 912 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 913 | Handle<Object> value() const { return hydrogen()->handle(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 914 | }; |
| 915 | |
| 916 | |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 917 | class LBranch: public LControlInstruction<1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 918 | public: |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 919 | explicit LBranch(LOperand* value, LOperand* temp) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 920 | inputs_[0] = value; |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 921 | temps_[0] = temp; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 922 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 923 | |
| 924 | DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 925 | DECLARE_HYDROGEN_ACCESSOR(Branch) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 926 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 927 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 928 | }; |
| 929 | |
| 930 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 931 | class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 932 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 933 | explicit LCmpMapAndBranch(LOperand* value) { |
| 934 | inputs_[0] = value; |
| 935 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 936 | |
| 937 | DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 938 | DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 939 | |
| 940 | virtual bool IsControl() const { return true; } |
| 941 | |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 942 | Handle<Map> map() const { return hydrogen()->map(); } |
| 943 | int true_block_id() const { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 944 | return hydrogen()->FirstSuccessor()->block_id(); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 945 | } |
| 946 | int false_block_id() const { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 947 | return hydrogen()->SecondSuccessor()->block_id(); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 948 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 949 | }; |
| 950 | |
| 951 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 952 | class LJSArrayLength: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 953 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 954 | explicit LJSArrayLength(LOperand* value) { |
| 955 | inputs_[0] = value; |
| 956 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 957 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 958 | DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") |
| 959 | DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) |
| 960 | }; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 961 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 962 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 963 | class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 964 | public: |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 965 | explicit LFixedArrayBaseLength(LOperand* value) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 966 | inputs_[0] = value; |
| 967 | } |
| 968 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 969 | DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength, |
| 970 | "fixed-array-base-length") |
| 971 | DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 972 | }; |
| 973 | |
| 974 | |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 975 | class LElementsKind: public LTemplateInstruction<1, 1, 0> { |
| 976 | public: |
| 977 | explicit LElementsKind(LOperand* value) { |
| 978 | inputs_[0] = value; |
| 979 | } |
| 980 | |
| 981 | DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind") |
| 982 | DECLARE_HYDROGEN_ACCESSOR(ElementsKind) |
| 983 | }; |
| 984 | |
| 985 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 986 | class LValueOf: public LTemplateInstruction<1, 1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 987 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 988 | LValueOf(LOperand* value, LOperand* temp) { |
| 989 | inputs_[0] = value; |
| 990 | temps_[0] = temp; |
| 991 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 992 | |
| 993 | DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") |
| 994 | DECLARE_HYDROGEN_ACCESSOR(ValueOf) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 995 | }; |
| 996 | |
| 997 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 998 | class LThrow: public LTemplateInstruction<0, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 999 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1000 | LThrow(LOperand* context, LOperand* value) { |
| 1001 | inputs_[0] = context; |
| 1002 | inputs_[1] = value; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1003 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1004 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1005 | LOperand* context() { return inputs_[0]; } |
| 1006 | LOperand* value() { return inputs_[1]; } |
| 1007 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1008 | DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") |
| 1009 | }; |
| 1010 | |
| 1011 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1012 | class LBitNotI: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1013 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1014 | explicit LBitNotI(LOperand* value) { |
| 1015 | inputs_[0] = value; |
| 1016 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1017 | |
| 1018 | DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") |
| 1019 | }; |
| 1020 | |
| 1021 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1022 | class LAddI: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1023 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1024 | LAddI(LOperand* left, LOperand* right) { |
| 1025 | inputs_[0] = left; |
| 1026 | inputs_[1] = right; |
| 1027 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1028 | |
| 1029 | DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") |
| 1030 | DECLARE_HYDROGEN_ACCESSOR(Add) |
| 1031 | }; |
| 1032 | |
| 1033 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1034 | class LPower: public LTemplateInstruction<1, 2, 0> { |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1035 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1036 | LPower(LOperand* left, LOperand* right) { |
| 1037 | inputs_[0] = left; |
| 1038 | inputs_[1] = right; |
| 1039 | } |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1040 | |
| 1041 | DECLARE_CONCRETE_INSTRUCTION(Power, "power") |
| 1042 | DECLARE_HYDROGEN_ACCESSOR(Power) |
| 1043 | }; |
| 1044 | |
| 1045 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1046 | class LArithmeticD: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1047 | public: |
| 1048 | LArithmeticD(Token::Value op, LOperand* left, LOperand* right) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1049 | : op_(op) { |
| 1050 | inputs_[0] = left; |
| 1051 | inputs_[1] = right; |
| 1052 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1053 | |
| 1054 | Token::Value op() const { return op_; } |
| 1055 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1056 | virtual Opcode opcode() const { return LInstruction::kArithmeticD; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1057 | virtual void CompileToNative(LCodeGen* generator); |
| 1058 | virtual const char* Mnemonic() const; |
| 1059 | |
| 1060 | private: |
| 1061 | Token::Value op_; |
| 1062 | }; |
| 1063 | |
| 1064 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1065 | class LArithmeticT: public LTemplateInstruction<1, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1066 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1067 | LArithmeticT(Token::Value op, |
| 1068 | LOperand* context, |
| 1069 | LOperand* left, |
| 1070 | LOperand* right) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1071 | : op_(op) { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1072 | inputs_[0] = context; |
| 1073 | inputs_[1] = left; |
| 1074 | inputs_[2] = right; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1075 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1076 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1077 | virtual Opcode opcode() const { return LInstruction::kArithmeticT; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1078 | virtual void CompileToNative(LCodeGen* generator); |
| 1079 | virtual const char* Mnemonic() const; |
| 1080 | |
| 1081 | Token::Value op() const { return op_; } |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1082 | LOperand* context() { return inputs_[0]; } |
| 1083 | LOperand* left() { return inputs_[1]; } |
| 1084 | LOperand* right() { return inputs_[2]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1085 | |
| 1086 | private: |
| 1087 | Token::Value op_; |
| 1088 | }; |
| 1089 | |
| 1090 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1091 | class LReturn: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1092 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1093 | explicit LReturn(LOperand* value) { |
| 1094 | inputs_[0] = value; |
| 1095 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1096 | |
| 1097 | DECLARE_CONCRETE_INSTRUCTION(Return, "return") |
| 1098 | }; |
| 1099 | |
| 1100 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1101 | class LLoadNamedField: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1102 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1103 | explicit LLoadNamedField(LOperand* object) { |
| 1104 | inputs_[0] = object; |
| 1105 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1106 | |
| 1107 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") |
| 1108 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1109 | |
| 1110 | LOperand* object() { return inputs_[0]; } |
| 1111 | }; |
| 1112 | |
| 1113 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1114 | class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 2, 0> { |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1115 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1116 | LLoadNamedFieldPolymorphic(LOperand* context, LOperand* object) { |
| 1117 | inputs_[0] = context; |
| 1118 | inputs_[1] = object; |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic") |
| 1122 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic) |
| 1123 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1124 | LOperand* context() { return inputs_[0]; } |
| 1125 | LOperand* object() { return inputs_[1]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1126 | }; |
| 1127 | |
| 1128 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1129 | class LLoadNamedGeneric: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1130 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1131 | LLoadNamedGeneric(LOperand* context, LOperand* object) { |
| 1132 | inputs_[0] = context; |
| 1133 | inputs_[1] = object; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1134 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1135 | |
| 1136 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") |
| 1137 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) |
| 1138 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1139 | LOperand* context() { return inputs_[0]; } |
| 1140 | LOperand* object() { return inputs_[1]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1141 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1142 | }; |
| 1143 | |
| 1144 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1145 | class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 1> { |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1146 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1147 | LLoadFunctionPrototype(LOperand* function, LOperand* temp) { |
| 1148 | inputs_[0] = function; |
| 1149 | temps_[0] = temp; |
| 1150 | } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1151 | |
| 1152 | DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") |
| 1153 | DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) |
| 1154 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1155 | LOperand* function() { return inputs_[0]; } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1156 | }; |
| 1157 | |
| 1158 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1159 | class LLoadElements: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1160 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1161 | explicit LLoadElements(LOperand* object) { |
| 1162 | inputs_[0] = object; |
| 1163 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1164 | |
| 1165 | DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") |
| 1166 | }; |
| 1167 | |
| 1168 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 1169 | class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1170 | public: |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 1171 | explicit LLoadExternalArrayPointer(LOperand* object) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1172 | inputs_[0] = object; |
| 1173 | } |
| 1174 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 1175 | DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, |
| 1176 | "load-external-array-pointer") |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1177 | }; |
| 1178 | |
| 1179 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1180 | class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1181 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1182 | LLoadKeyedFastElement(LOperand* elements, LOperand* key) { |
| 1183 | inputs_[0] = elements; |
| 1184 | inputs_[1] = key; |
| 1185 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1186 | |
| 1187 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element") |
| 1188 | DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement) |
| 1189 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1190 | LOperand* elements() { return inputs_[0]; } |
| 1191 | LOperand* key() { return inputs_[1]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1192 | }; |
| 1193 | |
| 1194 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 1195 | class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> { |
| 1196 | public: |
| 1197 | LLoadKeyedFastDoubleElement(LOperand* elements, |
| 1198 | LOperand* key) { |
| 1199 | inputs_[0] = elements; |
| 1200 | inputs_[1] = key; |
| 1201 | } |
| 1202 | |
| 1203 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement, |
| 1204 | "load-keyed-fast-double-element") |
| 1205 | DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement) |
| 1206 | |
| 1207 | LOperand* elements() { return inputs_[0]; } |
| 1208 | LOperand* key() { return inputs_[1]; } |
| 1209 | }; |
| 1210 | |
| 1211 | |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1212 | class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1213 | public: |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1214 | LLoadKeyedSpecializedArrayElement(LOperand* external_pointer, |
| 1215 | LOperand* key) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1216 | inputs_[0] = external_pointer; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1217 | inputs_[1] = key; |
| 1218 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1219 | |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1220 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement, |
| 1221 | "load-keyed-specialized-array-element") |
| 1222 | DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1223 | |
| 1224 | LOperand* external_pointer() { return inputs_[0]; } |
| 1225 | LOperand* key() { return inputs_[1]; } |
kmillikin@chromium.org | 83e1682 | 2011-09-13 08:21:47 +0000 | [diff] [blame] | 1226 | ElementsKind elements_kind() const { |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1227 | return hydrogen()->elements_kind(); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1228 | } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1229 | }; |
| 1230 | |
| 1231 | |
| 1232 | class LLoadKeyedGeneric: public LTemplateInstruction<1, 3, 0> { |
| 1233 | public: |
| 1234 | LLoadKeyedGeneric(LOperand* context, LOperand* obj, LOperand* key) { |
| 1235 | inputs_[0] = context; |
| 1236 | inputs_[1] = obj; |
| 1237 | inputs_[2] = key; |
| 1238 | } |
| 1239 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1240 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") |
| 1241 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1242 | LOperand* context() { return inputs_[0]; } |
| 1243 | LOperand* object() { return inputs_[1]; } |
| 1244 | LOperand* key() { return inputs_[2]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1245 | }; |
| 1246 | |
| 1247 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1248 | class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1249 | public: |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1250 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell") |
| 1251 | DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell) |
| 1252 | }; |
| 1253 | |
| 1254 | |
| 1255 | class LLoadGlobalGeneric: public LTemplateInstruction<1, 2, 0> { |
| 1256 | public: |
| 1257 | LLoadGlobalGeneric(LOperand* context, LOperand* global_object) { |
| 1258 | inputs_[0] = context; |
| 1259 | inputs_[1] = global_object; |
| 1260 | } |
| 1261 | |
| 1262 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic") |
| 1263 | DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric) |
| 1264 | |
| 1265 | LOperand* context() { return inputs_[0]; } |
| 1266 | LOperand* global_object() { return inputs_[1]; } |
| 1267 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1268 | bool for_typeof() const { return hydrogen()->for_typeof(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1269 | }; |
| 1270 | |
| 1271 | |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame^] | 1272 | class LStoreGlobalCell: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1273 | public: |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame^] | 1274 | explicit LStoreGlobalCell(LOperand* value) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1275 | inputs_[0] = value; |
| 1276 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1277 | |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 1278 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell") |
| 1279 | DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell) |
danno@chromium.org | e78f9fc | 2011-12-21 08:29:34 +0000 | [diff] [blame^] | 1280 | |
| 1281 | LOperand* value() { return inputs_[0]; } |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 1282 | }; |
| 1283 | |
| 1284 | |
| 1285 | class LStoreGlobalGeneric: public LTemplateInstruction<0, 3, 0> { |
| 1286 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1287 | LStoreGlobalGeneric(LOperand* context, |
| 1288 | LOperand* global_object, |
| 1289 | LOperand* value) { |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 1290 | inputs_[0] = context; |
| 1291 | inputs_[1] = global_object; |
| 1292 | inputs_[2] = value; |
| 1293 | } |
| 1294 | |
| 1295 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic") |
| 1296 | DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric) |
| 1297 | |
| 1298 | LOperand* context() { return InputAt(0); } |
| 1299 | LOperand* global_object() { return InputAt(1); } |
| 1300 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1301 | LOperand* value() { return InputAt(2); } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1302 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1303 | }; |
| 1304 | |
| 1305 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1306 | class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1307 | public: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1308 | explicit LLoadContextSlot(LOperand* context) { |
| 1309 | inputs_[0] = context; |
| 1310 | } |
| 1311 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1312 | DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") |
| 1313 | DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) |
| 1314 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1315 | LOperand* context() { return InputAt(0); } |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1316 | int slot_index() { return hydrogen()->slot_index(); } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1317 | |
| 1318 | virtual void PrintDataTo(StringStream* stream); |
| 1319 | }; |
| 1320 | |
| 1321 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1322 | class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> { |
| 1323 | public: |
| 1324 | LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) { |
| 1325 | inputs_[0] = context; |
| 1326 | inputs_[1] = value; |
| 1327 | temps_[0] = temp; |
| 1328 | } |
| 1329 | |
| 1330 | DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") |
| 1331 | DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) |
| 1332 | |
| 1333 | LOperand* context() { return InputAt(0); } |
| 1334 | LOperand* value() { return InputAt(1); } |
| 1335 | int slot_index() { return hydrogen()->slot_index(); } |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1336 | |
| 1337 | virtual void PrintDataTo(StringStream* stream); |
| 1338 | }; |
| 1339 | |
| 1340 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1341 | class LPushArgument: public LTemplateInstruction<0, 1, 0> { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1342 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1343 | explicit LPushArgument(LOperand* value) { |
| 1344 | inputs_[0] = value; |
| 1345 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1346 | |
| 1347 | DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") |
| 1348 | }; |
| 1349 | |
| 1350 | |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1351 | class LThisFunction: public LTemplateInstruction<1, 0, 0> { |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 1352 | public: |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1353 | DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function") |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 1354 | DECLARE_HYDROGEN_ACCESSOR(ThisFunction) |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1355 | }; |
| 1356 | |
| 1357 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1358 | class LContext: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1359 | public: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1360 | DECLARE_CONCRETE_INSTRUCTION(Context, "context") |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1361 | }; |
| 1362 | |
| 1363 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1364 | class LOuterContext: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1365 | public: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1366 | explicit LOuterContext(LOperand* context) { |
| 1367 | inputs_[0] = context; |
| 1368 | } |
| 1369 | |
| 1370 | DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") |
| 1371 | |
| 1372 | LOperand* context() { return InputAt(0); } |
| 1373 | }; |
| 1374 | |
| 1375 | |
| 1376 | class LGlobalObject: public LTemplateInstruction<1, 1, 0> { |
| 1377 | public: |
| 1378 | explicit LGlobalObject(LOperand* context) { |
| 1379 | inputs_[0] = context; |
| 1380 | } |
| 1381 | |
| 1382 | DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") |
| 1383 | |
| 1384 | LOperand* context() { return InputAt(0); } |
| 1385 | }; |
| 1386 | |
| 1387 | |
| 1388 | class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> { |
| 1389 | public: |
| 1390 | explicit LGlobalReceiver(LOperand* global_object) { |
| 1391 | inputs_[0] = global_object; |
| 1392 | } |
| 1393 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1394 | DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1395 | |
| 1396 | LOperand* global() { return InputAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1397 | }; |
| 1398 | |
| 1399 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1400 | class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1401 | public: |
| 1402 | DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") |
| 1403 | DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) |
| 1404 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1405 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1406 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1407 | Handle<JSFunction> function() { return hydrogen()->function(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1408 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1409 | }; |
| 1410 | |
| 1411 | |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1412 | class LInvokeFunction: public LTemplateInstruction<1, 2, 0> { |
| 1413 | public: |
| 1414 | LInvokeFunction(LOperand* context, LOperand* function) { |
| 1415 | inputs_[0] = context; |
| 1416 | inputs_[1] = function; |
| 1417 | } |
| 1418 | |
| 1419 | DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1420 | DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1421 | |
| 1422 | LOperand* context() { return inputs_[0]; } |
| 1423 | LOperand* function() { return inputs_[1]; } |
| 1424 | |
| 1425 | virtual void PrintDataTo(StringStream* stream); |
| 1426 | |
| 1427 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1428 | }; |
| 1429 | |
| 1430 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1431 | class LCallKeyed: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1432 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1433 | LCallKeyed(LOperand* context, LOperand* key) { |
| 1434 | inputs_[0] = context; |
| 1435 | inputs_[1] = key; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1436 | } |
| 1437 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1438 | DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") |
| 1439 | DECLARE_HYDROGEN_ACCESSOR(CallKeyed) |
| 1440 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1441 | LOperand* context() { return inputs_[0]; } |
| 1442 | LOperand* key() { return inputs_[1]; } |
| 1443 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1444 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1445 | |
| 1446 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1447 | }; |
| 1448 | |
| 1449 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1450 | class LCallNamed: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1451 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1452 | explicit LCallNamed(LOperand* context) { |
| 1453 | inputs_[0] = context; |
| 1454 | } |
| 1455 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1456 | DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") |
| 1457 | DECLARE_HYDROGEN_ACCESSOR(CallNamed) |
| 1458 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1459 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1460 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1461 | LOperand* context() { return inputs_[0]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1462 | Handle<String> name() const { return hydrogen()->name(); } |
| 1463 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1464 | }; |
| 1465 | |
| 1466 | |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1467 | class LCallFunction: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1468 | public: |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1469 | explicit LCallFunction(LOperand* context, LOperand* function) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1470 | inputs_[0] = context; |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1471 | inputs_[1] = function; |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1472 | } |
| 1473 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1474 | DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 1475 | DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| 1476 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1477 | LOperand* context() { return inputs_[0]; } |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1478 | LOperand* function() { return inputs_[1]; } |
| 1479 | int arity() const { return hydrogen()->argument_count() - 1; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1480 | }; |
| 1481 | |
| 1482 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1483 | class LCallGlobal: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1484 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1485 | explicit LCallGlobal(LOperand* context) { |
| 1486 | inputs_[0] = context; |
| 1487 | } |
| 1488 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1489 | DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") |
| 1490 | DECLARE_HYDROGEN_ACCESSOR(CallGlobal) |
| 1491 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1492 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1493 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1494 | LOperand* context() { return inputs_[0]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1495 | Handle<String> name() const {return hydrogen()->name(); } |
| 1496 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1497 | }; |
| 1498 | |
| 1499 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1500 | class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1501 | public: |
| 1502 | DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") |
| 1503 | DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) |
| 1504 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1505 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1506 | |
| 1507 | Handle<JSFunction> target() const { return hydrogen()->target(); } |
| 1508 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1509 | }; |
| 1510 | |
| 1511 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1512 | class LCallNew: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1513 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1514 | LCallNew(LOperand* context, LOperand* constructor) { |
| 1515 | inputs_[0] = context; |
| 1516 | inputs_[1] = constructor; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1517 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1518 | |
| 1519 | DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") |
| 1520 | DECLARE_HYDROGEN_ACCESSOR(CallNew) |
| 1521 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1522 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1523 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1524 | LOperand* context() { return inputs_[0]; } |
| 1525 | LOperand* constructor() { return inputs_[1]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1526 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1527 | }; |
| 1528 | |
| 1529 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1530 | class LCallRuntime: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1531 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1532 | explicit LCallRuntime(LOperand* context) { |
| 1533 | inputs_[0] = context; |
| 1534 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1535 | DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") |
| 1536 | DECLARE_HYDROGEN_ACCESSOR(CallRuntime) |
| 1537 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1538 | LOperand* context() { return inputs_[0]; } |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1539 | const Runtime::Function* function() const { return hydrogen()->function(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1540 | int arity() const { return hydrogen()->argument_count(); } |
| 1541 | }; |
| 1542 | |
| 1543 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1544 | class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1545 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1546 | explicit LInteger32ToDouble(LOperand* value) { |
| 1547 | inputs_[0] = value; |
| 1548 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1549 | |
| 1550 | DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") |
| 1551 | }; |
| 1552 | |
| 1553 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1554 | class LNumberTagI: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1555 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1556 | explicit LNumberTagI(LOperand* value) { |
| 1557 | inputs_[0] = value; |
| 1558 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1559 | |
| 1560 | DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") |
| 1561 | }; |
| 1562 | |
| 1563 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1564 | class LNumberTagD: public LTemplateInstruction<1, 1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1565 | public: |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1566 | LNumberTagD(LOperand* value, LOperand* temp) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1567 | inputs_[0] = value; |
| 1568 | temps_[0] = temp; |
| 1569 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1570 | |
| 1571 | DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1572 | }; |
| 1573 | |
| 1574 | |
| 1575 | // Sometimes truncating conversion from a tagged value to an int32. |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1576 | class LDoubleToI: public LTemplateInstruction<1, 1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1577 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1578 | LDoubleToI(LOperand* value, LOperand* temp) { |
| 1579 | inputs_[0] = value; |
| 1580 | temps_[0] = temp; |
| 1581 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1582 | |
| 1583 | DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") |
ricow@chromium.org | c54d365 | 2011-05-30 09:20:16 +0000 | [diff] [blame] | 1584 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1585 | |
| 1586 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
| 1587 | }; |
| 1588 | |
| 1589 | |
| 1590 | // Truncating conversion from a tagged value to an int32. |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1591 | class LTaggedToI: public LTemplateInstruction<1, 1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1592 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1593 | LTaggedToI(LOperand* value, LOperand* temp) { |
| 1594 | inputs_[0] = value; |
| 1595 | temps_[0] = temp; |
| 1596 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1597 | |
| 1598 | DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") |
ricow@chromium.org | c54d365 | 2011-05-30 09:20:16 +0000 | [diff] [blame] | 1599 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1600 | |
| 1601 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1602 | }; |
| 1603 | |
| 1604 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1605 | class LSmiTag: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1606 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1607 | explicit LSmiTag(LOperand* value) { |
| 1608 | inputs_[0] = value; |
| 1609 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1610 | |
| 1611 | DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") |
| 1612 | }; |
| 1613 | |
| 1614 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1615 | class LNumberUntagD: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1616 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1617 | explicit LNumberUntagD(LOperand* value) { |
| 1618 | inputs_[0] = value; |
| 1619 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1620 | |
| 1621 | DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1622 | DECLARE_HYDROGEN_ACCESSOR(Change); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1623 | }; |
| 1624 | |
| 1625 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1626 | class LSmiUntag: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1627 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1628 | LSmiUntag(LOperand* value, bool needs_check) |
| 1629 | : needs_check_(needs_check) { |
| 1630 | inputs_[0] = value; |
| 1631 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1632 | |
| 1633 | DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") |
| 1634 | |
| 1635 | bool needs_check() const { return needs_check_; } |
| 1636 | |
| 1637 | private: |
| 1638 | bool needs_check_; |
| 1639 | }; |
| 1640 | |
| 1641 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1642 | class LStoreNamedField: public LTemplateInstruction<0, 2, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1643 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1644 | LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1645 | inputs_[0] = obj; |
| 1646 | inputs_[1] = val; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1647 | temps_[0] = temp; |
| 1648 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1649 | |
| 1650 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1651 | DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1652 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1653 | virtual void PrintDataTo(StringStream* stream); |
| 1654 | |
| 1655 | LOperand* object() { return inputs_[0]; } |
| 1656 | LOperand* value() { return inputs_[1]; } |
| 1657 | |
| 1658 | Handle<Object> name() const { return hydrogen()->name(); } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1659 | bool is_in_object() { return hydrogen()->is_in_object(); } |
| 1660 | int offset() { return hydrogen()->offset(); } |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1661 | Handle<Map> transition() const { return hydrogen()->transition(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1662 | }; |
| 1663 | |
| 1664 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1665 | class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1666 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1667 | LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) { |
| 1668 | inputs_[0] = context; |
| 1669 | inputs_[1] = object; |
| 1670 | inputs_[2] = value; |
| 1671 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1672 | |
| 1673 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1674 | DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1675 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1676 | virtual void PrintDataTo(StringStream* stream); |
| 1677 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1678 | LOperand* context() { return inputs_[0]; } |
| 1679 | LOperand* object() { return inputs_[1]; } |
| 1680 | LOperand* value() { return inputs_[2]; } |
| 1681 | Handle<Object> name() const { return hydrogen()->name(); } |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 1682 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1683 | }; |
| 1684 | |
| 1685 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1686 | class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1687 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1688 | LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1689 | inputs_[0] = obj; |
| 1690 | inputs_[1] = key; |
| 1691 | inputs_[2] = val; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1692 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1693 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1694 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, |
| 1695 | "store-keyed-fast-element") |
| 1696 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1697 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1698 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1699 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1700 | LOperand* object() { return inputs_[0]; } |
| 1701 | LOperand* key() { return inputs_[1]; } |
| 1702 | LOperand* value() { return inputs_[2]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1703 | }; |
| 1704 | |
| 1705 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 1706 | class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> { |
| 1707 | public: |
| 1708 | LStoreKeyedFastDoubleElement(LOperand* elements, |
| 1709 | LOperand* key, |
| 1710 | LOperand* val) { |
| 1711 | inputs_[0] = elements; |
| 1712 | inputs_[1] = key; |
| 1713 | inputs_[2] = val; |
| 1714 | } |
| 1715 | |
| 1716 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement, |
| 1717 | "store-keyed-fast-double-element") |
| 1718 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement) |
| 1719 | |
| 1720 | virtual void PrintDataTo(StringStream* stream); |
| 1721 | |
| 1722 | LOperand* elements() { return inputs_[0]; } |
| 1723 | LOperand* key() { return inputs_[1]; } |
| 1724 | LOperand* value() { return inputs_[2]; } |
| 1725 | }; |
| 1726 | |
| 1727 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 1728 | class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1729 | public: |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1730 | LStoreKeyedSpecializedArrayElement(LOperand* external_pointer, |
| 1731 | LOperand* key, |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 1732 | LOperand* val) { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1733 | inputs_[0] = external_pointer; |
| 1734 | inputs_[1] = key; |
| 1735 | inputs_[2] = val; |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1736 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1737 | |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1738 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement, |
| 1739 | "store-keyed-specialized-array-element") |
| 1740 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1741 | |
| 1742 | LOperand* external_pointer() { return inputs_[0]; } |
| 1743 | LOperand* key() { return inputs_[1]; } |
| 1744 | LOperand* value() { return inputs_[2]; } |
kmillikin@chromium.org | 83e1682 | 2011-09-13 08:21:47 +0000 | [diff] [blame] | 1745 | ElementsKind elements_kind() const { |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1746 | return hydrogen()->elements_kind(); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1747 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1748 | }; |
| 1749 | |
| 1750 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1751 | class LStoreKeyedGeneric: public LTemplateInstruction<0, 4, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1752 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1753 | LStoreKeyedGeneric(LOperand* context, |
| 1754 | LOperand* object, |
| 1755 | LOperand* key, |
| 1756 | LOperand* value) { |
| 1757 | inputs_[0] = context; |
| 1758 | inputs_[1] = object; |
| 1759 | inputs_[2] = key; |
| 1760 | inputs_[3] = value; |
| 1761 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1762 | |
| 1763 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 1764 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1765 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1766 | virtual void PrintDataTo(StringStream* stream); |
| 1767 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1768 | LOperand* context() { return inputs_[0]; } |
| 1769 | LOperand* object() { return inputs_[1]; } |
| 1770 | LOperand* key() { return inputs_[2]; } |
| 1771 | LOperand* value() { return inputs_[3]; } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1772 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1773 | }; |
| 1774 | |
| 1775 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 1776 | class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> { |
| 1777 | public: |
| 1778 | LTransitionElementsKind(LOperand* object, |
| 1779 | LOperand* new_map_temp, |
| 1780 | LOperand* temp_reg) { |
| 1781 | inputs_[0] = object; |
| 1782 | temps_[0] = new_map_temp; |
| 1783 | temps_[1] = temp_reg; |
| 1784 | } |
| 1785 | |
| 1786 | DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, |
| 1787 | "transition-elements-kind") |
| 1788 | DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) |
| 1789 | |
| 1790 | virtual void PrintDataTo(StringStream* stream); |
| 1791 | |
| 1792 | LOperand* object() { return inputs_[0]; } |
| 1793 | LOperand* new_map_reg() { return temps_[0]; } |
| 1794 | LOperand* temp_reg() { return temps_[1]; } |
| 1795 | Handle<Map> original_map() { return hydrogen()->original_map(); } |
| 1796 | Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } |
| 1797 | }; |
| 1798 | |
| 1799 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1800 | class LStringAdd: public LTemplateInstruction<1, 3, 0> { |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1801 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1802 | LStringAdd(LOperand* context, LOperand* left, LOperand* right) { |
| 1803 | inputs_[0] = context; |
| 1804 | inputs_[1] = left; |
| 1805 | inputs_[2] = right; |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1806 | } |
| 1807 | |
| 1808 | DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add") |
| 1809 | DECLARE_HYDROGEN_ACCESSOR(StringAdd) |
| 1810 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1811 | LOperand* context() { return inputs_[0]; } |
| 1812 | LOperand* left() { return inputs_[1]; } |
| 1813 | LOperand* right() { return inputs_[2]; } |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1814 | }; |
| 1815 | |
| 1816 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1817 | class LStringCharCodeAt: public LTemplateInstruction<1, 3, 0> { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1818 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1819 | LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) { |
| 1820 | inputs_[0] = context; |
| 1821 | inputs_[1] = string; |
| 1822 | inputs_[2] = index; |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1823 | } |
| 1824 | |
| 1825 | DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at") |
| 1826 | DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt) |
| 1827 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1828 | LOperand* context() { return inputs_[0]; } |
| 1829 | LOperand* string() { return inputs_[1]; } |
| 1830 | LOperand* index() { return inputs_[2]; } |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1831 | }; |
| 1832 | |
| 1833 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1834 | class LStringCharFromCode: public LTemplateInstruction<1, 2, 0> { |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 1835 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1836 | LStringCharFromCode(LOperand* context, LOperand* char_code) { |
| 1837 | inputs_[0] = context; |
| 1838 | inputs_[1] = char_code; |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 1839 | } |
| 1840 | |
| 1841 | DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") |
| 1842 | DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) |
| 1843 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1844 | LOperand* context() { return inputs_[0]; } |
| 1845 | LOperand* char_code() { return inputs_[1]; } |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 1846 | }; |
| 1847 | |
| 1848 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1849 | class LStringLength: public LTemplateInstruction<1, 1, 0> { |
| 1850 | public: |
| 1851 | explicit LStringLength(LOperand* string) { |
| 1852 | inputs_[0] = string; |
| 1853 | } |
| 1854 | |
| 1855 | DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length") |
| 1856 | DECLARE_HYDROGEN_ACCESSOR(StringLength) |
| 1857 | |
| 1858 | LOperand* string() { return inputs_[0]; } |
| 1859 | }; |
| 1860 | |
| 1861 | |
| 1862 | class LCheckFunction: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1863 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1864 | explicit LCheckFunction(LOperand* value) { |
| 1865 | inputs_[0] = value; |
| 1866 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1867 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 1868 | LOperand* value() { return inputs_[0]; } |
| 1869 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1870 | DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") |
| 1871 | DECLARE_HYDROGEN_ACCESSOR(CheckFunction) |
| 1872 | }; |
| 1873 | |
| 1874 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1875 | class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1876 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1877 | LCheckInstanceType(LOperand* value, LOperand* temp) { |
| 1878 | inputs_[0] = value; |
| 1879 | temps_[0] = temp; |
| 1880 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1881 | |
| 1882 | DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") |
| 1883 | DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1884 | }; |
| 1885 | |
| 1886 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1887 | class LCheckMap: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1888 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1889 | explicit LCheckMap(LOperand* value) { |
| 1890 | inputs_[0] = value; |
| 1891 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1892 | |
| 1893 | DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map") |
| 1894 | DECLARE_HYDROGEN_ACCESSOR(CheckMap) |
| 1895 | }; |
| 1896 | |
| 1897 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1898 | class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1899 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1900 | explicit LCheckPrototypeMaps(LOperand* temp) { |
| 1901 | temps_[0] = temp; |
| 1902 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1903 | |
| 1904 | DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 1905 | DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) |
| 1906 | |
| 1907 | Handle<JSObject> prototype() const { return hydrogen()->prototype(); } |
| 1908 | Handle<JSObject> holder() const { return hydrogen()->holder(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1909 | }; |
| 1910 | |
| 1911 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1912 | class LCheckSmi: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1913 | public: |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 1914 | explicit LCheckSmi(LOperand* value) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1915 | inputs_[0] = value; |
| 1916 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1917 | |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 1918 | DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi") |
| 1919 | }; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1920 | |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 1921 | |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 1922 | class LClampDToUint8: public LTemplateInstruction<1, 1, 0> { |
| 1923 | public: |
| 1924 | explicit LClampDToUint8(LOperand* value) { |
| 1925 | inputs_[0] = value; |
| 1926 | } |
| 1927 | |
| 1928 | LOperand* unclamped() { return inputs_[0]; } |
| 1929 | |
| 1930 | DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8") |
| 1931 | }; |
| 1932 | |
| 1933 | |
| 1934 | class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { |
| 1935 | public: |
| 1936 | explicit LClampIToUint8(LOperand* value) { |
| 1937 | inputs_[0] = value; |
| 1938 | } |
| 1939 | |
| 1940 | LOperand* unclamped() { return inputs_[0]; } |
| 1941 | |
| 1942 | DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8") |
| 1943 | }; |
| 1944 | |
| 1945 | |
| 1946 | class LClampTToUint8: public LTemplateInstruction<1, 1, 1> { |
| 1947 | public: |
| 1948 | LClampTToUint8(LOperand* value, LOperand* temp) { |
| 1949 | inputs_[0] = value; |
| 1950 | temps_[0] = temp; |
| 1951 | } |
| 1952 | |
| 1953 | LOperand* unclamped() { return inputs_[0]; } |
| 1954 | |
| 1955 | DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") |
| 1956 | }; |
| 1957 | |
| 1958 | |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 1959 | class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { |
| 1960 | public: |
| 1961 | explicit LCheckNonSmi(LOperand* value) { |
| 1962 | inputs_[0] = value; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1963 | } |
| 1964 | |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 1965 | DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1966 | }; |
| 1967 | |
| 1968 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1969 | class LArrayLiteral: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1970 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1971 | explicit LArrayLiteral(LOperand* context) { |
| 1972 | inputs_[0] = context; |
| 1973 | } |
| 1974 | |
| 1975 | LOperand* context() { return inputs_[0]; } |
| 1976 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1977 | DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal") |
| 1978 | DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral) |
| 1979 | }; |
| 1980 | |
| 1981 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1982 | class LObjectLiteralFast: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1983 | public: |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1984 | explicit LObjectLiteralFast(LOperand* context) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1985 | inputs_[0] = context; |
| 1986 | } |
| 1987 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1988 | LOperand* context() { return inputs_[0]; } |
| 1989 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1990 | DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralFast, "object-literal-fast") |
| 1991 | DECLARE_HYDROGEN_ACCESSOR(ObjectLiteralFast) |
| 1992 | }; |
| 1993 | |
| 1994 | |
| 1995 | class LObjectLiteralGeneric: public LTemplateInstruction<1, 1, 0> { |
| 1996 | public: |
| 1997 | explicit LObjectLiteralGeneric(LOperand* context) { |
| 1998 | inputs_[0] = context; |
| 1999 | } |
| 2000 | |
| 2001 | LOperand* context() { return inputs_[0]; } |
| 2002 | |
| 2003 | DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralGeneric, "object-literal-generic") |
| 2004 | DECLARE_HYDROGEN_ACCESSOR(ObjectLiteralGeneric) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2005 | }; |
| 2006 | |
| 2007 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2008 | class LRegExpLiteral: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2009 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2010 | explicit LRegExpLiteral(LOperand* context) { |
| 2011 | inputs_[0] = context; |
| 2012 | } |
| 2013 | |
| 2014 | LOperand* context() { return inputs_[0]; } |
| 2015 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2016 | DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") |
| 2017 | DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) |
| 2018 | }; |
| 2019 | |
| 2020 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2021 | class LFunctionLiteral: public LTemplateInstruction<1, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2022 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2023 | explicit LFunctionLiteral(LOperand* context) { |
| 2024 | inputs_[0] = context; |
| 2025 | } |
| 2026 | |
| 2027 | LOperand* context() { return inputs_[0]; } |
| 2028 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2029 | DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") |
| 2030 | DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) |
| 2031 | |
| 2032 | Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); } |
| 2033 | }; |
| 2034 | |
| 2035 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 2036 | class LToFastProperties: public LTemplateInstruction<1, 1, 0> { |
| 2037 | public: |
| 2038 | explicit LToFastProperties(LOperand* value) { |
| 2039 | inputs_[0] = value; |
| 2040 | } |
| 2041 | |
| 2042 | DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties") |
| 2043 | DECLARE_HYDROGEN_ACCESSOR(ToFastProperties) |
| 2044 | }; |
| 2045 | |
| 2046 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2047 | class LTypeof: public LTemplateInstruction<1, 2, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2048 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2049 | LTypeof(LOperand* context, LOperand* value) { |
| 2050 | inputs_[0] = context; |
| 2051 | inputs_[1] = value; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2052 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2053 | |
| 2054 | DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") |
| 2055 | }; |
| 2056 | |
| 2057 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 2058 | class LTypeofIsAndBranch: public LControlInstruction<1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2059 | public: |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2060 | explicit LTypeofIsAndBranch(LOperand* value) { |
| 2061 | inputs_[0] = value; |
| 2062 | } |
| 2063 | |
| 2064 | DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2065 | DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch) |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2066 | |
| 2067 | Handle<String> type_literal() { return hydrogen()->type_literal(); } |
| 2068 | |
| 2069 | virtual void PrintDataTo(StringStream* stream); |
| 2070 | }; |
| 2071 | |
| 2072 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2073 | class LDeleteProperty: public LTemplateInstruction<1, 3, 0> { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2074 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2075 | LDeleteProperty(LOperand* context, LOperand* obj, LOperand* key) { |
| 2076 | inputs_[0] = context; |
| 2077 | inputs_[1] = obj; |
| 2078 | inputs_[2] = key; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2079 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2080 | |
| 2081 | DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
| 2082 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2083 | LOperand* context() { return inputs_[0]; } |
| 2084 | LOperand* object() { return inputs_[1]; } |
| 2085 | LOperand* key() { return inputs_[2]; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2086 | }; |
| 2087 | |
| 2088 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2089 | class LOsrEntry: public LTemplateInstruction<0, 0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2090 | public: |
| 2091 | LOsrEntry(); |
| 2092 | |
| 2093 | DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") |
| 2094 | |
| 2095 | LOperand** SpilledRegisterArray() { return register_spills_; } |
| 2096 | LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } |
| 2097 | |
| 2098 | void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); |
| 2099 | void MarkSpilledDoubleRegister(int allocation_index, |
| 2100 | LOperand* spill_operand); |
| 2101 | |
| 2102 | private: |
| 2103 | // Arrays of spill slot operands for registers with an assigned spill |
| 2104 | // slot, i.e., that must also be restored to the spill slot on OSR entry. |
| 2105 | // NULL if the register has no assigned spill slot. Indexed by allocation |
| 2106 | // index. |
| 2107 | LOperand* register_spills_[Register::kNumAllocatableRegisters]; |
| 2108 | LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters]; |
| 2109 | }; |
| 2110 | |
| 2111 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2112 | class LStackCheck: public LTemplateInstruction<0, 1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2113 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2114 | explicit LStackCheck(LOperand* context) { |
| 2115 | inputs_[0] = context; |
| 2116 | } |
| 2117 | |
| 2118 | LOperand* context() { return inputs_[0]; } |
| 2119 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2120 | DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 2121 | DECLARE_HYDROGEN_ACCESSOR(StackCheck) |
| 2122 | |
| 2123 | Label* done_label() { return &done_label_; } |
| 2124 | |
| 2125 | private: |
| 2126 | Label done_label_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2127 | }; |
| 2128 | |
| 2129 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2130 | class LIn: public LTemplateInstruction<1, 3, 0> { |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 2131 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2132 | LIn(LOperand* context, LOperand* key, LOperand* object) { |
| 2133 | inputs_[0] = context; |
| 2134 | inputs_[1] = key; |
| 2135 | inputs_[2] = object; |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 2136 | } |
| 2137 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2138 | LOperand* context() { return inputs_[0]; } |
| 2139 | LOperand* key() { return inputs_[1]; } |
| 2140 | LOperand* object() { return inputs_[2]; } |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 2141 | |
| 2142 | DECLARE_CONCRETE_INSTRUCTION(In, "in") |
| 2143 | }; |
| 2144 | |
| 2145 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2146 | class LChunkBuilder; |
| 2147 | class LChunk: public ZoneObject { |
| 2148 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2149 | LChunk(CompilationInfo* info, HGraph* graph) |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2150 | : spill_slot_count_(0), |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2151 | info_(info), |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2152 | graph_(graph), |
| 2153 | instructions_(32), |
| 2154 | pointer_maps_(8), |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 2155 | num_double_slots_(0), |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2156 | inlined_closures_(1) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2157 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 2158 | void AddInstruction(LInstruction* instruction, HBasicBlock* block); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2159 | LConstantOperand* DefineConstantOperand(HConstant* constant); |
| 2160 | Handle<Object> LookupLiteral(LConstantOperand* operand) const; |
| 2161 | Representation LookupLiteralRepresentation(LConstantOperand* operand) const; |
| 2162 | |
| 2163 | int GetNextSpillIndex(bool is_double); |
| 2164 | LOperand* GetNextSpillSlot(bool is_double); |
| 2165 | |
| 2166 | int ParameterAt(int index); |
| 2167 | int GetParameterStackSlot(int index) const; |
| 2168 | int spill_slot_count() const { return spill_slot_count_; } |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 2169 | int num_double_slots() const { return num_double_slots_; } |
| 2170 | |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2171 | CompilationInfo* info() const { return info_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2172 | HGraph* graph() const { return graph_; } |
| 2173 | const ZoneList<LInstruction*>* instructions() const { return &instructions_; } |
| 2174 | void AddGapMove(int index, LOperand* from, LOperand* to); |
| 2175 | LGap* GetGapAt(int index) const; |
| 2176 | bool IsGapAt(int index) const; |
| 2177 | int NearestGapPos(int index) const; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2178 | void MarkEmptyBlocks(); |
| 2179 | const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } |
| 2180 | LLabel* GetLabel(int block_id) const { |
| 2181 | HBasicBlock* block = graph_->blocks()->at(block_id); |
| 2182 | int first_instruction = block->first_instruction_index(); |
| 2183 | return LLabel::cast(instructions_[first_instruction]); |
| 2184 | } |
| 2185 | int LookupDestination(int block_id) const { |
| 2186 | LLabel* cur = GetLabel(block_id); |
| 2187 | while (cur->replacement() != NULL) { |
| 2188 | cur = cur->replacement(); |
| 2189 | } |
| 2190 | return cur->block_id(); |
| 2191 | } |
| 2192 | Label* GetAssemblyLabel(int block_id) const { |
| 2193 | LLabel* label = GetLabel(block_id); |
| 2194 | ASSERT(!label->HasReplacement()); |
| 2195 | return label->label(); |
| 2196 | } |
| 2197 | |
| 2198 | const ZoneList<Handle<JSFunction> >* inlined_closures() const { |
| 2199 | return &inlined_closures_; |
| 2200 | } |
| 2201 | |
| 2202 | void AddInlinedClosure(Handle<JSFunction> closure) { |
| 2203 | inlined_closures_.Add(closure); |
| 2204 | } |
| 2205 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2206 | private: |
| 2207 | int spill_slot_count_; |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2208 | CompilationInfo* info_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2209 | HGraph* const graph_; |
| 2210 | ZoneList<LInstruction*> instructions_; |
| 2211 | ZoneList<LPointerMap*> pointer_maps_; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 2212 | int num_double_slots_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2213 | ZoneList<Handle<JSFunction> > inlined_closures_; |
| 2214 | }; |
| 2215 | |
| 2216 | |
| 2217 | class LChunkBuilder BASE_EMBEDDED { |
| 2218 | public: |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2219 | LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2220 | : chunk_(NULL), |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2221 | info_(info), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2222 | graph_(graph), |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2223 | isolate_(graph->isolate()), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2224 | status_(UNUSED), |
| 2225 | current_instruction_(NULL), |
| 2226 | current_block_(NULL), |
| 2227 | next_block_(NULL), |
| 2228 | argument_count_(0), |
| 2229 | allocator_(allocator), |
| 2230 | position_(RelocInfo::kNoPosition), |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 2231 | instruction_pending_deoptimization_environment_(NULL), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2232 | pending_deoptimization_ast_id_(AstNode::kNoNumber) { } |
| 2233 | |
| 2234 | // Build the sequence for the graph. |
| 2235 | LChunk* Build(); |
| 2236 | |
| 2237 | // Declare methods that deal with the individual node types. |
| 2238 | #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
| 2239 | HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 2240 | #undef DECLARE_DO |
| 2241 | |
| 2242 | private: |
| 2243 | enum Status { |
| 2244 | UNUSED, |
| 2245 | BUILDING, |
| 2246 | DONE, |
| 2247 | ABORTED |
| 2248 | }; |
| 2249 | |
| 2250 | LChunk* chunk() const { return chunk_; } |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2251 | CompilationInfo* info() const { return info_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2252 | HGraph* graph() const { return graph_; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2253 | Zone* zone() { return isolate_->zone(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2254 | |
| 2255 | bool is_unused() const { return status_ == UNUSED; } |
| 2256 | bool is_building() const { return status_ == BUILDING; } |
| 2257 | bool is_done() const { return status_ == DONE; } |
| 2258 | bool is_aborted() const { return status_ == ABORTED; } |
| 2259 | |
| 2260 | void Abort(const char* format, ...); |
| 2261 | |
| 2262 | // Methods for getting operands for Use / Define / Temp. |
| 2263 | LRegister* ToOperand(Register reg); |
| 2264 | LUnallocated* ToUnallocated(Register reg); |
| 2265 | LUnallocated* ToUnallocated(XMMRegister reg); |
| 2266 | |
| 2267 | // Methods for setting up define-use relationships. |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2268 | MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
| 2269 | MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
| 2270 | MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
| 2271 | XMMRegister fixed_register); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2272 | |
| 2273 | // A value that is guaranteed to be allocated to a register. |
| 2274 | // Operand created by UseRegister is guaranteed to be live until the end of |
| 2275 | // instruction. This means that register allocator will not reuse it's |
| 2276 | // register for any other operand inside instruction. |
| 2277 | // Operand created by UseRegisterAtStart is guaranteed to be live only at |
| 2278 | // instruction start. Register allocator is free to assign the same register |
| 2279 | // to some other operand used inside instruction (i.e. temporary or |
| 2280 | // output). |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2281 | MUST_USE_RESULT LOperand* UseRegister(HValue* value); |
| 2282 | MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2283 | |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 2284 | // An input operand in a register that may be trashed. |
| 2285 | MUST_USE_RESULT LOperand* UseTempRegister(HValue* value); |
| 2286 | |
| 2287 | // An input operand in a register or stack slot. |
| 2288 | MUST_USE_RESULT LOperand* Use(HValue* value); |
| 2289 | MUST_USE_RESULT LOperand* UseAtStart(HValue* value); |
| 2290 | |
| 2291 | // An input operand in a register, stack slot or a constant operand. |
| 2292 | MUST_USE_RESULT LOperand* UseOrConstant(HValue* value); |
| 2293 | MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value); |
| 2294 | |
| 2295 | // An input operand in a register or a constant operand. |
| 2296 | MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value); |
| 2297 | MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value); |
| 2298 | |
| 2299 | // An input operand in register, stack slot or a constant operand. |
| 2300 | // Will not be moved to a register even if one is freely available. |
| 2301 | MUST_USE_RESULT LOperand* UseAny(HValue* value); |
| 2302 | |
| 2303 | // Temporary operand that must be in a register. |
| 2304 | MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2305 | MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2306 | MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2307 | |
| 2308 | // Methods for setting up define-use relationships. |
| 2309 | // Return the same instruction that they are passed. |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2310 | template<int I, int T> |
| 2311 | LInstruction* Define(LTemplateInstruction<1, I, T>* instr, |
| 2312 | LUnallocated* result); |
| 2313 | template<int I, int T> |
| 2314 | LInstruction* Define(LTemplateInstruction<1, I, T>* instr); |
| 2315 | template<int I, int T> |
| 2316 | LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); |
| 2317 | template<int I, int T> |
| 2318 | LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, |
| 2319 | int index); |
| 2320 | template<int I, int T> |
| 2321 | LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); |
| 2322 | template<int I, int T> |
| 2323 | LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, |
| 2324 | Register reg); |
| 2325 | template<int I, int T> |
| 2326 | LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, |
| 2327 | XMMRegister reg); |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 2328 | // Assigns an environment to an instruction. An instruction which can |
| 2329 | // deoptimize must have an environment. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2330 | LInstruction* AssignEnvironment(LInstruction* instr); |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 2331 | // Assigns a pointer map to an instruction. An instruction which can |
| 2332 | // trigger a GC or a lazy deoptimization must have a pointer map. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2333 | LInstruction* AssignPointerMap(LInstruction* instr); |
| 2334 | |
| 2335 | enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2336 | |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 2337 | // Marks a call for the register allocator. Assigns a pointer map to |
| 2338 | // support GC and lazy deoptimization. Assigns an environment to support |
| 2339 | // eager deoptimization if CAN_DEOPTIMIZE_EAGERLY. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2340 | LInstruction* MarkAsCall( |
| 2341 | LInstruction* instr, |
| 2342 | HInstruction* hinstr, |
| 2343 | CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2344 | LInstruction* MarkAsSaveDoubles(LInstruction* instr); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2345 | |
fschneider@chromium.org | 1df6b47 | 2011-01-26 08:23:03 +0000 | [diff] [blame] | 2346 | LInstruction* SetInstructionPendingDeoptimizationEnvironment( |
| 2347 | LInstruction* instr, int ast_id); |
| 2348 | void ClearInstructionPendingDeoptimizationEnvironment(); |
| 2349 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 2350 | LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, |
| 2351 | int* argument_index_accumulator); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2352 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2353 | void VisitInstruction(HInstruction* current); |
| 2354 | |
| 2355 | void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2356 | LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2357 | LInstruction* DoArithmeticD(Token::Value op, |
| 2358 | HArithmeticBinaryOperation* instr); |
| 2359 | LInstruction* DoArithmeticT(Token::Value op, |
| 2360 | HArithmeticBinaryOperation* instr); |
| 2361 | |
| 2362 | LChunk* chunk_; |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 2363 | CompilationInfo* info_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2364 | HGraph* const graph_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2365 | Isolate* isolate_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2366 | Status status_; |
| 2367 | HInstruction* current_instruction_; |
| 2368 | HBasicBlock* current_block_; |
| 2369 | HBasicBlock* next_block_; |
| 2370 | int argument_count_; |
| 2371 | LAllocator* allocator_; |
| 2372 | int position_; |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 2373 | LInstruction* instruction_pending_deoptimization_environment_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2374 | int pending_deoptimization_ast_id_; |
| 2375 | |
| 2376 | DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2377 | }; |
| 2378 | |
| 2379 | #undef DECLARE_HYDROGEN_ACCESSOR |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2380 | #undef DECLARE_CONCRETE_INSTRUCTION |
| 2381 | |
| 2382 | } } // namespace v8::internal |
| 2383 | |
| 2384 | #endif // V8_IA32_LITHIUM_IA32_H_ |