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