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