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_IA32_LITHIUM_IA32_H_ | 5 #ifndef V8_IA32_LITHIUM_IA32_H_ |
6 #define V8_IA32_LITHIUM_IA32_H_ | 6 #define V8_IA32_LITHIUM_IA32_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(AllocateBlockContext) \ | 23 V(AllocateBlockContext) \ |
24 V(Allocate) \ | 24 V(Allocate) \ |
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(Dummy) \ | 74 V(Dummy) \ |
75 V(DummyUse) \ | 75 V(DummyUse) \ |
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(LoadFieldByIndex) \ | 100 V(LoadFieldByIndex) \ |
101 V(LoadFunctionPrototype) \ | 101 V(LoadFunctionPrototype) \ |
102 V(LoadGlobalCell) \ | 102 V(LoadGlobalCell) \ |
103 V(LoadGlobalGeneric) \ | 103 V(LoadGlobalGeneric) \ |
104 V(LoadKeyed) \ | 104 V(LoadKeyed) \ |
105 V(LoadKeyedGeneric) \ | 105 V(LoadKeyedGeneric) \ |
106 V(LoadNamedField) \ | 106 V(LoadNamedField) \ |
107 V(LoadNamedGeneric) \ | 107 V(LoadNamedGeneric) \ |
108 V(LoadRoot) \ | 108 V(LoadRoot) \ |
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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 }; | 844 }; |
844 | 845 |
845 | 846 |
846 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 1> { | 847 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 1> { |
847 public: | 848 public: |
848 LMathRound(LOperand* value, LOperand* temp) { | 849 LMathRound(LOperand* value, LOperand* temp) { |
849 inputs_[0] = value; | 850 inputs_[0] = value; |
850 temps_[0] = temp; | 851 temps_[0] = temp; |
851 } | 852 } |
852 | 853 |
| 854 LOperand* temp() { return temps_[0]; } |
853 LOperand* value() { return inputs_[0]; } | 855 LOperand* value() { return inputs_[0]; } |
854 LOperand* temp() { return temps_[0]; } | |
855 | 856 |
856 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") | 857 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") |
857 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | 858 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
858 }; | 859 }; |
859 | 860 |
860 | 861 |
| 862 class LMathFround V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 863 public: |
| 864 explicit LMathFround(LOperand* value) { inputs_[0] = value; } |
| 865 |
| 866 LOperand* value() { return inputs_[0]; } |
| 867 |
| 868 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-fround") |
| 869 }; |
| 870 |
| 871 |
861 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 872 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
862 public: | 873 public: |
863 LMathAbs(LOperand* context, LOperand* value) { | 874 LMathAbs(LOperand* context, LOperand* value) { |
864 inputs_[1] = context; | 875 inputs_[1] = context; |
865 inputs_[0] = value; | 876 inputs_[0] = value; |
866 } | 877 } |
867 | 878 |
868 LOperand* context() { return inputs_[1]; } | 879 LOperand* context() { return inputs_[1]; } |
869 LOperand* value() { return inputs_[0]; } | 880 LOperand* value() { return inputs_[0]; } |
870 | 881 |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 // Build the sequence for the graph. | 2735 // Build the sequence for the graph. |
2725 LPlatformChunk* Build(); | 2736 LPlatformChunk* Build(); |
2726 | 2737 |
2727 // Declare methods that deal with the individual node types. | 2738 // Declare methods that deal with the individual node types. |
2728 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2739 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
2729 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 2740 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
2730 #undef DECLARE_DO | 2741 #undef DECLARE_DO |
2731 | 2742 |
2732 LInstruction* DoMathFloor(HUnaryMathOperation* instr); | 2743 LInstruction* DoMathFloor(HUnaryMathOperation* instr); |
2733 LInstruction* DoMathRound(HUnaryMathOperation* instr); | 2744 LInstruction* DoMathRound(HUnaryMathOperation* instr); |
| 2745 LInstruction* DoMathFround(HUnaryMathOperation* instr); |
2734 LInstruction* DoMathAbs(HUnaryMathOperation* instr); | 2746 LInstruction* DoMathAbs(HUnaryMathOperation* instr); |
2735 LInstruction* DoMathLog(HUnaryMathOperation* instr); | 2747 LInstruction* DoMathLog(HUnaryMathOperation* instr); |
2736 LInstruction* DoMathExp(HUnaryMathOperation* instr); | 2748 LInstruction* DoMathExp(HUnaryMathOperation* instr); |
2737 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); | 2749 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); |
2738 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); | 2750 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); |
2739 LInstruction* DoMathClz32(HUnaryMathOperation* instr); | 2751 LInstruction* DoMathClz32(HUnaryMathOperation* instr); |
2740 LInstruction* DoDivByPowerOf2I(HDiv* instr); | 2752 LInstruction* DoDivByPowerOf2I(HDiv* instr); |
2741 LInstruction* DoDivByConstI(HDiv* instr); | 2753 LInstruction* DoDivByConstI(HDiv* instr); |
2742 LInstruction* DoDivI(HDiv* instr); | 2754 LInstruction* DoDivI(HDiv* instr); |
2743 LInstruction* DoModByPowerOf2I(HMod* instr); | 2755 LInstruction* DoModByPowerOf2I(HMod* instr); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2872 | 2884 |
2873 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2885 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2874 }; | 2886 }; |
2875 | 2887 |
2876 #undef DECLARE_HYDROGEN_ACCESSOR | 2888 #undef DECLARE_HYDROGEN_ACCESSOR |
2877 #undef DECLARE_CONCRETE_INSTRUCTION | 2889 #undef DECLARE_CONCRETE_INSTRUCTION |
2878 | 2890 |
2879 } } // namespace v8::internal | 2891 } } // namespace v8::internal |
2880 | 2892 |
2881 #endif // V8_IA32_LITHIUM_IA32_H_ | 2893 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |