OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } else { | 211 } else { |
212 PrintF("GenericBinaryOpStub (%s by %d)\n", | 212 PrintF("GenericBinaryOpStub (%s by %d)\n", |
213 Token::String(op_), | 213 Token::String(op_), |
214 constant_rhs_); | 214 constant_rhs_); |
215 } | 215 } |
216 } | 216 } |
217 #endif | 217 #endif |
218 }; | 218 }; |
219 | 219 |
220 | 220 |
| 221 class TypeRecordingBinaryOpStub: public CodeStub { |
| 222 public: |
| 223 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) |
| 224 : op_(op), |
| 225 mode_(mode), |
| 226 operands_type_(TRBinaryOpIC::UNINITIALIZED), |
| 227 result_type_(TRBinaryOpIC::UNINITIALIZED), |
| 228 name_(NULL) { |
| 229 use_vfp3_ = CpuFeatures::IsSupported(VFP3); |
| 230 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
| 231 } |
| 232 |
| 233 TypeRecordingBinaryOpStub( |
| 234 int key, |
| 235 TRBinaryOpIC::TypeInfo operands_type, |
| 236 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED) |
| 237 : op_(OpBits::decode(key)), |
| 238 mode_(ModeBits::decode(key)), |
| 239 use_vfp3_(VFP3Bits::decode(key)), |
| 240 operands_type_(operands_type), |
| 241 result_type_(result_type), |
| 242 name_(NULL) { } |
| 243 |
| 244 private: |
| 245 enum SmiCodeGenerateHeapNumberResults { |
| 246 ALLOW_HEAPNUMBER_RESULTS, |
| 247 NO_HEAPNUMBER_RESULTS |
| 248 }; |
| 249 |
| 250 Token::Value op_; |
| 251 OverwriteMode mode_; |
| 252 bool use_vfp3_; |
| 253 |
| 254 // Operand type information determined at runtime. |
| 255 TRBinaryOpIC::TypeInfo operands_type_; |
| 256 TRBinaryOpIC::TypeInfo result_type_; |
| 257 |
| 258 char* name_; |
| 259 |
| 260 const char* GetName(); |
| 261 |
| 262 #ifdef DEBUG |
| 263 void Print() { |
| 264 PrintF("TypeRecordingBinaryOpStub %d (op %s), " |
| 265 "(mode %d, runtime_type_info %s)\n", |
| 266 MinorKey(), |
| 267 Token::String(op_), |
| 268 static_cast<int>(mode_), |
| 269 TRBinaryOpIC::GetName(operands_type_)); |
| 270 } |
| 271 #endif |
| 272 |
| 273 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. |
| 274 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
| 275 class OpBits: public BitField<Token::Value, 2, 7> {}; |
| 276 class VFP3Bits: public BitField<bool, 9, 1> {}; |
| 277 class OperandTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 10, 3> {}; |
| 278 class ResultTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 13, 3> {}; |
| 279 |
| 280 Major MajorKey() { return TypeRecordingBinaryOp; } |
| 281 int MinorKey() { |
| 282 return OpBits::encode(op_) |
| 283 | ModeBits::encode(mode_) |
| 284 | VFP3Bits::encode(use_vfp3_) |
| 285 | OperandTypeInfoBits::encode(operands_type_) |
| 286 | ResultTypeInfoBits::encode(result_type_); |
| 287 } |
| 288 |
| 289 void Generate(MacroAssembler* masm); |
| 290 void GenerateGeneric(MacroAssembler* masm); |
| 291 void GenerateSmiCode(MacroAssembler* masm, |
| 292 Label* gc_required, |
| 293 SmiCodeGenerateHeapNumberResults heapnumber_results); |
| 294 void GenerateLoadArguments(MacroAssembler* masm); |
| 295 void GenerateReturn(MacroAssembler* masm); |
| 296 void GenerateUninitializedStub(MacroAssembler* masm); |
| 297 void GenerateSmiStub(MacroAssembler* masm); |
| 298 void GenerateInt32Stub(MacroAssembler* masm); |
| 299 void GenerateHeapNumberStub(MacroAssembler* masm); |
| 300 void GenerateStringStub(MacroAssembler* masm); |
| 301 void GenerateGenericStub(MacroAssembler* masm); |
| 302 void GenerateAddStrings(MacroAssembler* masm); |
| 303 void GenerateCallRuntime(MacroAssembler* masm); |
| 304 |
| 305 void GenerateHeapResultAllocation(MacroAssembler* masm, |
| 306 Register result, |
| 307 Register heap_number_map, |
| 308 Register scratch1, |
| 309 Register scratch2, |
| 310 Label* gc_required); |
| 311 void GenerateRegisterArgsPush(MacroAssembler* masm); |
| 312 void GenerateTypeTransition(MacroAssembler* masm); |
| 313 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); |
| 314 |
| 315 virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; } |
| 316 |
| 317 virtual InlineCacheState GetICState() { |
| 318 return TRBinaryOpIC::ToState(operands_type_); |
| 319 } |
| 320 |
| 321 virtual void FinishCode(Code* code) { |
| 322 code->set_type_recording_binary_op_type(operands_type_); |
| 323 code->set_type_recording_binary_op_result_type(result_type_); |
| 324 } |
| 325 |
| 326 friend class CodeGenerator; |
| 327 }; |
| 328 |
| 329 |
221 // Flag that indicates how to generate code for the stub StringAddStub. | 330 // Flag that indicates how to generate code for the stub StringAddStub. |
222 enum StringAddFlags { | 331 enum StringAddFlags { |
223 NO_STRING_ADD_FLAGS = 0, | 332 NO_STRING_ADD_FLAGS = 0, |
224 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. | 333 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. |
225 }; | 334 }; |
226 | 335 |
227 | 336 |
228 class StringAddStub: public CodeStub { | 337 class StringAddStub: public CodeStub { |
229 public: | 338 public: |
230 explicit StringAddStub(StringAddFlags flags) { | 339 explicit StringAddStub(StringAddFlags flags) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 private: | 562 private: |
454 Major MajorKey() { return RegExpCEntry; } | 563 Major MajorKey() { return RegExpCEntry; } |
455 int MinorKey() { return 0; } | 564 int MinorKey() { return 0; } |
456 const char* GetName() { return "RegExpCEntryStub"; } | 565 const char* GetName() { return "RegExpCEntryStub"; } |
457 }; | 566 }; |
458 | 567 |
459 | 568 |
460 } } // namespace v8::internal | 569 } } // namespace v8::internal |
461 | 570 |
462 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 571 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
OLD | NEW |