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