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