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(CheckNonSmi) \ | 68 V(CheckNonSmi) \ |
75 V(CheckMaps) \ | 69 V(CheckMaps) \ |
| 70 V(CheckMapValue) \ |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 V(SubI) \ | 179 V(SubI) \ |
181 V(RSubI) \ | 180 V(RSubI) \ |
182 V(TaggedToI) \ | 181 V(TaggedToI) \ |
183 V(ThisFunction) \ | 182 V(ThisFunction) \ |
184 V(Throw) \ | 183 V(Throw) \ |
185 V(ToFastProperties) \ | 184 V(ToFastProperties) \ |
186 V(TransitionElementsKind) \ | 185 V(TransitionElementsKind) \ |
187 V(TrapAllocationMemento) \ | 186 V(TrapAllocationMemento) \ |
188 V(Typeof) \ | 187 V(Typeof) \ |
189 V(TypeofIsAndBranch) \ | 188 V(TypeofIsAndBranch) \ |
| 189 V(Uint32ToDouble) \ |
190 V(UnknownOSRValue) \ | 190 V(UnknownOSRValue) \ |
191 V(ValueOf) \ | 191 V(ValueOf) \ |
192 V(ForInPrepareMap) \ | 192 V(WrapReceiver) |
193 V(ForInCacheArray) \ | |
194 V(CheckMapValue) \ | |
195 V(LoadFieldByIndex) \ | |
196 V(DateField) \ | |
197 V(WrapReceiver) \ | |
198 V(Drop) \ | |
199 V(InnerAllocatedObject) | |
200 | 193 |
201 | 194 |
202 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 195 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
203 virtual Opcode opcode() const { return LInstruction::k##type; } \ | 196 virtual Opcode opcode() const { return LInstruction::k##type; } \ |
204 virtual void CompileToNative(LCodeGen* generator); \ | 197 virtual void CompileToNative(LCodeGen* generator); \ |
205 virtual const char* Mnemonic() const { return mnemonic; } \ | 198 virtual const char* Mnemonic() const { return mnemonic; } \ |
206 static L##type* cast(LInstruction* instr) { \ | 199 static L##type* cast(LInstruction* instr) { \ |
207 ASSERT(instr->Is##type()); \ | 200 ASSERT(instr->Is##type()); \ |
208 return reinterpret_cast<L##type*>(instr); \ | 201 return reinterpret_cast<L##type*>(instr); \ |
209 } | 202 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 explicit LDummyUse(LOperand* value) { | 419 explicit LDummyUse(LOperand* value) { |
427 inputs_[0] = value; | 420 inputs_[0] = value; |
428 } | 421 } |
429 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use") | 422 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use") |
430 }; | 423 }; |
431 | 424 |
432 | 425 |
433 class LDeoptimize: public LTemplateInstruction<0, 0, 0> { | 426 class LDeoptimize: public LTemplateInstruction<0, 0, 0> { |
434 public: | 427 public: |
435 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") | 428 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") |
| 429 DECLARE_HYDROGEN_ACCESSOR(Deoptimize) |
436 }; | 430 }; |
437 | 431 |
438 | 432 |
439 class LLabel: public LGap { | 433 class LLabel: public LGap { |
440 public: | 434 public: |
441 explicit LLabel(HBasicBlock* block) | 435 explicit LLabel(HBasicBlock* block) |
442 : LGap(block), replacement_(NULL) { } | 436 : LGap(block), replacement_(NULL) { } |
443 | 437 |
444 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 438 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
445 DECLARE_CONCRETE_INSTRUCTION(Label, "label") | 439 DECLARE_CONCRETE_INSTRUCTION(Label, "label") |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 881 |
888 LOperand* left() { return inputs_[0]; } | 882 LOperand* left() { return inputs_[0]; } |
889 LOperand* right() { return inputs_[1]; } | 883 LOperand* right() { return inputs_[1]; } |
890 | 884 |
891 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, | 885 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, |
892 "cmp-object-eq-and-branch") | 886 "cmp-object-eq-and-branch") |
893 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch) | 887 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch) |
894 }; | 888 }; |
895 | 889 |
896 | 890 |
897 class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> { | |
898 public: | |
899 explicit LCmpConstantEqAndBranch(LOperand* left) { | |
900 inputs_[0] = left; | |
901 } | |
902 | |
903 LOperand* left() { return inputs_[0]; } | |
904 | |
905 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch, | |
906 "cmp-constant-eq-and-branch") | |
907 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch) | |
908 }; | |
909 | |
910 | |
911 class LIsObjectAndBranch: public LControlInstruction<1, 1> { | 891 class LIsObjectAndBranch: public LControlInstruction<1, 1> { |
912 public: | 892 public: |
913 LIsObjectAndBranch(LOperand* value, LOperand* temp) { | 893 LIsObjectAndBranch(LOperand* value, LOperand* temp) { |
914 inputs_[0] = value; | 894 inputs_[0] = value; |
915 temps_[0] = temp; | 895 temps_[0] = temp; |
916 } | 896 } |
917 | 897 |
918 LOperand* value() { return inputs_[0]; } | 898 LOperand* value() { return inputs_[0]; } |
919 LOperand* temp() { return temps_[0]; } | 899 LOperand* temp() { return temps_[0]; } |
920 | 900 |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 | 2229 |
2250 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") | 2230 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") |
2251 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) | 2231 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) |
2252 | 2232 |
2253 virtual void PrintDataTo(StringStream* stream); | 2233 virtual void PrintDataTo(StringStream* stream); |
2254 | 2234 |
2255 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } | 2235 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
2256 }; | 2236 }; |
2257 | 2237 |
2258 | 2238 |
2259 class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> { | 2239 class LTransitionElementsKind: public LTemplateInstruction<0, 1, 1> { |
2260 public: | 2240 public: |
2261 LTransitionElementsKind(LOperand* object, | 2241 LTransitionElementsKind(LOperand* object, |
2262 LOperand* new_map_temp, | 2242 LOperand* new_map_temp) { |
2263 LOperand* fixed_object_temp) { | |
2264 inputs_[0] = object; | 2243 inputs_[0] = object; |
2265 temps_[0] = new_map_temp; | 2244 temps_[0] = new_map_temp; |
2266 temps_[1] = fixed_object_temp; | |
2267 } | 2245 } |
2268 | 2246 |
2269 LOperand* object() { return inputs_[0]; } | 2247 LOperand* object() { return inputs_[0]; } |
2270 LOperand* new_map_temp() { return temps_[0]; } | 2248 LOperand* new_map_temp() { return temps_[0]; } |
2271 LOperand* temp() { return temps_[1]; } | |
2272 | 2249 |
2273 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, | 2250 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, |
2274 "transition-elements-kind") | 2251 "transition-elements-kind") |
2275 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) | 2252 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) |
2276 | 2253 |
2277 virtual void PrintDataTo(StringStream* stream); | 2254 virtual void PrintDataTo(StringStream* stream); |
2278 | 2255 |
2279 Handle<Map> original_map() { return hydrogen()->original_map(); } | 2256 Handle<Map> original_map() { return hydrogen()->original_map(); } |
2280 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } | 2257 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } |
2281 ElementsKind from_kind() { return hydrogen()->from_kind(); } | 2258 ElementsKind from_kind() { return hydrogen()->from_kind(); } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 inputs_[0] = value; | 2410 inputs_[0] = value; |
2434 } | 2411 } |
2435 | 2412 |
2436 LOperand* value() { return inputs_[0]; } | 2413 LOperand* value() { return inputs_[0]; } |
2437 | 2414 |
2438 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | 2415 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
2439 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) | 2416 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) |
2440 }; | 2417 }; |
2441 | 2418 |
2442 | 2419 |
2443 class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { | 2420 class LClampDToUint8: public LTemplateInstruction<1, 1, 0> { |
2444 public: | 2421 public: |
2445 LClampDToUint8(LOperand* unclamped, LOperand* temp) { | 2422 explicit LClampDToUint8(LOperand* unclamped) { |
2446 inputs_[0] = unclamped; | 2423 inputs_[0] = unclamped; |
2447 temps_[0] = temp; | |
2448 } | 2424 } |
2449 | 2425 |
2450 LOperand* unclamped() { return inputs_[0]; } | 2426 LOperand* unclamped() { return inputs_[0]; } |
2451 LOperand* temp() { return temps_[0]; } | |
2452 | 2427 |
2453 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8") | 2428 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8") |
2454 }; | 2429 }; |
2455 | 2430 |
2456 | 2431 |
2457 class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { | 2432 class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { |
2458 public: | 2433 public: |
2459 explicit LClampIToUint8(LOperand* unclamped) { | 2434 explicit LClampIToUint8(LOperand* unclamped) { |
2460 inputs_[0] = unclamped; | 2435 inputs_[0] = unclamped; |
2461 } | 2436 } |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2824 | 2799 |
2825 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2800 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2826 }; | 2801 }; |
2827 | 2802 |
2828 #undef DECLARE_HYDROGEN_ACCESSOR | 2803 #undef DECLARE_HYDROGEN_ACCESSOR |
2829 #undef DECLARE_CONCRETE_INSTRUCTION | 2804 #undef DECLARE_CONCRETE_INSTRUCTION |
2830 | 2805 |
2831 } } // namespace v8::internal | 2806 } } // namespace v8::internal |
2832 | 2807 |
2833 #endif // V8_ARM_LITHIUM_ARM_H_ | 2808 #endif // V8_ARM_LITHIUM_ARM_H_ |
OLD | NEW |