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