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