| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 // Forward declarations. | 40 // Forward declarations. |
| 41 class LCodeGen; | 41 class LCodeGen; |
| 42 | 42 |
| 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 44 V(AccessArgumentsAt) \ | 44 V(AccessArgumentsAt) \ |
| 45 V(AddI) \ | 45 V(AddI) \ |
| 46 V(Allocate) \ | 46 V(Allocate) \ |
| 47 V(AllocateObject) \ |
| 47 V(ApplyArguments) \ | 48 V(ApplyArguments) \ |
| 48 V(ArgumentsElements) \ | 49 V(ArgumentsElements) \ |
| 49 V(ArgumentsLength) \ | 50 V(ArgumentsLength) \ |
| 50 V(ArithmeticD) \ | 51 V(ArithmeticD) \ |
| 51 V(ArithmeticT) \ | 52 V(ArithmeticT) \ |
| 52 V(BitI) \ | 53 V(BitI) \ |
| 53 V(BitNotI) \ | 54 V(BitNotI) \ |
| 54 V(BoundsCheck) \ | 55 V(BoundsCheck) \ |
| 55 V(Branch) \ | 56 V(Branch) \ |
| 56 V(CallConstantFunction) \ | 57 V(CallConstantFunction) \ |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { | 476 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
| 476 public: | 477 public: |
| 477 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 478 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 478 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") | 479 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
| 479 }; | 480 }; |
| 480 | 481 |
| 481 | 482 |
| 482 template<int I, int T> | 483 template<int I, int T> |
| 483 class LControlInstruction: public LTemplateInstruction<0, I, T> { | 484 class LControlInstruction: public LTemplateInstruction<0, I, T> { |
| 484 public: | 485 public: |
| 486 LControlInstruction() : false_label_(NULL), true_label_(NULL) { } |
| 487 |
| 485 virtual bool IsControl() const { return true; } | 488 virtual bool IsControl() const { return true; } |
| 486 | 489 |
| 487 int SuccessorCount() { return hydrogen()->SuccessorCount(); } | 490 int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
| 488 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } | 491 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
| 489 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } | 492 |
| 490 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } | 493 int TrueDestination(LChunk* chunk) { |
| 494 return chunk->LookupDestination(true_block_id()); |
| 495 } |
| 496 int FalseDestination(LChunk* chunk) { |
| 497 return chunk->LookupDestination(false_block_id()); |
| 498 } |
| 499 |
| 500 Label* TrueLabel(LChunk* chunk) { |
| 501 if (true_label_ == NULL) { |
| 502 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk)); |
| 503 } |
| 504 return true_label_; |
| 505 } |
| 506 Label* FalseLabel(LChunk* chunk) { |
| 507 if (false_label_ == NULL) { |
| 508 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk)); |
| 509 } |
| 510 return false_label_; |
| 511 } |
| 512 |
| 513 protected: |
| 514 int true_block_id() { return SuccessorAt(0)->block_id(); } |
| 515 int false_block_id() { return SuccessorAt(1)->block_id(); } |
| 491 | 516 |
| 492 private: | 517 private: |
| 493 HControlInstruction* hydrogen() { | 518 HControlInstruction* hydrogen() { |
| 494 return HControlInstruction::cast(this->hydrogen_value()); | 519 return HControlInstruction::cast(this->hydrogen_value()); |
| 495 } | 520 } |
| 521 |
| 522 Label* false_label_; |
| 523 Label* true_label_; |
| 496 }; | 524 }; |
| 497 | 525 |
| 498 | 526 |
| 499 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> { | 527 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> { |
| 500 public: | 528 public: |
| 501 LWrapReceiver(LOperand* receiver, | 529 LWrapReceiver(LOperand* receiver, |
| 502 LOperand* function, | 530 LOperand* function, |
| 503 LOperand* temp) { | 531 LOperand* temp) { |
| 504 inputs_[0] = receiver; | 532 inputs_[0] = receiver; |
| 505 inputs_[1] = function; | 533 inputs_[1] = function; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 public: | 888 public: |
| 861 LIsStringAndBranch(LOperand* value, LOperand* temp) { | 889 LIsStringAndBranch(LOperand* value, LOperand* temp) { |
| 862 inputs_[0] = value; | 890 inputs_[0] = value; |
| 863 temps_[0] = temp; | 891 temps_[0] = temp; |
| 864 } | 892 } |
| 865 | 893 |
| 866 LOperand* value() { return inputs_[0]; } | 894 LOperand* value() { return inputs_[0]; } |
| 867 LOperand* temp() { return temps_[0]; } | 895 LOperand* temp() { return temps_[0]; } |
| 868 | 896 |
| 869 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch") | 897 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch") |
| 898 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch) |
| 870 | 899 |
| 871 virtual void PrintDataTo(StringStream* stream); | 900 virtual void PrintDataTo(StringStream* stream); |
| 872 }; | 901 }; |
| 873 | 902 |
| 874 | 903 |
| 875 class LIsSmiAndBranch: public LControlInstruction<1, 0> { | 904 class LIsSmiAndBranch: public LControlInstruction<1, 0> { |
| 876 public: | 905 public: |
| 877 explicit LIsSmiAndBranch(LOperand* value) { | 906 explicit LIsSmiAndBranch(LOperand* value) { |
| 878 inputs_[0] = value; | 907 inputs_[0] = value; |
| 879 } | 908 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 892 LIsUndetectableAndBranch(LOperand* value, LOperand* temp) { | 921 LIsUndetectableAndBranch(LOperand* value, LOperand* temp) { |
| 893 inputs_[0] = value; | 922 inputs_[0] = value; |
| 894 temps_[0] = temp; | 923 temps_[0] = temp; |
| 895 } | 924 } |
| 896 | 925 |
| 897 LOperand* value() { return inputs_[0]; } | 926 LOperand* value() { return inputs_[0]; } |
| 898 LOperand* temp() { return temps_[0]; } | 927 LOperand* temp() { return temps_[0]; } |
| 899 | 928 |
| 900 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch, | 929 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch, |
| 901 "is-undetectable-and-branch") | 930 "is-undetectable-and-branch") |
| 931 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch) |
| 902 | 932 |
| 903 virtual void PrintDataTo(StringStream* stream); | 933 virtual void PrintDataTo(StringStream* stream); |
| 904 }; | 934 }; |
| 905 | 935 |
| 906 | 936 |
| 907 class LStringCompareAndBranch: public LControlInstruction<3, 0> { | 937 class LStringCompareAndBranch: public LControlInstruction<3, 0> { |
| 908 public: | 938 public: |
| 909 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) { | 939 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) { |
| 910 inputs_[0] = context; | 940 inputs_[0] = context; |
| 911 inputs_[1] = left; | 941 inputs_[1] = left; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 LOperand* value() { return inputs_[0]; } | 1229 LOperand* value() { return inputs_[0]; } |
| 1200 LOperand* temp() { return temps_[0]; } | 1230 LOperand* temp() { return temps_[0]; } |
| 1201 | 1231 |
| 1202 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 1232 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
| 1203 DECLARE_HYDROGEN_ACCESSOR(Branch) | 1233 DECLARE_HYDROGEN_ACCESSOR(Branch) |
| 1204 | 1234 |
| 1205 virtual void PrintDataTo(StringStream* stream); | 1235 virtual void PrintDataTo(StringStream* stream); |
| 1206 }; | 1236 }; |
| 1207 | 1237 |
| 1208 | 1238 |
| 1209 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { | 1239 class LCmpMapAndBranch: public LControlInstruction<1, 0> { |
| 1210 public: | 1240 public: |
| 1211 explicit LCmpMapAndBranch(LOperand* value) { | 1241 explicit LCmpMapAndBranch(LOperand* value) { |
| 1212 inputs_[0] = value; | 1242 inputs_[0] = value; |
| 1213 } | 1243 } |
| 1214 | 1244 |
| 1215 LOperand* value() { return inputs_[0]; } | 1245 LOperand* value() { return inputs_[0]; } |
| 1216 | 1246 |
| 1217 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1247 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
| 1218 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | 1248 DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
| 1219 | 1249 |
| 1220 virtual bool IsControl() const { return true; } | |
| 1221 | |
| 1222 Handle<Map> map() const { return hydrogen()->map(); } | 1250 Handle<Map> map() const { return hydrogen()->map(); } |
| 1223 int true_block_id() const { | |
| 1224 return hydrogen()->FirstSuccessor()->block_id(); | |
| 1225 } | |
| 1226 int false_block_id() const { | |
| 1227 return hydrogen()->SecondSuccessor()->block_id(); | |
| 1228 } | |
| 1229 }; | 1251 }; |
| 1230 | 1252 |
| 1231 | 1253 |
| 1232 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { | 1254 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
| 1233 public: | 1255 public: |
| 1234 explicit LFixedArrayBaseLength(LOperand* value) { | 1256 explicit LFixedArrayBaseLength(LOperand* value) { |
| 1235 inputs_[0] = value; | 1257 inputs_[0] = value; |
| 1236 } | 1258 } |
| 1237 | 1259 |
| 1238 LOperand* value() { return inputs_[0]; } | 1260 LOperand* value() { return inputs_[0]; } |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 explicit LNumberTagI(LOperand* value) { | 2063 explicit LNumberTagI(LOperand* value) { |
| 2042 inputs_[0] = value; | 2064 inputs_[0] = value; |
| 2043 } | 2065 } |
| 2044 | 2066 |
| 2045 LOperand* value() { return inputs_[0]; } | 2067 LOperand* value() { return inputs_[0]; } |
| 2046 | 2068 |
| 2047 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") | 2069 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") |
| 2048 }; | 2070 }; |
| 2049 | 2071 |
| 2050 | 2072 |
| 2051 class LNumberTagU: public LTemplateInstruction<1, 1, 0> { | 2073 class LNumberTagU: public LTemplateInstruction<1, 1, 1> { |
| 2052 public: | 2074 public: |
| 2053 explicit LNumberTagU(LOperand* value) { | 2075 LNumberTagU(LOperand* value, LOperand* temp) { |
| 2054 inputs_[0] = value; | 2076 inputs_[0] = value; |
| 2077 temps_[0] = temp; |
| 2055 } | 2078 } |
| 2056 | 2079 |
| 2057 LOperand* value() { return inputs_[0]; } | 2080 LOperand* value() { return inputs_[0]; } |
| 2081 LOperand* temp() { return temps_[0]; } |
| 2058 | 2082 |
| 2059 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") | 2083 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") |
| 2060 }; | 2084 }; |
| 2061 | 2085 |
| 2062 | 2086 |
| 2063 class LNumberTagD: public LTemplateInstruction<1, 1, 1> { | 2087 class LNumberTagD: public LTemplateInstruction<1, 1, 1> { |
| 2064 public: | 2088 public: |
| 2065 LNumberTagD(LOperand* value, LOperand* temp) { | 2089 LNumberTagD(LOperand* value, LOperand* temp) { |
| 2066 inputs_[0] = value; | 2090 inputs_[0] = value; |
| 2067 temps_[0] = temp; | 2091 temps_[0] = temp; |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 | 2565 |
| 2542 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { | 2566 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { |
| 2543 public: | 2567 public: |
| 2544 explicit LCheckNonSmi(LOperand* value) { | 2568 explicit LCheckNonSmi(LOperand* value) { |
| 2545 inputs_[0] = value; | 2569 inputs_[0] = value; |
| 2546 } | 2570 } |
| 2547 | 2571 |
| 2548 LOperand* value() { return inputs_[0]; } | 2572 LOperand* value() { return inputs_[0]; } |
| 2549 | 2573 |
| 2550 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | 2574 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
| 2575 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) |
| 2551 }; | 2576 }; |
| 2552 | 2577 |
| 2553 | 2578 |
| 2579 class LAllocateObject: public LTemplateInstruction<1, 1, 1> { |
| 2580 public: |
| 2581 LAllocateObject(LOperand* context, LOperand* temp) { |
| 2582 inputs_[0] = context; |
| 2583 temps_[0] = temp; |
| 2584 } |
| 2585 |
| 2586 LOperand* context() { return inputs_[0]; } |
| 2587 LOperand* temp() { return temps_[0]; } |
| 2588 |
| 2589 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") |
| 2590 DECLARE_HYDROGEN_ACCESSOR(AllocateObject) |
| 2591 }; |
| 2592 |
| 2593 |
| 2554 class LAllocate: public LTemplateInstruction<1, 2, 1> { | 2594 class LAllocate: public LTemplateInstruction<1, 2, 1> { |
| 2555 public: | 2595 public: |
| 2556 LAllocate(LOperand* context, LOperand* size, LOperand* temp) { | 2596 LAllocate(LOperand* context, LOperand* size, LOperand* temp) { |
| 2557 inputs_[0] = context; | 2597 inputs_[0] = context; |
| 2558 inputs_[1] = size; | 2598 inputs_[1] = size; |
| 2559 temps_[0] = temp; | 2599 temps_[0] = temp; |
| 2560 } | 2600 } |
| 2561 | 2601 |
| 2562 LOperand* context() { return inputs_[0]; } | 2602 LOperand* context() { return inputs_[0]; } |
| 2563 LOperand* size() { return inputs_[1]; } | 2603 LOperand* size() { return inputs_[1]; } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2649 LOperand* context() { return inputs_[0]; } | 2689 LOperand* context() { return inputs_[0]; } |
| 2650 LOperand* object() { return inputs_[1]; } | 2690 LOperand* object() { return inputs_[1]; } |
| 2651 LOperand* key() { return inputs_[2]; } | 2691 LOperand* key() { return inputs_[2]; } |
| 2652 | 2692 |
| 2653 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") | 2693 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
| 2654 }; | 2694 }; |
| 2655 | 2695 |
| 2656 | 2696 |
| 2657 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { | 2697 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { |
| 2658 public: | 2698 public: |
| 2659 LOsrEntry(); | 2699 LOsrEntry() {} |
| 2660 | 2700 |
| 2661 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 2701 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 2662 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") | 2702 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") |
| 2663 | |
| 2664 LOperand** SpilledRegisterArray() { return register_spills_; } | |
| 2665 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } | |
| 2666 | |
| 2667 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); | |
| 2668 void MarkSpilledDoubleRegister(int allocation_index, | |
| 2669 LOperand* spill_operand); | |
| 2670 | |
| 2671 private: | |
| 2672 // Arrays of spill slot operands for registers with an assigned spill | |
| 2673 // slot, i.e., that must also be restored to the spill slot on OSR entry. | |
| 2674 // NULL if the register has no assigned spill slot. Indexed by allocation | |
| 2675 // index. | |
| 2676 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters]; | |
| 2677 LOperand* double_register_spills_[ | |
| 2678 DoubleRegister::kMaxNumAllocatableRegisters]; | |
| 2679 }; | 2703 }; |
| 2680 | 2704 |
| 2681 | 2705 |
| 2682 class LStackCheck: public LTemplateInstruction<0, 1, 0> { | 2706 class LStackCheck: public LTemplateInstruction<0, 1, 0> { |
| 2683 public: | 2707 public: |
| 2684 explicit LStackCheck(LOperand* context) { | 2708 explicit LStackCheck(LOperand* context) { |
| 2685 inputs_[0] = context; | 2709 inputs_[0] = context; |
| 2686 } | 2710 } |
| 2687 | 2711 |
| 2688 LOperand* context() { return inputs_[0]; } | 2712 LOperand* context() { return inputs_[0]; } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 | 2987 |
| 2964 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2988 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2965 }; | 2989 }; |
| 2966 | 2990 |
| 2967 #undef DECLARE_HYDROGEN_ACCESSOR | 2991 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2968 #undef DECLARE_CONCRETE_INSTRUCTION | 2992 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2969 | 2993 |
| 2970 } } // namespace v8::internal | 2994 } } // namespace v8::internal |
| 2971 | 2995 |
| 2972 #endif // V8_IA32_LITHIUM_IA32_H_ | 2996 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |