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