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