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