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