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