| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 OverwriteMode mode, | 70 OverwriteMode mode, |
| 71 Register lhs, | 71 Register lhs, |
| 72 Register rhs, | 72 Register rhs, |
| 73 int constant_rhs = kUnknownIntValue) | 73 int constant_rhs = kUnknownIntValue) |
| 74 : op_(op), | 74 : op_(op), |
| 75 mode_(mode), | 75 mode_(mode), |
| 76 lhs_(lhs), | 76 lhs_(lhs), |
| 77 rhs_(rhs), | 77 rhs_(rhs), |
| 78 constant_rhs_(constant_rhs), | 78 constant_rhs_(constant_rhs), |
| 79 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)), | 79 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)), |
| 80 runtime_operands_type_(BinaryOpIC::DEFAULT), | 80 runtime_operands_type_(BinaryOpIC::UNINIT_OR_SMI), |
| 81 name_(NULL) { } | 81 name_(NULL) { } |
| 82 | 82 |
| 83 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) | 83 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) |
| 84 : op_(OpBits::decode(key)), | 84 : op_(OpBits::decode(key)), |
| 85 mode_(ModeBits::decode(key)), | 85 mode_(ModeBits::decode(key)), |
| 86 lhs_(LhsRegister(RegisterBits::decode(key))), | 86 lhs_(LhsRegister(RegisterBits::decode(key))), |
| 87 rhs_(RhsRegister(RegisterBits::decode(key))), | 87 rhs_(RhsRegister(RegisterBits::decode(key))), |
| 88 constant_rhs_(KnownBitsForMinorKey(KnownIntBits::decode(key))), | 88 constant_rhs_(KnownBitsForMinorKey(KnownIntBits::decode(key))), |
| 89 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op_, constant_rhs_)), | 89 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op_, constant_rhs_)), |
| 90 runtime_operands_type_(type_info), | 90 runtime_operands_type_(type_info), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 Register LhsRegister(bool lhs_is_r0) { | 173 Register LhsRegister(bool lhs_is_r0) { |
| 174 return lhs_is_r0 ? r0 : r1; | 174 return lhs_is_r0 ? r0 : r1; |
| 175 } | 175 } |
| 176 | 176 |
| 177 Register RhsRegister(bool lhs_is_r0) { | 177 Register RhsRegister(bool lhs_is_r0) { |
| 178 return lhs_is_r0 ? r1 : r0; | 178 return lhs_is_r0 ? r1 : r0; |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool HasSmiSmiFastPath() { |
| 182 return op_ != Token::DIV; |
| 183 } |
| 184 |
| 181 bool ShouldGenerateSmiCode() { | 185 bool ShouldGenerateSmiCode() { |
| 182 return ((op_ != Token::DIV && op_ != Token::MOD) || specialized_on_rhs_) && | 186 return ((op_ != Token::DIV && op_ != Token::MOD) || specialized_on_rhs_) && |
| 183 runtime_operands_type_ != BinaryOpIC::HEAP_NUMBERS && | 187 runtime_operands_type_ != BinaryOpIC::HEAP_NUMBERS && |
| 184 runtime_operands_type_ != BinaryOpIC::STRINGS; | 188 runtime_operands_type_ != BinaryOpIC::STRINGS; |
| 185 } | 189 } |
| 186 | 190 |
| 187 bool ShouldGenerateFPCode() { | 191 bool ShouldGenerateFPCode() { |
| 188 return runtime_operands_type_ != BinaryOpIC::STRINGS; | 192 return runtime_operands_type_ != BinaryOpIC::STRINGS; |
| 189 } | 193 } |
| 190 | 194 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 private: | 434 private: |
| 431 Major MajorKey() { return NumberToString; } | 435 Major MajorKey() { return NumberToString; } |
| 432 int MinorKey() { return 0; } | 436 int MinorKey() { return 0; } |
| 433 | 437 |
| 434 void Generate(MacroAssembler* masm); | 438 void Generate(MacroAssembler* masm); |
| 435 | 439 |
| 436 const char* GetName() { return "NumberToStringStub"; } | 440 const char* GetName() { return "NumberToStringStub"; } |
| 437 }; | 441 }; |
| 438 | 442 |
| 439 | 443 |
| 440 class RecordWriteStub : public CodeStub { | |
| 441 public: | |
| 442 RecordWriteStub(Register object, Register offset, Register scratch) | |
| 443 : object_(object), offset_(offset), scratch_(scratch) { } | |
| 444 | |
| 445 void Generate(MacroAssembler* masm); | |
| 446 | |
| 447 private: | |
| 448 Register object_; | |
| 449 Register offset_; | |
| 450 Register scratch_; | |
| 451 | |
| 452 // Minor key encoding in 12 bits. 4 bits for each of the three | |
| 453 // registers (object, offset and scratch) OOOOAAAASSSS. | |
| 454 class ScratchBits: public BitField<uint32_t, 0, 4> {}; | |
| 455 class OffsetBits: public BitField<uint32_t, 4, 4> {}; | |
| 456 class ObjectBits: public BitField<uint32_t, 8, 4> {}; | |
| 457 | |
| 458 Major MajorKey() { return RecordWrite; } | |
| 459 | |
| 460 int MinorKey() { | |
| 461 // Encode the registers. | |
| 462 return ObjectBits::encode(object_.code()) | | |
| 463 OffsetBits::encode(offset_.code()) | | |
| 464 ScratchBits::encode(scratch_.code()); | |
| 465 } | |
| 466 | |
| 467 #ifdef DEBUG | |
| 468 void Print() { | |
| 469 PrintF("RecordWriteStub (object reg %d), (offset reg %d)," | |
| 470 " (scratch reg %d)\n", | |
| 471 object_.code(), offset_.code(), scratch_.code()); | |
| 472 } | |
| 473 #endif | |
| 474 }; | |
| 475 | |
| 476 | |
| 477 // Enter C code from generated RegExp code in a way that allows | 444 // Enter C code from generated RegExp code in a way that allows |
| 478 // the C code to fix the return address in case of a GC. | 445 // the C code to fix the return address in case of a GC. |
| 479 // Currently only needed on ARM. | 446 // Currently only needed on ARM. |
| 480 class RegExpCEntryStub: public CodeStub { | 447 class RegExpCEntryStub: public CodeStub { |
| 481 public: | 448 public: |
| 482 RegExpCEntryStub() {} | 449 RegExpCEntryStub() {} |
| 483 virtual ~RegExpCEntryStub() {} | 450 virtual ~RegExpCEntryStub() {} |
| 484 void Generate(MacroAssembler* masm); | 451 void Generate(MacroAssembler* masm); |
| 485 | 452 |
| 486 private: | 453 private: |
| 487 Major MajorKey() { return RegExpCEntry; } | 454 Major MajorKey() { return RegExpCEntry; } |
| 488 int MinorKey() { return 0; } | 455 int MinorKey() { return 0; } |
| 489 const char* GetName() { return "RegExpCEntryStub"; } | 456 const char* GetName() { return "RegExpCEntryStub"; } |
| 490 }; | 457 }; |
| 491 | 458 |
| 492 | 459 |
| 493 } } // namespace v8::internal | 460 } } // namespace v8::internal |
| 494 | 461 |
| 495 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 462 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
| OLD | NEW |