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