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