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