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