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