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