OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 void Generate(MacroAssembler* masm); | 65 void Generate(MacroAssembler* masm); |
66 | 66 |
67 private: | 67 private: |
68 Register tos_; | 68 Register tos_; |
69 Major MajorKey() { return ToBoolean; } | 69 Major MajorKey() { return ToBoolean; } |
70 int MinorKey() { return tos_.code(); } | 70 int MinorKey() { return tos_.code(); } |
71 }; | 71 }; |
72 | 72 |
73 | 73 |
74 class TypeRecordingUnaryOpStub: public CodeStub { | 74 class UnaryOpStub: public CodeStub { |
75 public: | 75 public: |
76 TypeRecordingUnaryOpStub(Token::Value op, UnaryOverwriteMode mode) | 76 UnaryOpStub(Token::Value op, UnaryOverwriteMode mode) |
77 : op_(op), | 77 : op_(op), |
78 mode_(mode), | 78 mode_(mode), |
79 operand_type_(TRUnaryOpIC::UNINITIALIZED), | 79 operand_type_(UnaryOpIC::UNINITIALIZED), |
80 name_(NULL) { | 80 name_(NULL) { |
81 } | 81 } |
82 | 82 |
83 TypeRecordingUnaryOpStub( | 83 UnaryOpStub( |
84 int key, | 84 int key, |
85 TRUnaryOpIC::TypeInfo operand_type) | 85 UnaryOpIC::TypeInfo operand_type) |
86 : op_(OpBits::decode(key)), | 86 : op_(OpBits::decode(key)), |
87 mode_(ModeBits::decode(key)), | 87 mode_(ModeBits::decode(key)), |
88 operand_type_(operand_type), | 88 operand_type_(operand_type), |
89 name_(NULL) { | 89 name_(NULL) { |
90 } | 90 } |
91 | 91 |
92 private: | 92 private: |
93 Token::Value op_; | 93 Token::Value op_; |
94 UnaryOverwriteMode mode_; | 94 UnaryOverwriteMode mode_; |
95 | 95 |
96 // Operand type information determined at runtime. | 96 // Operand type information determined at runtime. |
97 TRUnaryOpIC::TypeInfo operand_type_; | 97 UnaryOpIC::TypeInfo operand_type_; |
98 | 98 |
99 char* name_; | 99 char* name_; |
100 | 100 |
101 const char* GetName(); | 101 const char* GetName(); |
102 | 102 |
103 #ifdef DEBUG | 103 #ifdef DEBUG |
104 void Print() { | 104 void Print() { |
105 PrintF("TypeRecordingUnaryOpStub %d (op %s), " | 105 PrintF("UnaryOpStub %d (op %s), " |
106 "(mode %d, runtime_type_info %s)\n", | 106 "(mode %d, runtime_type_info %s)\n", |
107 MinorKey(), | 107 MinorKey(), |
108 Token::String(op_), | 108 Token::String(op_), |
109 static_cast<int>(mode_), | 109 static_cast<int>(mode_), |
110 TRUnaryOpIC::GetName(operand_type_)); | 110 UnaryOpIC::GetName(operand_type_)); |
111 } | 111 } |
112 #endif | 112 #endif |
113 | 113 |
114 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; | 114 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
115 class OpBits: public BitField<Token::Value, 1, 7> {}; | 115 class OpBits: public BitField<Token::Value, 1, 7> {}; |
116 class OperandTypeInfoBits: public BitField<TRUnaryOpIC::TypeInfo, 8, 3> {}; | 116 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; |
117 | 117 |
118 Major MajorKey() { return TypeRecordingUnaryOp; } | 118 Major MajorKey() { return UnaryOp; } |
119 int MinorKey() { | 119 int MinorKey() { |
120 return ModeBits::encode(mode_) | 120 return ModeBits::encode(mode_) |
121 | OpBits::encode(op_) | 121 | OpBits::encode(op_) |
122 | OperandTypeInfoBits::encode(operand_type_); | 122 | OperandTypeInfoBits::encode(operand_type_); |
123 } | 123 } |
124 | 124 |
125 // Note: A lot of the helper functions below will vanish when we use virtual | 125 // Note: A lot of the helper functions below will vanish when we use virtual |
126 // function instead of switch more often. | 126 // function instead of switch more often. |
127 void Generate(MacroAssembler* masm); | 127 void Generate(MacroAssembler* masm); |
128 | 128 |
129 void GenerateTypeTransition(MacroAssembler* masm); | 129 void GenerateTypeTransition(MacroAssembler* masm); |
130 | 130 |
131 void GenerateSmiStub(MacroAssembler* masm); | 131 void GenerateSmiStub(MacroAssembler* masm); |
132 void GenerateSmiStubSub(MacroAssembler* masm); | 132 void GenerateSmiStubSub(MacroAssembler* masm); |
133 void GenerateSmiStubBitNot(MacroAssembler* masm); | 133 void GenerateSmiStubBitNot(MacroAssembler* masm); |
134 void GenerateSmiCodeSub(MacroAssembler* masm, Label* non_smi, Label* slow); | 134 void GenerateSmiCodeSub(MacroAssembler* masm, Label* non_smi, Label* slow); |
135 void GenerateSmiCodeBitNot(MacroAssembler* masm, Label* slow); | 135 void GenerateSmiCodeBitNot(MacroAssembler* masm, Label* slow); |
136 | 136 |
137 void GenerateHeapNumberStub(MacroAssembler* masm); | 137 void GenerateHeapNumberStub(MacroAssembler* masm); |
138 void GenerateHeapNumberStubSub(MacroAssembler* masm); | 138 void GenerateHeapNumberStubSub(MacroAssembler* masm); |
139 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); | 139 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); |
140 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); | 140 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); |
141 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); | 141 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); |
142 | 142 |
143 void GenerateGenericStub(MacroAssembler* masm); | 143 void GenerateGenericStub(MacroAssembler* masm); |
144 void GenerateGenericStubSub(MacroAssembler* masm); | 144 void GenerateGenericStubSub(MacroAssembler* masm); |
145 void GenerateGenericStubBitNot(MacroAssembler* masm); | 145 void GenerateGenericStubBitNot(MacroAssembler* masm); |
146 void GenerateGenericCodeFallback(MacroAssembler* masm); | 146 void GenerateGenericCodeFallback(MacroAssembler* masm); |
147 | 147 |
148 virtual int GetCodeKind() { return Code::TYPE_RECORDING_UNARY_OP_IC; } | 148 virtual int GetCodeKind() { return Code::UNARY_OP_IC; } |
149 | 149 |
150 virtual InlineCacheState GetICState() { | 150 virtual InlineCacheState GetICState() { |
151 return TRUnaryOpIC::ToState(operand_type_); | 151 return UnaryOpIC::ToState(operand_type_); |
152 } | 152 } |
153 | 153 |
154 virtual void FinishCode(Code* code) { | 154 virtual void FinishCode(Code* code) { |
155 code->set_type_recording_unary_op_type(operand_type_); | 155 code->set_unary_op_type(operand_type_); |
156 } | 156 } |
157 }; | 157 }; |
158 | 158 |
159 | 159 |
160 class TypeRecordingBinaryOpStub: public CodeStub { | 160 class BinaryOpStub: public CodeStub { |
161 public: | 161 public: |
162 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) | 162 BinaryOpStub(Token::Value op, OverwriteMode mode) |
163 : op_(op), | 163 : op_(op), |
164 mode_(mode), | 164 mode_(mode), |
165 operands_type_(TRBinaryOpIC::UNINITIALIZED), | 165 operands_type_(BinaryOpIC::UNINITIALIZED), |
166 result_type_(TRBinaryOpIC::UNINITIALIZED), | 166 result_type_(BinaryOpIC::UNINITIALIZED), |
167 name_(NULL) { | 167 name_(NULL) { |
168 use_vfp3_ = CpuFeatures::IsSupported(VFP3); | 168 use_vfp3_ = CpuFeatures::IsSupported(VFP3); |
169 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | 169 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
170 } | 170 } |
171 | 171 |
172 TypeRecordingBinaryOpStub( | 172 BinaryOpStub( |
173 int key, | 173 int key, |
174 TRBinaryOpIC::TypeInfo operands_type, | 174 BinaryOpIC::TypeInfo operands_type, |
175 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED) | 175 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) |
176 : op_(OpBits::decode(key)), | 176 : op_(OpBits::decode(key)), |
177 mode_(ModeBits::decode(key)), | 177 mode_(ModeBits::decode(key)), |
178 use_vfp3_(VFP3Bits::decode(key)), | 178 use_vfp3_(VFP3Bits::decode(key)), |
179 operands_type_(operands_type), | 179 operands_type_(operands_type), |
180 result_type_(result_type), | 180 result_type_(result_type), |
181 name_(NULL) { } | 181 name_(NULL) { } |
182 | 182 |
183 private: | 183 private: |
184 enum SmiCodeGenerateHeapNumberResults { | 184 enum SmiCodeGenerateHeapNumberResults { |
185 ALLOW_HEAPNUMBER_RESULTS, | 185 ALLOW_HEAPNUMBER_RESULTS, |
186 NO_HEAPNUMBER_RESULTS | 186 NO_HEAPNUMBER_RESULTS |
187 }; | 187 }; |
188 | 188 |
189 Token::Value op_; | 189 Token::Value op_; |
190 OverwriteMode mode_; | 190 OverwriteMode mode_; |
191 bool use_vfp3_; | 191 bool use_vfp3_; |
192 | 192 |
193 // Operand type information determined at runtime. | 193 // Operand type information determined at runtime. |
194 TRBinaryOpIC::TypeInfo operands_type_; | 194 BinaryOpIC::TypeInfo operands_type_; |
195 TRBinaryOpIC::TypeInfo result_type_; | 195 BinaryOpIC::TypeInfo result_type_; |
196 | 196 |
197 char* name_; | 197 char* name_; |
198 | 198 |
199 const char* GetName(); | 199 const char* GetName(); |
200 | 200 |
201 #ifdef DEBUG | 201 #ifdef DEBUG |
202 void Print() { | 202 void Print() { |
203 PrintF("TypeRecordingBinaryOpStub %d (op %s), " | 203 PrintF("BinaryOpStub %d (op %s), " |
204 "(mode %d, runtime_type_info %s)\n", | 204 "(mode %d, runtime_type_info %s)\n", |
205 MinorKey(), | 205 MinorKey(), |
206 Token::String(op_), | 206 Token::String(op_), |
207 static_cast<int>(mode_), | 207 static_cast<int>(mode_), |
208 TRBinaryOpIC::GetName(operands_type_)); | 208 BinaryOpIC::GetName(operands_type_)); |
209 } | 209 } |
210 #endif | 210 #endif |
211 | 211 |
212 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. | 212 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. |
213 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | 213 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
214 class OpBits: public BitField<Token::Value, 2, 7> {}; | 214 class OpBits: public BitField<Token::Value, 2, 7> {}; |
215 class VFP3Bits: public BitField<bool, 9, 1> {}; | 215 class VFP3Bits: public BitField<bool, 9, 1> {}; |
216 class OperandTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 10, 3> {}; | 216 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {}; |
217 class ResultTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 13, 3> {}; | 217 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {}; |
218 | 218 |
219 Major MajorKey() { return TypeRecordingBinaryOp; } | 219 Major MajorKey() { return BinaryOp; } |
220 int MinorKey() { | 220 int MinorKey() { |
221 return OpBits::encode(op_) | 221 return OpBits::encode(op_) |
222 | ModeBits::encode(mode_) | 222 | ModeBits::encode(mode_) |
223 | VFP3Bits::encode(use_vfp3_) | 223 | VFP3Bits::encode(use_vfp3_) |
224 | OperandTypeInfoBits::encode(operands_type_) | 224 | OperandTypeInfoBits::encode(operands_type_) |
225 | ResultTypeInfoBits::encode(result_type_); | 225 | ResultTypeInfoBits::encode(result_type_); |
226 } | 226 } |
227 | 227 |
228 void Generate(MacroAssembler* masm); | 228 void Generate(MacroAssembler* masm); |
229 void GenerateGeneric(MacroAssembler* masm); | 229 void GenerateGeneric(MacroAssembler* masm); |
(...skipping 22 matching lines...) Expand all Loading... |
252 void GenerateHeapResultAllocation(MacroAssembler* masm, | 252 void GenerateHeapResultAllocation(MacroAssembler* masm, |
253 Register result, | 253 Register result, |
254 Register heap_number_map, | 254 Register heap_number_map, |
255 Register scratch1, | 255 Register scratch1, |
256 Register scratch2, | 256 Register scratch2, |
257 Label* gc_required); | 257 Label* gc_required); |
258 void GenerateRegisterArgsPush(MacroAssembler* masm); | 258 void GenerateRegisterArgsPush(MacroAssembler* masm); |
259 void GenerateTypeTransition(MacroAssembler* masm); | 259 void GenerateTypeTransition(MacroAssembler* masm); |
260 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); | 260 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); |
261 | 261 |
262 virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; } | 262 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } |
263 | 263 |
264 virtual InlineCacheState GetICState() { | 264 virtual InlineCacheState GetICState() { |
265 return TRBinaryOpIC::ToState(operands_type_); | 265 return BinaryOpIC::ToState(operands_type_); |
266 } | 266 } |
267 | 267 |
268 virtual void FinishCode(Code* code) { | 268 virtual void FinishCode(Code* code) { |
269 code->set_type_recording_binary_op_type(operands_type_); | 269 code->set_binary_op_type(operands_type_); |
270 code->set_type_recording_binary_op_result_type(result_type_); | 270 code->set_binary_op_result_type(result_type_); |
271 } | 271 } |
272 | 272 |
273 friend class CodeGenerator; | 273 friend class CodeGenerator; |
274 }; | 274 }; |
275 | 275 |
276 | 276 |
277 // Flag that indicates how to generate code for the stub StringAddStub. | 277 // Flag that indicates how to generate code for the stub StringAddStub. |
278 enum StringAddFlags { | 278 enum StringAddFlags { |
279 NO_STRING_ADD_FLAGS = 0, | 279 NO_STRING_ADD_FLAGS = 0, |
280 // Omit left string check in stub (left is definitely a string). | 280 // Omit left string check in stub (left is definitely a string). |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 664 |
665 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 665 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
666 | 666 |
667 LookupMode mode_; | 667 LookupMode mode_; |
668 }; | 668 }; |
669 | 669 |
670 | 670 |
671 } } // namespace v8::internal | 671 } } // namespace v8::internal |
672 | 672 |
673 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 673 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
OLD | NEW |