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