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