| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 22 matching lines...) Expand all Loading... |
| 33 #include "lithium.h" | 33 #include "lithium.h" |
| 34 #include "safepoint-table.h" | 34 #include "safepoint-table.h" |
| 35 #include "utils.h" | 35 #include "utils.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 // Forward declarations. | 40 // Forward declarations. |
| 41 class LCodeGen; | 41 class LCodeGen; |
| 42 | 42 |
| 43 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ | |
| 44 V(ControlInstruction) \ | |
| 45 V(Call) \ | |
| 46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) | |
| 47 | |
| 48 | |
| 49 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 50 V(AccessArgumentsAt) \ | 44 V(AccessArgumentsAt) \ |
| 51 V(AddI) \ | 45 V(AddI) \ |
| 52 V(Allocate) \ | 46 V(Allocate) \ |
| 53 V(ApplyArguments) \ | 47 V(ApplyArguments) \ |
| 54 V(ArgumentsElements) \ | 48 V(ArgumentsElements) \ |
| 55 V(ArgumentsLength) \ | 49 V(ArgumentsLength) \ |
| 56 V(ArithmeticD) \ | 50 V(ArithmeticD) \ |
| 57 V(ArithmeticT) \ | 51 V(ArithmeticT) \ |
| 58 V(BitI) \ | 52 V(BitI) \ |
| 59 V(BitNotI) \ | 53 V(BitNotI) \ |
| 60 V(BoundsCheck) \ | 54 V(BoundsCheck) \ |
| 61 V(Branch) \ | 55 V(Branch) \ |
| 62 V(CallConstantFunction) \ | 56 V(CallConstantFunction) \ |
| 63 V(CallFunction) \ | 57 V(CallFunction) \ |
| 64 V(CallGlobal) \ | 58 V(CallGlobal) \ |
| 65 V(CallKeyed) \ | 59 V(CallKeyed) \ |
| 66 V(CallKnownGlobal) \ | 60 V(CallKnownGlobal) \ |
| 67 V(CallNamed) \ | 61 V(CallNamed) \ |
| 68 V(CallNew) \ | 62 V(CallNew) \ |
| 69 V(CallNewArray) \ | 63 V(CallNewArray) \ |
| 70 V(CallRuntime) \ | 64 V(CallRuntime) \ |
| 71 V(CallStub) \ | 65 V(CallStub) \ |
| 72 V(CheckFunction) \ | 66 V(CheckFunction) \ |
| 73 V(CheckInstanceType) \ | 67 V(CheckInstanceType) \ |
| 74 V(CheckMaps) \ | 68 V(CheckMaps) \ |
| 69 V(CheckMapValue) \ |
| 75 V(CheckNonSmi) \ | 70 V(CheckNonSmi) \ |
| 76 V(CheckPrototypeMaps) \ | 71 V(CheckPrototypeMaps) \ |
| 77 V(CheckSmi) \ | 72 V(CheckSmi) \ |
| 78 V(ClampDToUint8) \ | 73 V(ClampDToUint8) \ |
| 79 V(ClampIToUint8) \ | 74 V(ClampIToUint8) \ |
| 80 V(ClampTToUint8) \ | 75 V(ClampTToUint8) \ |
| 81 V(ClassOfTestAndBranch) \ | 76 V(ClassOfTestAndBranch) \ |
| 82 V(CmpConstantEqAndBranch) \ | |
| 83 V(CompareNumericAndBranch) \ | 77 V(CompareNumericAndBranch) \ |
| 84 V(CmpObjectEqAndBranch) \ | 78 V(CmpObjectEqAndBranch) \ |
| 85 V(CmpMapAndBranch) \ | 79 V(CmpMapAndBranch) \ |
| 86 V(CmpT) \ | 80 V(CmpT) \ |
| 87 V(ConstantD) \ | 81 V(ConstantD) \ |
| 88 V(ConstantI) \ | 82 V(ConstantI) \ |
| 89 V(ConstantS) \ | 83 V(ConstantS) \ |
| 90 V(ConstantT) \ | 84 V(ConstantT) \ |
| 91 V(Context) \ | 85 V(Context) \ |
| 86 V(DateField) \ |
| 92 V(DebugBreak) \ | 87 V(DebugBreak) \ |
| 93 V(DeclareGlobals) \ | 88 V(DeclareGlobals) \ |
| 94 V(Deoptimize) \ | 89 V(Deoptimize) \ |
| 95 V(DivI) \ | 90 V(DivI) \ |
| 96 V(DoubleToI) \ | 91 V(DoubleToI) \ |
| 97 V(DoubleToSmi) \ | 92 V(DoubleToSmi) \ |
| 93 V(Drop) \ |
| 98 V(DummyUse) \ | 94 V(DummyUse) \ |
| 99 V(ElementsKind) \ | 95 V(ElementsKind) \ |
| 96 V(ForInCacheArray) \ |
| 97 V(ForInPrepareMap) \ |
| 100 V(FunctionLiteral) \ | 98 V(FunctionLiteral) \ |
| 101 V(GetCachedArrayIndex) \ | 99 V(GetCachedArrayIndex) \ |
| 102 V(GlobalObject) \ | 100 V(GlobalObject) \ |
| 103 V(GlobalReceiver) \ | 101 V(GlobalReceiver) \ |
| 104 V(Goto) \ | 102 V(Goto) \ |
| 105 V(HasCachedArrayIndexAndBranch) \ | 103 V(HasCachedArrayIndexAndBranch) \ |
| 106 V(HasInstanceTypeAndBranch) \ | 104 V(HasInstanceTypeAndBranch) \ |
| 105 V(InnerAllocatedObject) \ |
| 107 V(InstanceOf) \ | 106 V(InstanceOf) \ |
| 108 V(InstanceOfKnownGlobal) \ | 107 V(InstanceOfKnownGlobal) \ |
| 109 V(InstanceSize) \ | 108 V(InstanceSize) \ |
| 110 V(InstructionGap) \ | 109 V(InstructionGap) \ |
| 111 V(Integer32ToDouble) \ | 110 V(Integer32ToDouble) \ |
| 112 V(Integer32ToSmi) \ | 111 V(Integer32ToSmi) \ |
| 113 V(Uint32ToDouble) \ | |
| 114 V(InvokeFunction) \ | 112 V(InvokeFunction) \ |
| 115 V(IsConstructCallAndBranch) \ | 113 V(IsConstructCallAndBranch) \ |
| 116 V(IsObjectAndBranch) \ | 114 V(IsObjectAndBranch) \ |
| 117 V(IsStringAndBranch) \ | 115 V(IsStringAndBranch) \ |
| 118 V(IsNumberAndBranch) \ | 116 V(IsNumberAndBranch) \ |
| 119 V(IsSmiAndBranch) \ | 117 V(IsSmiAndBranch) \ |
| 120 V(IsUndetectableAndBranch) \ | 118 V(IsUndetectableAndBranch) \ |
| 121 V(Label) \ | 119 V(Label) \ |
| 122 V(LazyBailout) \ | 120 V(LazyBailout) \ |
| 123 V(LinkObjectInList) \ | 121 V(LinkObjectInList) \ |
| 124 V(LoadContextSlot) \ | 122 V(LoadContextSlot) \ |
| 125 V(LoadExternalArrayPointer) \ | 123 V(LoadExternalArrayPointer) \ |
| 124 V(LoadFieldByIndex) \ |
| 126 V(LoadFunctionPrototype) \ | 125 V(LoadFunctionPrototype) \ |
| 127 V(LoadGlobalCell) \ | 126 V(LoadGlobalCell) \ |
| 128 V(LoadGlobalGeneric) \ | 127 V(LoadGlobalGeneric) \ |
| 129 V(LoadKeyed) \ | 128 V(LoadKeyed) \ |
| 130 V(LoadKeyedGeneric) \ | 129 V(LoadKeyedGeneric) \ |
| 131 V(LoadNamedField) \ | 130 V(LoadNamedField) \ |
| 132 V(LoadNamedFieldPolymorphic) \ | 131 V(LoadNamedFieldPolymorphic) \ |
| 133 V(LoadNamedGeneric) \ | 132 V(LoadNamedGeneric) \ |
| 134 V(MapEnumLength) \ | 133 V(MapEnumLength) \ |
| 135 V(MathAbs) \ | 134 V(MathAbs) \ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 V(StringLength) \ | 177 V(StringLength) \ |
| 179 V(SubI) \ | 178 V(SubI) \ |
| 180 V(TaggedToI) \ | 179 V(TaggedToI) \ |
| 181 V(ThisFunction) \ | 180 V(ThisFunction) \ |
| 182 V(Throw) \ | 181 V(Throw) \ |
| 183 V(ToFastProperties) \ | 182 V(ToFastProperties) \ |
| 184 V(TransitionElementsKind) \ | 183 V(TransitionElementsKind) \ |
| 185 V(TrapAllocationMemento) \ | 184 V(TrapAllocationMemento) \ |
| 186 V(Typeof) \ | 185 V(Typeof) \ |
| 187 V(TypeofIsAndBranch) \ | 186 V(TypeofIsAndBranch) \ |
| 187 V(Uint32ToDouble) \ |
| 188 V(UnknownOSRValue) \ | 188 V(UnknownOSRValue) \ |
| 189 V(ValueOf) \ | 189 V(ValueOf) \ |
| 190 V(ForInPrepareMap) \ | 190 V(WrapReceiver) |
| 191 V(ForInCacheArray) \ | |
| 192 V(CheckMapValue) \ | |
| 193 V(LoadFieldByIndex) \ | |
| 194 V(DateField) \ | |
| 195 V(WrapReceiver) \ | |
| 196 V(Drop) \ | |
| 197 V(InnerAllocatedObject) | |
| 198 | |
| 199 | 191 |
| 200 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 192 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 201 virtual Opcode opcode() const { return LInstruction::k##type; } \ | 193 virtual Opcode opcode() const { return LInstruction::k##type; } \ |
| 202 virtual void CompileToNative(LCodeGen* generator); \ | 194 virtual void CompileToNative(LCodeGen* generator); \ |
| 203 virtual const char* Mnemonic() const { return mnemonic; } \ | 195 virtual const char* Mnemonic() const { return mnemonic; } \ |
| 204 static L##type* cast(LInstruction* instr) { \ | 196 static L##type* cast(LInstruction* instr) { \ |
| 205 ASSERT(instr->Is##type()); \ | 197 ASSERT(instr->Is##type()); \ |
| 206 return reinterpret_cast<L##type*>(instr); \ | 198 return reinterpret_cast<L##type*>(instr); \ |
| 207 } | 199 } |
| 208 | 200 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 explicit LDummyUse(LOperand* value) { | 416 explicit LDummyUse(LOperand* value) { |
| 425 inputs_[0] = value; | 417 inputs_[0] = value; |
| 426 } | 418 } |
| 427 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use") | 419 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use") |
| 428 }; | 420 }; |
| 429 | 421 |
| 430 | 422 |
| 431 class LDeoptimize: public LTemplateInstruction<0, 0, 0> { | 423 class LDeoptimize: public LTemplateInstruction<0, 0, 0> { |
| 432 public: | 424 public: |
| 433 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") | 425 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") |
| 426 DECLARE_HYDROGEN_ACCESSOR(Deoptimize) |
| 434 }; | 427 }; |
| 435 | 428 |
| 436 | 429 |
| 437 class LLabel: public LGap { | 430 class LLabel: public LGap { |
| 438 public: | 431 public: |
| 439 explicit LLabel(HBasicBlock* block) | 432 explicit LLabel(HBasicBlock* block) |
| 440 : LGap(block), replacement_(NULL) { } | 433 : LGap(block), replacement_(NULL) { } |
| 441 | 434 |
| 442 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 435 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 443 DECLARE_CONCRETE_INSTRUCTION(Label, "label") | 436 DECLARE_CONCRETE_INSTRUCTION(Label, "label") |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 874 |
| 882 LOperand* left() { return inputs_[0]; } | 875 LOperand* left() { return inputs_[0]; } |
| 883 LOperand* right() { return inputs_[1]; } | 876 LOperand* right() { return inputs_[1]; } |
| 884 | 877 |
| 885 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, | 878 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, |
| 886 "cmp-object-eq-and-branch") | 879 "cmp-object-eq-and-branch") |
| 887 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch) | 880 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch) |
| 888 }; | 881 }; |
| 889 | 882 |
| 890 | 883 |
| 891 class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> { | |
| 892 public: | |
| 893 explicit LCmpConstantEqAndBranch(LOperand* left) { | |
| 894 inputs_[0] = left; | |
| 895 } | |
| 896 | |
| 897 LOperand* left() { return inputs_[0]; } | |
| 898 | |
| 899 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch, | |
| 900 "cmp-constant-eq-and-branch") | |
| 901 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch) | |
| 902 }; | |
| 903 | |
| 904 | |
| 905 class LIsObjectAndBranch: public LControlInstruction<1, 1> { | 884 class LIsObjectAndBranch: public LControlInstruction<1, 1> { |
| 906 public: | 885 public: |
| 907 LIsObjectAndBranch(LOperand* value, LOperand* temp) { | 886 LIsObjectAndBranch(LOperand* value, LOperand* temp) { |
| 908 inputs_[0] = value; | 887 inputs_[0] = value; |
| 909 temps_[0] = temp; | 888 temps_[0] = temp; |
| 910 } | 889 } |
| 911 | 890 |
| 912 LOperand* value() { return inputs_[0]; } | 891 LOperand* value() { return inputs_[0]; } |
| 913 LOperand* temp() { return temps_[0]; } | 892 LOperand* temp() { return temps_[0]; } |
| 914 | 893 |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 | 2201 |
| 2223 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") | 2202 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") |
| 2224 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) | 2203 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) |
| 2225 | 2204 |
| 2226 virtual void PrintDataTo(StringStream* stream); | 2205 virtual void PrintDataTo(StringStream* stream); |
| 2227 | 2206 |
| 2228 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } | 2207 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
| 2229 }; | 2208 }; |
| 2230 | 2209 |
| 2231 | 2210 |
| 2232 class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> { | 2211 class LTransitionElementsKind: public LTemplateInstruction<0, 1, 1> { |
| 2233 public: | 2212 public: |
| 2234 LTransitionElementsKind(LOperand* object, | 2213 LTransitionElementsKind(LOperand* object, |
| 2235 LOperand* new_map_temp, | 2214 LOperand* new_map_temp) { |
| 2236 LOperand* fixed_object_temp) { | |
| 2237 inputs_[0] = object; | 2215 inputs_[0] = object; |
| 2238 temps_[0] = new_map_temp; | 2216 temps_[0] = new_map_temp; |
| 2239 temps_[1] = fixed_object_temp; | |
| 2240 } | 2217 } |
| 2241 | 2218 |
| 2242 LOperand* object() { return inputs_[0]; } | 2219 LOperand* object() { return inputs_[0]; } |
| 2243 LOperand* new_map_temp() { return temps_[0]; } | 2220 LOperand* new_map_temp() { return temps_[0]; } |
| 2244 LOperand* temp() { return temps_[1]; } | |
| 2245 | 2221 |
| 2246 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, | 2222 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, |
| 2247 "transition-elements-kind") | 2223 "transition-elements-kind") |
| 2248 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) | 2224 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) |
| 2249 | 2225 |
| 2250 virtual void PrintDataTo(StringStream* stream); | 2226 virtual void PrintDataTo(StringStream* stream); |
| 2251 | 2227 |
| 2252 Handle<Map> original_map() { return hydrogen()->original_map(); } | 2228 Handle<Map> original_map() { return hydrogen()->original_map(); } |
| 2253 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } | 2229 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } |
| 2254 ElementsKind from_kind() { return hydrogen()->from_kind(); } | 2230 ElementsKind from_kind() { return hydrogen()->from_kind(); } |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 | 2772 |
| 2797 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2773 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2798 }; | 2774 }; |
| 2799 | 2775 |
| 2800 #undef DECLARE_HYDROGEN_ACCESSOR | 2776 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2801 #undef DECLARE_CONCRETE_INSTRUCTION | 2777 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2802 | 2778 |
| 2803 } } // namespace v8::internal | 2779 } } // namespace v8::internal |
| 2804 | 2780 |
| 2805 #endif // V8_MIPS_LITHIUM_MIPS_H_ | 2781 #endif // V8_MIPS_LITHIUM_MIPS_H_ |
| OLD | NEW |