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