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