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