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