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_MIPS_LITHIUM_MIPS_H_ | 5 #ifndef V8_MIPS_LITHIUM_MIPS_H_ |
6 #define V8_MIPS_LITHIUM_MIPS_H_ | 6 #define V8_MIPS_LITHIUM_MIPS_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(DoubleToI) \ | 70 V(DoubleToI) \ |
71 V(DoubleBits) \ | 71 V(DoubleBits) \ |
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(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(MathExp) \ | 111 V(MathExp) \ |
112 V(MathClz32) \ | 112 V(MathClz32) \ |
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(MultiplyAddD) \ | 123 V(MulI) \ |
124 V(NumberTagD) \ | 124 V(MultiplyAddD) \ |
125 V(NumberTagI) \ | 125 V(NumberTagD) \ |
126 V(NumberTagU) \ | 126 V(NumberTagI) \ |
127 V(NumberUntagD) \ | 127 V(NumberTagU) \ |
128 V(OsrEntry) \ | 128 V(NumberUntagD) \ |
129 V(Parameter) \ | 129 V(OsrEntry) \ |
130 V(Power) \ | 130 V(Parameter) \ |
131 V(PushArgument) \ | 131 V(Power) \ |
132 V(RegExpLiteral) \ | 132 V(PushArgument) \ |
133 V(Return) \ | 133 V(RegExpLiteral) \ |
134 V(SeqStringGetChar) \ | 134 V(Return) \ |
135 V(SeqStringSetChar) \ | 135 V(SeqStringGetChar) \ |
136 V(ShiftI) \ | 136 V(SeqStringSetChar) \ |
137 V(SmiTag) \ | 137 V(ShiftI) \ |
138 V(SmiUntag) \ | 138 V(SmiTag) \ |
139 V(StackCheck) \ | 139 V(SmiUntag) \ |
140 V(StoreCodeEntry) \ | 140 V(StackCheck) \ |
141 V(StoreContextSlot) \ | 141 V(StoreCodeEntry) \ |
142 V(StoreFrameContext) \ | 142 V(StoreContextSlot) \ |
143 V(StoreGlobalCell) \ | 143 V(StoreFrameContext) \ |
144 V(StoreKeyed) \ | 144 V(StoreGlobalCell) \ |
145 V(StoreKeyedGeneric) \ | 145 V(StoreKeyed) \ |
146 V(StoreNamedField) \ | 146 V(StoreKeyedGeneric) \ |
147 V(StoreNamedGeneric) \ | 147 V(StoreNamedField) \ |
148 V(StringAdd) \ | 148 V(StoreNamedGeneric) \ |
149 V(StringCharCodeAt) \ | 149 V(StringAdd) \ |
150 V(StringCharFromCode) \ | 150 V(StringCharCodeAt) \ |
151 V(StringCompareAndBranch) \ | 151 V(StringCharFromCode) \ |
152 V(SubI) \ | 152 V(StringCompareAndBranch) \ |
153 V(TaggedToI) \ | 153 V(SubI) \ |
154 V(ThisFunction) \ | 154 V(TaggedToI) \ |
155 V(ToFastProperties) \ | 155 V(ThisFunction) \ |
156 V(TransitionElementsKind) \ | 156 V(ToFastProperties) \ |
157 V(TrapAllocationMemento) \ | 157 V(TransitionElementsKind) \ |
158 V(Typeof) \ | 158 V(TrapAllocationMemento) \ |
159 V(TypeofIsAndBranch) \ | 159 V(Typeof) \ |
160 V(Uint32ToDouble) \ | 160 V(TypeofIsAndBranch) \ |
161 V(UnknownOSRValue) \ | 161 V(Uint32ToDouble) \ |
| 162 V(UnknownOSRValue) \ |
162 V(WrapReceiver) | 163 V(WrapReceiver) |
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; \ |
171 } \ | 172 } \ |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 } | 845 } |
845 | 846 |
846 LOperand* value() { return inputs_[0]; } | 847 LOperand* value() { return inputs_[0]; } |
847 LOperand* temp() { return temps_[0]; } | 848 LOperand* temp() { return temps_[0]; } |
848 | 849 |
849 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") | 850 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") |
850 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | 851 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
851 }; | 852 }; |
852 | 853 |
853 | 854 |
| 855 class LMathFround V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 856 public: |
| 857 explicit LMathFround(LOperand* value) { inputs_[0] = value; } |
| 858 |
| 859 LOperand* value() { return inputs_[0]; } |
| 860 |
| 861 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-fround") |
| 862 }; |
| 863 |
| 864 |
854 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 865 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
855 public: | 866 public: |
856 LMathAbs(LOperand* context, LOperand* value) { | 867 LMathAbs(LOperand* context, LOperand* value) { |
857 inputs_[1] = context; | 868 inputs_[1] = context; |
858 inputs_[0] = value; | 869 inputs_[0] = value; |
859 } | 870 } |
860 | 871 |
861 LOperand* context() { return inputs_[1]; } | 872 LOperand* context() { return inputs_[1]; } |
862 LOperand* value() { return inputs_[0]; } | 873 LOperand* value() { return inputs_[0]; } |
863 | 874 |
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2699 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2710 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
2700 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 2711 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
2701 #undef DECLARE_DO | 2712 #undef DECLARE_DO |
2702 | 2713 |
2703 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); | 2714 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); |
2704 | 2715 |
2705 static bool HasMagicNumberForDivisor(int32_t divisor); | 2716 static bool HasMagicNumberForDivisor(int32_t divisor); |
2706 | 2717 |
2707 LInstruction* DoMathFloor(HUnaryMathOperation* instr); | 2718 LInstruction* DoMathFloor(HUnaryMathOperation* instr); |
2708 LInstruction* DoMathRound(HUnaryMathOperation* instr); | 2719 LInstruction* DoMathRound(HUnaryMathOperation* instr); |
| 2720 LInstruction* DoMathFround(HUnaryMathOperation* instr); |
2709 LInstruction* DoMathAbs(HUnaryMathOperation* instr); | 2721 LInstruction* DoMathAbs(HUnaryMathOperation* instr); |
2710 LInstruction* DoMathLog(HUnaryMathOperation* instr); | 2722 LInstruction* DoMathLog(HUnaryMathOperation* instr); |
2711 LInstruction* DoMathExp(HUnaryMathOperation* instr); | 2723 LInstruction* DoMathExp(HUnaryMathOperation* instr); |
2712 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); | 2724 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); |
2713 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); | 2725 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); |
2714 LInstruction* DoMathClz32(HUnaryMathOperation* instr); | 2726 LInstruction* DoMathClz32(HUnaryMathOperation* instr); |
2715 LInstruction* DoDivByPowerOf2I(HDiv* instr); | 2727 LInstruction* DoDivByPowerOf2I(HDiv* instr); |
2716 LInstruction* DoDivByConstI(HDiv* instr); | 2728 LInstruction* DoDivByConstI(HDiv* instr); |
2717 LInstruction* DoDivI(HDiv* instr); | 2729 LInstruction* DoDivI(HDiv* instr); |
2718 LInstruction* DoModByPowerOf2I(HMod* instr); | 2730 LInstruction* DoModByPowerOf2I(HMod* instr); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 | 2849 |
2838 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2850 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2839 }; | 2851 }; |
2840 | 2852 |
2841 #undef DECLARE_HYDROGEN_ACCESSOR | 2853 #undef DECLARE_HYDROGEN_ACCESSOR |
2842 #undef DECLARE_CONCRETE_INSTRUCTION | 2854 #undef DECLARE_CONCRETE_INSTRUCTION |
2843 | 2855 |
2844 } } // namespace v8::internal | 2856 } } // namespace v8::internal |
2845 | 2857 |
2846 #endif // V8_MIPS_LITHIUM_MIPS_H_ | 2858 #endif // V8_MIPS_LITHIUM_MIPS_H_ |
OLD | NEW |