OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_X64_LITHIUM_X64_H_ | 5 #ifndef V8_X64_LITHIUM_X64_H_ |
6 #define V8_X64_LITHIUM_X64_H_ | 6 #define V8_X64_LITHIUM_X64_H_ |
7 | 7 |
8 #include "src/hydrogen.h" | 8 #include "src/hydrogen.h" |
9 #include "src/lithium.h" | 9 #include "src/lithium.h" |
10 #include "src/lithium-allocator.h" | 10 #include "src/lithium-allocator.h" |
11 #include "src/safepoint-table.h" | 11 #include "src/safepoint-table.h" |
12 #include "src/utils.h" | 12 #include "src/utils.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // Forward declarations. | 17 // Forward declarations. |
18 class LCodeGen; | 18 class LCodeGen; |
19 | 19 |
20 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 20 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
21 V(AccessArgumentsAt) \ | 21 V(AccessArgumentsAt) \ |
22 V(AddI) \ | 22 V(AddI) \ |
23 V(Allocate) \ | 23 V(Allocate) \ |
24 V(AllocateBlockContext) \ | 24 V(AllocateBlockContext) \ |
25 V(ApplyArguments) \ | 25 V(ApplyArguments) \ |
26 V(ArgumentsElements) \ | 26 V(ArgumentsElements) \ |
27 V(ArgumentsLength) \ | 27 V(ArgumentsLength) \ |
28 V(ArithmeticD) \ | 28 V(ArithmeticD) \ |
29 V(ArithmeticT) \ | 29 V(ArithmeticT) \ |
30 V(BitI) \ | 30 V(BitI) \ |
31 V(BoundsCheck) \ | 31 V(BoundsCheck) \ |
32 V(Branch) \ | 32 V(Branch) \ |
33 V(CallJSFunction) \ | 33 V(CallJSFunction) \ |
34 V(CallWithDescriptor) \ | 34 V(CallWithDescriptor) \ |
35 V(CallFunction) \ | 35 V(CallFunction) \ |
36 V(CallNew) \ | 36 V(CallNew) \ |
37 V(CallNewArray) \ | 37 V(CallNewArray) \ |
38 V(CallRuntime) \ | 38 V(CallRuntime) \ |
39 V(CallStub) \ | 39 V(CallStub) \ |
40 V(CheckInstanceType) \ | 40 V(CheckInstanceType) \ |
41 V(CheckMaps) \ | 41 V(CheckMaps) \ |
42 V(CheckMapValue) \ | 42 V(CheckMapValue) \ |
43 V(CheckNonSmi) \ | 43 V(CheckNonSmi) \ |
44 V(CheckSmi) \ | 44 V(CheckSmi) \ |
45 V(CheckValue) \ | 45 V(CheckValue) \ |
46 V(ClampDToUint8) \ | 46 V(ClampDToUint8) \ |
47 V(ClampIToUint8) \ | 47 V(ClampIToUint8) \ |
48 V(ClampTToUint8) \ | 48 V(ClampTToUint8) \ |
49 V(ClassOfTestAndBranch) \ | 49 V(ClassOfTestAndBranch) \ |
50 V(CompareMinusZeroAndBranch) \ | 50 V(CompareMinusZeroAndBranch) \ |
51 V(CompareNumericAndBranch) \ | 51 V(CompareNumericAndBranch) \ |
52 V(CmpObjectEqAndBranch) \ | 52 V(CmpObjectEqAndBranch) \ |
53 V(CmpHoleAndBranch) \ | 53 V(CmpHoleAndBranch) \ |
54 V(CmpMapAndBranch) \ | 54 V(CmpMapAndBranch) \ |
55 V(CmpT) \ | 55 V(CmpT) \ |
56 V(ConstantD) \ | 56 V(ConstantD) \ |
57 V(ConstantE) \ | 57 V(ConstantE) \ |
58 V(ConstantI) \ | 58 V(ConstantI) \ |
59 V(ConstantS) \ | 59 V(ConstantS) \ |
60 V(ConstantT) \ | 60 V(ConstantT) \ |
61 V(ConstructDouble) \ | 61 V(ConstructDouble) \ |
62 V(Context) \ | 62 V(Context) \ |
63 V(DateField) \ | 63 V(DateField) \ |
64 V(DebugBreak) \ | 64 V(DebugBreak) \ |
65 V(DeclareGlobals) \ | 65 V(DeclareGlobals) \ |
66 V(Deoptimize) \ | 66 V(Deoptimize) \ |
67 V(DivByConstI) \ | 67 V(DivByConstI) \ |
68 V(DivByPowerOf2I) \ | 68 V(DivByPowerOf2I) \ |
69 V(DivI) \ | 69 V(DivI) \ |
70 V(DoubleBits) \ | 70 V(DoubleBits) \ |
71 V(DoubleToI) \ | 71 V(DoubleToI) \ |
72 V(DoubleToSmi) \ | 72 V(DoubleToSmi) \ |
73 V(Drop) \ | 73 V(Drop) \ |
74 V(DummyUse) \ | 74 V(DummyUse) \ |
75 V(Dummy) \ | 75 V(Dummy) \ |
76 V(FlooringDivByConstI) \ | 76 V(FlooringDivByConstI) \ |
77 V(FlooringDivByPowerOf2I) \ | 77 V(FlooringDivByPowerOf2I) \ |
78 V(FlooringDivI) \ | 78 V(FlooringDivI) \ |
79 V(ForInCacheArray) \ | 79 V(ForInCacheArray) \ |
80 V(ForInPrepareMap) \ | 80 V(ForInPrepareMap) \ |
81 V(FunctionLiteral) \ | 81 V(FunctionLiteral) \ |
82 V(GetCachedArrayIndex) \ | 82 V(GetCachedArrayIndex) \ |
83 V(Goto) \ | 83 V(Goto) \ |
84 V(HasCachedArrayIndexAndBranch) \ | 84 V(HasCachedArrayIndexAndBranch) \ |
85 V(HasInstanceTypeAndBranch) \ | 85 V(HasInstanceTypeAndBranch) \ |
86 V(InnerAllocatedObject) \ | 86 V(InnerAllocatedObject) \ |
87 V(InstanceOf) \ | 87 V(InstanceOf) \ |
88 V(InstanceOfKnownGlobal) \ | 88 V(InstanceOfKnownGlobal) \ |
89 V(InstructionGap) \ | 89 V(InstructionGap) \ |
90 V(Integer32ToDouble) \ | 90 V(Integer32ToDouble) \ |
91 V(InvokeFunction) \ | 91 V(InvokeFunction) \ |
92 V(IsConstructCallAndBranch) \ | 92 V(IsConstructCallAndBranch) \ |
93 V(IsObjectAndBranch) \ | 93 V(IsObjectAndBranch) \ |
94 V(IsStringAndBranch) \ | 94 V(IsStringAndBranch) \ |
95 V(IsSmiAndBranch) \ | 95 V(IsSmiAndBranch) \ |
96 V(IsUndetectableAndBranch) \ | 96 V(IsUndetectableAndBranch) \ |
97 V(Label) \ | 97 V(Label) \ |
98 V(LazyBailout) \ | 98 V(LazyBailout) \ |
99 V(LoadContextSlot) \ | 99 V(LoadContextSlot) \ |
100 V(LoadRoot) \ | 100 V(LoadRoot) \ |
101 V(LoadFieldByIndex) \ | 101 V(LoadFieldByIndex) \ |
102 V(LoadFunctionPrototype) \ | 102 V(LoadFunctionPrototype) \ |
103 V(LoadGlobalCell) \ | 103 V(LoadGlobalCell) \ |
104 V(LoadGlobalGeneric) \ | 104 V(LoadGlobalGeneric) \ |
105 V(LoadKeyed) \ | 105 V(LoadKeyed) \ |
106 V(LoadKeyedGeneric) \ | 106 V(LoadKeyedGeneric) \ |
107 V(LoadNamedField) \ | 107 V(LoadNamedField) \ |
108 V(LoadNamedGeneric) \ | 108 V(LoadNamedGeneric) \ |
109 V(MapEnumLength) \ | 109 V(MapEnumLength) \ |
110 V(MathAbs) \ | 110 V(MathAbs) \ |
111 V(MathClz32) \ | 111 V(MathClz32) \ |
112 V(MathExp) \ | 112 V(MathExp) \ |
113 V(MathFloor) \ | 113 V(MathFloor) \ |
114 V(MathLog) \ | 114 V(MathFround) \ |
115 V(MathMinMax) \ | 115 V(MathLog) \ |
116 V(MathPowHalf) \ | 116 V(MathMinMax) \ |
117 V(MathRound) \ | 117 V(MathPowHalf) \ |
118 V(MathSqrt) \ | 118 V(MathRound) \ |
119 V(ModByConstI) \ | 119 V(MathSqrt) \ |
120 V(ModByPowerOf2I) \ | 120 V(ModByConstI) \ |
121 V(ModI) \ | 121 V(ModByPowerOf2I) \ |
122 V(MulI) \ | 122 V(ModI) \ |
123 V(NumberTagD) \ | 123 V(MulI) \ |
124 V(NumberTagI) \ | 124 V(NumberTagD) \ |
125 V(NumberTagU) \ | 125 V(NumberTagI) \ |
126 V(NumberUntagD) \ | 126 V(NumberTagU) \ |
127 V(OsrEntry) \ | 127 V(NumberUntagD) \ |
128 V(Parameter) \ | 128 V(OsrEntry) \ |
129 V(Power) \ | 129 V(Parameter) \ |
130 V(PushArgument) \ | 130 V(Power) \ |
131 V(RegExpLiteral) \ | 131 V(PushArgument) \ |
132 V(Return) \ | 132 V(RegExpLiteral) \ |
133 V(SeqStringGetChar) \ | 133 V(Return) \ |
134 V(SeqStringSetChar) \ | 134 V(SeqStringGetChar) \ |
135 V(ShiftI) \ | 135 V(SeqStringSetChar) \ |
136 V(SmiTag) \ | 136 V(ShiftI) \ |
137 V(SmiUntag) \ | 137 V(SmiTag) \ |
138 V(StackCheck) \ | 138 V(SmiUntag) \ |
139 V(StoreCodeEntry) \ | 139 V(StackCheck) \ |
140 V(StoreContextSlot) \ | 140 V(StoreCodeEntry) \ |
141 V(StoreFrameContext) \ | 141 V(StoreContextSlot) \ |
142 V(StoreGlobalCell) \ | 142 V(StoreFrameContext) \ |
143 V(StoreKeyed) \ | 143 V(StoreGlobalCell) \ |
144 V(StoreKeyedGeneric) \ | 144 V(StoreKeyed) \ |
145 V(StoreNamedField) \ | 145 V(StoreKeyedGeneric) \ |
146 V(StoreNamedGeneric) \ | 146 V(StoreNamedField) \ |
147 V(StringAdd) \ | 147 V(StoreNamedGeneric) \ |
148 V(StringCharCodeAt) \ | 148 V(StringAdd) \ |
149 V(StringCharFromCode) \ | 149 V(StringCharCodeAt) \ |
150 V(StringCompareAndBranch) \ | 150 V(StringCharFromCode) \ |
151 V(SubI) \ | 151 V(StringCompareAndBranch) \ |
152 V(TaggedToI) \ | 152 V(SubI) \ |
153 V(ThisFunction) \ | 153 V(TaggedToI) \ |
154 V(ToFastProperties) \ | 154 V(ThisFunction) \ |
155 V(TransitionElementsKind) \ | 155 V(ToFastProperties) \ |
156 V(TrapAllocationMemento) \ | 156 V(TransitionElementsKind) \ |
157 V(Typeof) \ | 157 V(TrapAllocationMemento) \ |
158 V(TypeofIsAndBranch) \ | 158 V(Typeof) \ |
159 V(Uint32ToDouble) \ | 159 V(TypeofIsAndBranch) \ |
160 V(UnknownOSRValue) \ | 160 V(Uint32ToDouble) \ |
| 161 V(UnknownOSRValue) \ |
161 V(WrapReceiver) | 162 V(WrapReceiver) |
162 | 163 |
163 | 164 |
164 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 165 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
165 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ | 166 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ |
166 return LInstruction::k##type; \ | 167 return LInstruction::k##type; \ |
167 } \ | 168 } \ |
168 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ | 169 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ |
169 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \ | 170 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \ |
170 return mnemonic; \ | 171 return mnemonic; \ |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 841 |
841 LOperand* value() { return inputs_[0]; } | 842 LOperand* value() { return inputs_[0]; } |
842 | 843 |
843 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor") | 844 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor") |
844 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | 845 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
845 }; | 846 }; |
846 | 847 |
847 | 848 |
848 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 1> { | 849 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 1> { |
849 public: | 850 public: |
850 explicit LMathRound(LOperand* value, LOperand* temp) { | 851 LMathRound(LOperand* value, LOperand* temp) { |
851 inputs_[0] = value; | 852 inputs_[0] = value; |
852 temps_[0] = temp; | 853 temps_[0] = temp; |
853 } | 854 } |
854 | 855 |
855 LOperand* value() { return inputs_[0]; } | 856 LOperand* value() { return inputs_[0]; } |
856 LOperand* temp() { return temps_[0]; } | 857 LOperand* temp() { return temps_[0]; } |
857 | 858 |
858 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") | 859 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") |
859 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | 860 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
860 }; | 861 }; |
861 | 862 |
862 | 863 |
| 864 class LMathFround V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 865 public: |
| 866 explicit LMathFround(LOperand* value) { inputs_[0] = value; } |
| 867 |
| 868 LOperand* value() { return inputs_[0]; } |
| 869 |
| 870 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-fround") |
| 871 }; |
| 872 |
| 873 |
863 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 874 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
864 public: | 875 public: |
865 explicit LMathAbs(LOperand* context, LOperand* value) { | 876 explicit LMathAbs(LOperand* context, LOperand* value) { |
866 inputs_[1] = context; | 877 inputs_[1] = context; |
867 inputs_[0] = value; | 878 inputs_[0] = value; |
868 } | 879 } |
869 | 880 |
870 LOperand* context() { return inputs_[1]; } | 881 LOperand* context() { return inputs_[1]; } |
871 LOperand* value() { return inputs_[0]; } | 882 LOperand* value() { return inputs_[0]; } |
872 | 883 |
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 // Build the sequence for the graph. | 2738 // Build the sequence for the graph. |
2728 LPlatformChunk* Build(); | 2739 LPlatformChunk* Build(); |
2729 | 2740 |
2730 // Declare methods that deal with the individual node types. | 2741 // Declare methods that deal with the individual node types. |
2731 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2742 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
2732 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 2743 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
2733 #undef DECLARE_DO | 2744 #undef DECLARE_DO |
2734 | 2745 |
2735 LInstruction* DoMathFloor(HUnaryMathOperation* instr); | 2746 LInstruction* DoMathFloor(HUnaryMathOperation* instr); |
2736 LInstruction* DoMathRound(HUnaryMathOperation* instr); | 2747 LInstruction* DoMathRound(HUnaryMathOperation* instr); |
| 2748 LInstruction* DoMathFround(HUnaryMathOperation* instr); |
2737 LInstruction* DoMathAbs(HUnaryMathOperation* instr); | 2749 LInstruction* DoMathAbs(HUnaryMathOperation* instr); |
2738 LInstruction* DoMathLog(HUnaryMathOperation* instr); | 2750 LInstruction* DoMathLog(HUnaryMathOperation* instr); |
2739 LInstruction* DoMathExp(HUnaryMathOperation* instr); | 2751 LInstruction* DoMathExp(HUnaryMathOperation* instr); |
2740 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); | 2752 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); |
2741 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); | 2753 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); |
2742 LInstruction* DoMathClz32(HUnaryMathOperation* instr); | 2754 LInstruction* DoMathClz32(HUnaryMathOperation* instr); |
2743 LInstruction* DoDivByPowerOf2I(HDiv* instr); | 2755 LInstruction* DoDivByPowerOf2I(HDiv* instr); |
2744 LInstruction* DoDivByConstI(HDiv* instr); | 2756 LInstruction* DoDivByConstI(HDiv* instr); |
2745 LInstruction* DoDivI(HDiv* instr); | 2757 LInstruction* DoDivI(HDiv* instr); |
2746 LInstruction* DoModByPowerOf2I(HMod* instr); | 2758 LInstruction* DoModByPowerOf2I(HMod* instr); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 | 2883 |
2872 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2884 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2873 }; | 2885 }; |
2874 | 2886 |
2875 #undef DECLARE_HYDROGEN_ACCESSOR | 2887 #undef DECLARE_HYDROGEN_ACCESSOR |
2876 #undef DECLARE_CONCRETE_INSTRUCTION | 2888 #undef DECLARE_CONCRETE_INSTRUCTION |
2877 | 2889 |
2878 } } // namespace v8::int | 2890 } } // namespace v8::int |
2879 | 2891 |
2880 #endif // V8_X64_LITHIUM_X64_H_ | 2892 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |