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