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