OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "lithium-allocator.h" | 32 #include "lithium-allocator.h" |
33 #include "lithium.h" | 33 #include "lithium.h" |
34 #include "safepoint-table.h" | 34 #include "safepoint-table.h" |
35 | 35 |
36 namespace v8 { | 36 namespace v8 { |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 // Forward declarations. | 39 // Forward declarations. |
40 class LCodeGen; | 40 class LCodeGen; |
41 | 41 |
42 | |
43 // Type hierarchy: | |
44 // | |
45 // LInstruction | |
46 // LTemplateInstruction | |
47 // LControlInstruction | |
48 // LBranch | |
49 // LClassOfTestAndBranch | |
50 // LCmpJSObjectEqAndBranch | |
51 // LCmpIDAndBranch | |
52 // LHasCachedArrayIndexAndBranch | |
53 // LHasInstanceTypeAndBranch | |
54 // LInstanceOfAndBranch | |
55 // LIsNullAndBranch | |
56 // LIsObjectAndBranch | |
57 // LIsSmiAndBranch | |
58 // LTypeofIsAndBranch | |
59 // LAccessArgumentsAt | |
60 // LArgumentsElements | |
61 // LArgumentsLength | |
62 // LAddI | |
63 // LApplyArguments | |
64 // LArithmeticD | |
65 // LArithmeticT | |
66 // LBitI | |
67 // LBoundsCheck | |
68 // LCmpID | |
69 // LCmpJSObjectEq | |
70 // LCmpT | |
71 // LDivI | |
72 // LInstanceOf | |
73 // LInstanceOfKnownGlobal | |
74 // LLoadKeyedFastElement | |
75 // LLoadKeyedGeneric | |
76 // LModI | |
77 // LMulI | |
78 // LPower | |
79 // LShiftI | |
80 // LSubI | |
81 // LCallConstantFunction | |
82 // LCallFunction | |
83 // LCallGlobal | |
84 // LCallKeyed | |
85 // LCallKnownGlobal | |
86 // LCallNamed | |
87 // LCallRuntime | |
88 // LCallStub | |
89 // LConstant | |
90 // LConstantD | |
91 // LConstantI | |
92 // LConstantT | |
93 // LDeoptimize | |
94 // LFunctionLiteral | |
95 // LGap | |
96 // LLabel | |
97 // LGlobalObject | |
98 // LGlobalReceiver | |
99 // LGoto | |
100 // LLazyBailout | |
101 // LLoadGlobal | |
102 // LCheckPrototypeMaps | |
103 // LLoadContextSlot | |
104 // LArrayLiteral | |
105 // LObjectLiteral | |
106 // LRegExpLiteral | |
107 // LOsrEntry | |
108 // LParameter | |
109 // LRegExpConstructResult | |
110 // LStackCheck | |
111 // LStoreKeyed | |
112 // LStoreKeyedFastElement | |
113 // LStoreKeyedGeneric | |
114 // LStoreNamed | |
115 // LStoreNamedField | |
116 // LStoreNamedGeneric | |
117 // LBitNotI | |
118 // LCallNew | |
119 // LCheckFunction | |
120 // LCheckPrototypeMaps | |
121 // LCheckInstanceType | |
122 // LCheckMap | |
123 // LCheckSmi | |
124 // LClassOfTest | |
125 // LDeleteProperty | |
126 // LDoubleToI | |
127 // LFixedArrayLength | |
128 // LHasCachedArrayIndex | |
129 // LHasInstanceType | |
130 // LInteger32ToDouble | |
131 // LIsNull | |
132 // LIsObject | |
133 // LIsSmi | |
134 // LJSArrayLength | |
135 // LLoadNamedField | |
136 // LLoadNamedGeneric | |
137 // LLoadFunctionPrototype | |
138 // LNumberTagD | |
139 // LNumberTagI | |
140 // LPushArgument | |
141 // LReturn | |
142 // LSmiTag | |
143 // LStoreGlobal | |
144 // LTaggedToI | |
145 // LThrow | |
146 // LTypeof | |
147 // LTypeofIs | |
148 // LUnaryMathOperation | |
149 // LValueOf | |
150 // LUnknownOSRValue | |
151 | |
152 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ | 42 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ |
153 V(ControlInstruction) \ | 43 V(ControlInstruction) \ |
154 V(Constant) \ | |
155 V(Call) \ | 44 V(Call) \ |
156 V(StoreKeyed) \ | 45 V(StoreKeyed) \ |
157 V(StoreNamed) \ | 46 V(StoreNamed) \ |
158 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) | 47 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) |
159 | 48 |
160 | 49 |
161 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 50 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
162 V(AccessArgumentsAt) \ | 51 V(AccessArgumentsAt) \ |
163 V(AddI) \ | 52 V(AddI) \ |
164 V(ApplyArguments) \ | 53 V(ApplyArguments) \ |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 V(StoreKeyedFastElement) \ | 141 V(StoreKeyedFastElement) \ |
253 V(StoreKeyedGeneric) \ | 142 V(StoreKeyedGeneric) \ |
254 V(StoreNamedField) \ | 143 V(StoreNamedField) \ |
255 V(StoreNamedGeneric) \ | 144 V(StoreNamedGeneric) \ |
256 V(SubI) \ | 145 V(SubI) \ |
257 V(TaggedToI) \ | 146 V(TaggedToI) \ |
258 V(Throw) \ | 147 V(Throw) \ |
259 V(Typeof) \ | 148 V(Typeof) \ |
260 V(TypeofIs) \ | 149 V(TypeofIs) \ |
261 V(TypeofIsAndBranch) \ | 150 V(TypeofIsAndBranch) \ |
| 151 V(IsConstructCall) \ |
| 152 V(IsConstructCallAndBranch) \ |
262 V(UnaryMathOperation) \ | 153 V(UnaryMathOperation) \ |
263 V(UnknownOSRValue) \ | 154 V(UnknownOSRValue) \ |
264 V(ValueOf) | 155 V(ValueOf) |
265 | 156 |
266 | 157 |
267 #define DECLARE_INSTRUCTION(type) \ | 158 #define DECLARE_INSTRUCTION(type) \ |
268 virtual bool Is##type() const { return true; } \ | 159 virtual bool Is##type() const { return true; } \ |
269 static L##type* cast(LInstruction* instr) { \ | 160 static L##type* cast(LInstruction* instr) { \ |
270 ASSERT(instr->Is##type()); \ | 161 ASSERT(instr->Is##type()); \ |
271 return reinterpret_cast<L##type*>(instr); \ | 162 return reinterpret_cast<L##type*>(instr); \ |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 inputs_[0] = left; | 532 inputs_[0] = left; |
642 inputs_[1] = right; | 533 inputs_[1] = right; |
643 temps_[0] = temp; | 534 temps_[0] = temp; |
644 } | 535 } |
645 | 536 |
646 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") | 537 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") |
647 DECLARE_HYDROGEN_ACCESSOR(Div) | 538 DECLARE_HYDROGEN_ACCESSOR(Div) |
648 }; | 539 }; |
649 | 540 |
650 | 541 |
651 class LMulI: public LTemplateInstruction<1, 2, 1> { | 542 class LMulI: public LTemplateInstruction<1, 2, 0> { |
652 public: | 543 public: |
653 LMulI(LOperand* left, LOperand* right, LOperand* temp) { | 544 LMulI(LOperand* left, LOperand* right) { |
654 inputs_[0] = left; | 545 inputs_[0] = left; |
655 inputs_[1] = right; | 546 inputs_[1] = right; |
656 temps_[0] = temp; | |
657 } | 547 } |
658 | 548 |
659 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") | 549 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") |
660 DECLARE_HYDROGEN_ACCESSOR(Mul) | 550 DECLARE_HYDROGEN_ACCESSOR(Mul) |
661 }; | 551 }; |
662 | 552 |
663 | 553 |
664 class LCmpID: public LTemplateInstruction<1, 2, 0> { | 554 class LCmpID: public LTemplateInstruction<1, 2, 0> { |
665 public: | 555 public: |
666 LCmpID(LOperand* left, LOperand* right) { | 556 LCmpID(LOperand* left, LOperand* right) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 LSubI(LOperand* left, LOperand* right) { | 896 LSubI(LOperand* left, LOperand* right) { |
1007 inputs_[0] = left; | 897 inputs_[0] = left; |
1008 inputs_[1] = right; | 898 inputs_[1] = right; |
1009 } | 899 } |
1010 | 900 |
1011 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") | 901 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") |
1012 DECLARE_HYDROGEN_ACCESSOR(Sub) | 902 DECLARE_HYDROGEN_ACCESSOR(Sub) |
1013 }; | 903 }; |
1014 | 904 |
1015 | 905 |
1016 template <int temp_count> | 906 class LConstantI: public LTemplateInstruction<1, 0, 0> { |
1017 class LConstant: public LTemplateInstruction<1, 0, temp_count> { | 907 public: |
1018 DECLARE_INSTRUCTION(Constant) | 908 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") |
| 909 DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 910 |
| 911 int32_t value() const { return hydrogen()->Integer32Value(); } |
1019 }; | 912 }; |
1020 | 913 |
1021 | 914 |
1022 class LConstantI: public LConstant<0> { | 915 class LConstantD: public LTemplateInstruction<1, 0, 1> { |
1023 public: | 916 public: |
1024 explicit LConstantI(int32_t value) : value_(value) { } | 917 explicit LConstantD(LOperand* temp) { |
1025 int32_t value() const { return value_; } | 918 temps_[0] = temp; |
| 919 } |
| 920 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
| 921 DECLARE_HYDROGEN_ACCESSOR(Constant) |
1026 | 922 |
1027 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") | 923 double value() const { return hydrogen()->DoubleValue(); } |
1028 | |
1029 private: | |
1030 int32_t value_; | |
1031 }; | 924 }; |
1032 | 925 |
1033 | 926 |
1034 class LConstantD: public LConstant<1> { | 927 class LConstantT: public LTemplateInstruction<1, 0, 0> { |
1035 public: | 928 public: |
1036 explicit LConstantD(double value, LOperand* temp) : value_(value) { | 929 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") |
1037 temps_[0] = temp; | 930 DECLARE_HYDROGEN_ACCESSOR(Constant) |
1038 } | |
1039 double value() const { return value_; } | |
1040 | 931 |
1041 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") | 932 Handle<Object> value() const { return hydrogen()->handle(); } |
1042 | |
1043 private: | |
1044 double value_; | |
1045 }; | 933 }; |
1046 | 934 |
1047 | 935 |
1048 class LConstantT: public LConstant<0> { | |
1049 public: | |
1050 explicit LConstantT(Handle<Object> value) : value_(value) { } | |
1051 Handle<Object> value() const { return value_; } | |
1052 | |
1053 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") | |
1054 | |
1055 private: | |
1056 Handle<Object> value_; | |
1057 }; | |
1058 | |
1059 | |
1060 class LBranch: public LControlInstruction<1, 0> { | 936 class LBranch: public LControlInstruction<1, 0> { |
1061 public: | 937 public: |
1062 explicit LBranch(LOperand* value) { | 938 explicit LBranch(LOperand* value) { |
1063 inputs_[0] = value; | 939 inputs_[0] = value; |
1064 } | 940 } |
1065 | 941 |
1066 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 942 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
1067 DECLARE_HYDROGEN_ACCESSOR(Value) | 943 DECLARE_HYDROGEN_ACCESSOR(Value) |
1068 | 944 |
1069 virtual void PrintDataTo(StringStream* stream); | 945 virtual void PrintDataTo(StringStream* stream); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 | 1632 |
1757 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") | 1633 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") |
1758 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) | 1634 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) |
1759 | 1635 |
1760 Handle<String> type_literal() { return hydrogen()->type_literal(); } | 1636 Handle<String> type_literal() { return hydrogen()->type_literal(); } |
1761 | 1637 |
1762 virtual void PrintDataTo(StringStream* stream); | 1638 virtual void PrintDataTo(StringStream* stream); |
1763 }; | 1639 }; |
1764 | 1640 |
1765 | 1641 |
| 1642 class LIsConstructCall: public LTemplateInstruction<1, 0, 0> { |
| 1643 public: |
| 1644 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is-construct-call") |
| 1645 DECLARE_HYDROGEN_ACCESSOR(IsConstructCall) |
| 1646 }; |
| 1647 |
| 1648 |
| 1649 class LIsConstructCallAndBranch: public LControlInstruction<0, 1> { |
| 1650 public: |
| 1651 explicit LIsConstructCallAndBranch(LOperand* temp) { |
| 1652 temps_[0] = temp; |
| 1653 } |
| 1654 |
| 1655 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, |
| 1656 "is-construct-call-and-branch") |
| 1657 }; |
| 1658 |
| 1659 |
1766 class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { | 1660 class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { |
1767 public: | 1661 public: |
1768 LDeleteProperty(LOperand* obj, LOperand* key) { | 1662 LDeleteProperty(LOperand* obj, LOperand* key) { |
1769 inputs_[0] = obj; | 1663 inputs_[0] = obj; |
1770 inputs_[1] = key; | 1664 inputs_[1] = key; |
1771 } | 1665 } |
1772 | 1666 |
1773 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") | 1667 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
1774 | 1668 |
1775 LOperand* object() { return inputs_[0]; } | 1669 LOperand* object() { return inputs_[0]; } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 1916 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2023 }; | 1917 }; |
2024 | 1918 |
2025 #undef DECLARE_HYDROGEN_ACCESSOR | 1919 #undef DECLARE_HYDROGEN_ACCESSOR |
2026 #undef DECLARE_INSTRUCTION | 1920 #undef DECLARE_INSTRUCTION |
2027 #undef DECLARE_CONCRETE_INSTRUCTION | 1921 #undef DECLARE_CONCRETE_INSTRUCTION |
2028 | 1922 |
2029 } } // namespace v8::int | 1923 } } // namespace v8::int |
2030 | 1924 |
2031 #endif // V8_X64_LITHIUM_X64_H_ | 1925 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |