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