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