| 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(NumberTagU) \ | 125 V(NumberTagD) \ |
| 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 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 164 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 164 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ | 165 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ |
| 165 return LInstruction::k##type; \ | 166 return LInstruction::k##type; \ |
| 166 } \ | 167 } \ |
| 167 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ | 168 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ |
| 168 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \ | 169 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \ |
| 169 return mnemonic; \ | 170 return mnemonic; \ |
| 170 } \ | 171 } \ |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 } | 844 } |
| 844 | 845 |
| 845 LOperand* value() { return inputs_[0]; } | 846 LOperand* value() { return inputs_[0]; } |
| 846 LOperand* temp() { return temps_[0]; } | 847 LOperand* temp() { return temps_[0]; } |
| 847 | 848 |
| 848 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") | 849 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") |
| 849 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | 850 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
| 850 }; | 851 }; |
| 851 | 852 |
| 852 | 853 |
| 854 class LMathFround V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 855 public: |
| 856 explicit LMathFround(LOperand* value) { inputs_[0] = value; } |
| 857 |
| 858 LOperand* value() { return inputs_[0]; } |
| 859 |
| 860 DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround") |
| 861 }; |
| 862 |
| 863 |
| 853 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 864 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 854 public: | 865 public: |
| 855 LMathAbs(LOperand* context, LOperand* value) { | 866 LMathAbs(LOperand* context, LOperand* value) { |
| 856 inputs_[1] = context; | 867 inputs_[1] = context; |
| 857 inputs_[0] = value; | 868 inputs_[0] = value; |
| 858 } | 869 } |
| 859 | 870 |
| 860 LOperand* context() { return inputs_[1]; } | 871 LOperand* context() { return inputs_[1]; } |
| 861 LOperand* value() { return inputs_[0]; } | 872 LOperand* value() { return inputs_[0]; } |
| 862 | 873 |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2694 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
| 2684 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 2695 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 2685 #undef DECLARE_DO | 2696 #undef DECLARE_DO |
| 2686 | 2697 |
| 2687 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); | 2698 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); |
| 2688 | 2699 |
| 2689 static bool HasMagicNumberForDivisor(int32_t divisor); | 2700 static bool HasMagicNumberForDivisor(int32_t divisor); |
| 2690 | 2701 |
| 2691 LInstruction* DoMathFloor(HUnaryMathOperation* instr); | 2702 LInstruction* DoMathFloor(HUnaryMathOperation* instr); |
| 2692 LInstruction* DoMathRound(HUnaryMathOperation* instr); | 2703 LInstruction* DoMathRound(HUnaryMathOperation* instr); |
| 2704 LInstruction* DoMathFround(HUnaryMathOperation* instr); |
| 2693 LInstruction* DoMathAbs(HUnaryMathOperation* instr); | 2705 LInstruction* DoMathAbs(HUnaryMathOperation* instr); |
| 2694 LInstruction* DoMathLog(HUnaryMathOperation* instr); | 2706 LInstruction* DoMathLog(HUnaryMathOperation* instr); |
| 2695 LInstruction* DoMathExp(HUnaryMathOperation* instr); | 2707 LInstruction* DoMathExp(HUnaryMathOperation* instr); |
| 2696 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); | 2708 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); |
| 2697 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); | 2709 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); |
| 2698 LInstruction* DoMathClz32(HUnaryMathOperation* instr); | 2710 LInstruction* DoMathClz32(HUnaryMathOperation* instr); |
| 2699 LInstruction* DoDivByPowerOf2I(HDiv* instr); | 2711 LInstruction* DoDivByPowerOf2I(HDiv* instr); |
| 2700 LInstruction* DoDivByConstI(HDiv* instr); | 2712 LInstruction* DoDivByConstI(HDiv* instr); |
| 2701 LInstruction* DoDivI(HDiv* instr); | 2713 LInstruction* DoDivI(HDiv* instr); |
| 2702 LInstruction* DoModByPowerOf2I(HMod* instr); | 2714 LInstruction* DoModByPowerOf2I(HMod* instr); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2821 | 2833 |
| 2822 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2834 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2823 }; | 2835 }; |
| 2824 | 2836 |
| 2825 #undef DECLARE_HYDROGEN_ACCESSOR | 2837 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2826 #undef DECLARE_CONCRETE_INSTRUCTION | 2838 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2827 | 2839 |
| 2828 } } // namespace v8::internal | 2840 } } // namespace v8::internal |
| 2829 | 2841 |
| 2830 #endif // V8_MIPS_LITHIUM_MIPS_H_ | 2842 #endif // V8_MIPS_LITHIUM_MIPS_H_ |
| OLD | NEW |