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