| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 TranscendentalCache::Type type_; | 51 TranscendentalCache::Type type_; |
| 52 ArgumentType argument_type_; | 52 ArgumentType argument_type_; |
| 53 void GenerateCallCFunction(MacroAssembler* masm, Register scratch); | 53 void GenerateCallCFunction(MacroAssembler* masm, Register scratch); |
| 54 | 54 |
| 55 Major MajorKey() { return TranscendentalCache; } | 55 Major MajorKey() { return TranscendentalCache; } |
| 56 int MinorKey() { return type_ | argument_type_; } | 56 int MinorKey() { return type_ | argument_type_; } |
| 57 Runtime::FunctionId RuntimeFunction(); | 57 Runtime::FunctionId RuntimeFunction(); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 | 60 |
| 61 class ToBooleanStub: public CodeStub { | |
| 62 public: | |
| 63 explicit ToBooleanStub(Register tos) : tos_(tos) { } | |
| 64 | |
| 65 void Generate(MacroAssembler* masm); | |
| 66 | |
| 67 private: | |
| 68 Register tos_; | |
| 69 Major MajorKey() { return ToBoolean; } | |
| 70 int MinorKey() { return tos_.code(); } | |
| 71 }; | |
| 72 | |
| 73 | |
| 74 class StoreBufferOverflowStub: public CodeStub { | 61 class StoreBufferOverflowStub: public CodeStub { |
| 75 public: | 62 public: |
| 76 explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp) | 63 explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp) |
| 77 : save_doubles_(save_fp) { } | 64 : save_doubles_(save_fp) { } |
| 78 | 65 |
| 79 void Generate(MacroAssembler* masm); | 66 void Generate(MacroAssembler* masm); |
| 80 | 67 |
| 81 private: | 68 private: |
| 82 SaveFPRegsMode save_doubles_; | 69 SaveFPRegsMode save_doubles_; |
| 83 | 70 |
| 84 Major MajorKey() { return StoreBufferOverflow; } | 71 Major MajorKey() { return StoreBufferOverflow; } |
| 85 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | 72 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } |
| 86 }; | 73 }; |
| 87 | 74 |
| 88 | 75 |
| 89 class UnaryOpStub: public CodeStub { | 76 class UnaryOpStub: public CodeStub { |
| 90 public: | 77 public: |
| 91 UnaryOpStub(Token::Value op, UnaryOverwriteMode mode) | 78 UnaryOpStub(Token::Value op, |
| 79 UnaryOverwriteMode mode, |
| 80 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) |
| 92 : op_(op), | 81 : op_(op), |
| 93 mode_(mode), | 82 mode_(mode), |
| 94 operand_type_(UnaryOpIC::UNINITIALIZED), | |
| 95 name_(NULL) { | |
| 96 } | |
| 97 | |
| 98 UnaryOpStub( | |
| 99 int key, | |
| 100 UnaryOpIC::TypeInfo operand_type) | |
| 101 : op_(OpBits::decode(key)), | |
| 102 mode_(ModeBits::decode(key)), | |
| 103 operand_type_(operand_type), | 83 operand_type_(operand_type), |
| 104 name_(NULL) { | 84 name_(NULL) { |
| 105 } | 85 } |
| 106 | 86 |
| 107 private: | 87 private: |
| 108 Token::Value op_; | 88 Token::Value op_; |
| 109 UnaryOverwriteMode mode_; | 89 UnaryOverwriteMode mode_; |
| 110 | 90 |
| 111 // Operand type information determined at runtime. | 91 // Operand type information determined at runtime. |
| 112 UnaryOpIC::TypeInfo operand_type_; | 92 UnaryOpIC::TypeInfo operand_type_; |
| 113 | 93 |
| 114 char* name_; | 94 char* name_; |
| 115 | 95 |
| 116 const char* GetName(); | 96 virtual const char* GetName(); |
| 117 | 97 |
| 118 #ifdef DEBUG | 98 #ifdef DEBUG |
| 119 void Print() { | 99 void Print() { |
| 120 PrintF("UnaryOpStub %d (op %s), " | 100 PrintF("UnaryOpStub %d (op %s), (mode %d, runtime_type_info %s)\n", |
| 121 "(mode %d, runtime_type_info %s)\n", | |
| 122 MinorKey(), | 101 MinorKey(), |
| 123 Token::String(op_), | 102 Token::String(op_), |
| 124 static_cast<int>(mode_), | 103 static_cast<int>(mode_), |
| 125 UnaryOpIC::GetName(operand_type_)); | 104 UnaryOpIC::GetName(operand_type_)); |
| 126 } | 105 } |
| 127 #endif | 106 #endif |
| 128 | 107 |
| 129 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; | 108 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
| 130 class OpBits: public BitField<Token::Value, 1, 7> {}; | 109 class OpBits: public BitField<Token::Value, 1, 7> {}; |
| 131 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; | 110 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 Token::Value op_; | 183 Token::Value op_; |
| 205 OverwriteMode mode_; | 184 OverwriteMode mode_; |
| 206 bool use_vfp3_; | 185 bool use_vfp3_; |
| 207 | 186 |
| 208 // Operand type information determined at runtime. | 187 // Operand type information determined at runtime. |
| 209 BinaryOpIC::TypeInfo operands_type_; | 188 BinaryOpIC::TypeInfo operands_type_; |
| 210 BinaryOpIC::TypeInfo result_type_; | 189 BinaryOpIC::TypeInfo result_type_; |
| 211 | 190 |
| 212 char* name_; | 191 char* name_; |
| 213 | 192 |
| 214 const char* GetName(); | 193 virtual const char* GetName(); |
| 215 | 194 |
| 216 #ifdef DEBUG | 195 #ifdef DEBUG |
| 217 void Print() { | 196 void Print() { |
| 218 PrintF("BinaryOpStub %d (op %s), " | 197 PrintF("BinaryOpStub %d (op %s), " |
| 219 "(mode %d, runtime_type_info %s)\n", | 198 "(mode %d, runtime_type_info %s)\n", |
| 220 MinorKey(), | 199 MinorKey(), |
| 221 Token::String(op_), | 200 Token::String(op_), |
| 222 static_cast<int>(mode_), | 201 static_cast<int>(mode_), |
| 223 BinaryOpIC::GetName(operands_type_)); | 202 BinaryOpIC::GetName(operands_type_)); |
| 224 } | 203 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 378 |
| 400 Major MajorKey() { return WriteInt32ToHeapNumber; } | 379 Major MajorKey() { return WriteInt32ToHeapNumber; } |
| 401 int MinorKey() { | 380 int MinorKey() { |
| 402 // Encode the parameters in a unique 16 bit value. | 381 // Encode the parameters in a unique 16 bit value. |
| 403 return IntRegisterBits::encode(the_int_.code()) | 382 return IntRegisterBits::encode(the_int_.code()) |
| 404 | HeapNumberRegisterBits::encode(the_heap_number_.code()) | 383 | HeapNumberRegisterBits::encode(the_heap_number_.code()) |
| 405 | ScratchRegisterBits::encode(scratch_.code()); | 384 | ScratchRegisterBits::encode(scratch_.code()); |
| 406 } | 385 } |
| 407 | 386 |
| 408 void Generate(MacroAssembler* masm); | 387 void Generate(MacroAssembler* masm); |
| 409 | |
| 410 const char* GetName() { return "WriteInt32ToHeapNumberStub"; } | |
| 411 | |
| 412 #ifdef DEBUG | |
| 413 void Print() { PrintF("WriteInt32ToHeapNumberStub\n"); } | |
| 414 #endif | |
| 415 }; | 388 }; |
| 416 | 389 |
| 417 | 390 |
| 418 class NumberToStringStub: public CodeStub { | 391 class NumberToStringStub: public CodeStub { |
| 419 public: | 392 public: |
| 420 NumberToStringStub() { } | 393 NumberToStringStub() { } |
| 421 | 394 |
| 422 // Generate code to do a lookup in the number string cache. If the number in | 395 // Generate code to do a lookup in the number string cache. If the number in |
| 423 // the register object is found in the cache the generated code falls through | 396 // the register object is found in the cache the generated code falls through |
| 424 // with the result in the result register. The object and the result register | 397 // with the result in the result register. The object and the result register |
| 425 // can be the same. If the number is not found in the cache the code jumps to | 398 // can be the same. If the number is not found in the cache the code jumps to |
| 426 // the label not_found with only the content of register object unchanged. | 399 // the label not_found with only the content of register object unchanged. |
| 427 static void GenerateLookupNumberStringCache(MacroAssembler* masm, | 400 static void GenerateLookupNumberStringCache(MacroAssembler* masm, |
| 428 Register object, | 401 Register object, |
| 429 Register result, | 402 Register result, |
| 430 Register scratch1, | 403 Register scratch1, |
| 431 Register scratch2, | 404 Register scratch2, |
| 432 Register scratch3, | 405 Register scratch3, |
| 433 bool object_is_smi, | 406 bool object_is_smi, |
| 434 Label* not_found); | 407 Label* not_found); |
| 435 | 408 |
| 436 private: | 409 private: |
| 437 Major MajorKey() { return NumberToString; } | 410 Major MajorKey() { return NumberToString; } |
| 438 int MinorKey() { return 0; } | 411 int MinorKey() { return 0; } |
| 439 | 412 |
| 440 void Generate(MacroAssembler* masm); | 413 void Generate(MacroAssembler* masm); |
| 441 | |
| 442 const char* GetName() { return "NumberToStringStub"; } | |
| 443 }; | 414 }; |
| 444 | 415 |
| 445 | 416 |
| 446 class RecordWriteStub: public CodeStub { | 417 class RecordWriteStub: public CodeStub { |
| 447 public: | 418 public: |
| 448 RecordWriteStub(Register object, | 419 RecordWriteStub(Register object, |
| 449 Register value, | 420 Register value, |
| 450 Register address, | 421 Register address, |
| 451 RememberedSetAction remembered_set_action, | 422 RememberedSetAction remembered_set_action, |
| 452 SaveFPRegsMode fp_mode) | 423 SaveFPRegsMode fp_mode) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 public: | 570 public: |
| 600 RegExpCEntryStub() {} | 571 RegExpCEntryStub() {} |
| 601 virtual ~RegExpCEntryStub() {} | 572 virtual ~RegExpCEntryStub() {} |
| 602 void Generate(MacroAssembler* masm); | 573 void Generate(MacroAssembler* masm); |
| 603 | 574 |
| 604 private: | 575 private: |
| 605 Major MajorKey() { return RegExpCEntry; } | 576 Major MajorKey() { return RegExpCEntry; } |
| 606 int MinorKey() { return 0; } | 577 int MinorKey() { return 0; } |
| 607 | 578 |
| 608 bool NeedsImmovableCode() { return true; } | 579 bool NeedsImmovableCode() { return true; } |
| 609 | |
| 610 const char* GetName() { return "RegExpCEntryStub"; } | |
| 611 }; | 580 }; |
| 612 | 581 |
| 613 | 582 |
| 614 // Trampoline stub to call into native code. To call safely into native code | 583 // Trampoline stub to call into native code. To call safely into native code |
| 615 // in the presence of compacting GC (which can move code objects) we need to | 584 // in the presence of compacting GC (which can move code objects) we need to |
| 616 // keep the code which called into native pinned in the memory. Currently the | 585 // keep the code which called into native pinned in the memory. Currently the |
| 617 // simplest approach is to generate such stub early enough so it can never be | 586 // simplest approach is to generate such stub early enough so it can never be |
| 618 // moved by GC | 587 // moved by GC |
| 619 class DirectCEntryStub: public CodeStub { | 588 class DirectCEntryStub: public CodeStub { |
| 620 public: | 589 public: |
| 621 DirectCEntryStub() {} | 590 DirectCEntryStub() {} |
| 622 void Generate(MacroAssembler* masm); | 591 void Generate(MacroAssembler* masm); |
| 623 void GenerateCall(MacroAssembler* masm, ExternalReference function); | 592 void GenerateCall(MacroAssembler* masm, ExternalReference function); |
| 624 void GenerateCall(MacroAssembler* masm, Register target); | 593 void GenerateCall(MacroAssembler* masm, Register target); |
| 625 | 594 |
| 626 private: | 595 private: |
| 627 Major MajorKey() { return DirectCEntry; } | 596 Major MajorKey() { return DirectCEntry; } |
| 628 int MinorKey() { return 0; } | 597 int MinorKey() { return 0; } |
| 629 | 598 |
| 630 bool NeedsImmovableCode() { return true; } | 599 bool NeedsImmovableCode() { return true; } |
| 631 | |
| 632 const char* GetName() { return "DirectCEntryStub"; } | |
| 633 }; | 600 }; |
| 634 | 601 |
| 635 | 602 |
| 636 class FloatingPointHelper : public AllStatic { | 603 class FloatingPointHelper : public AllStatic { |
| 637 public: | 604 public: |
| 638 | |
| 639 enum Destination { | 605 enum Destination { |
| 640 kVFPRegisters, | 606 kVFPRegisters, |
| 641 kCoreRegisters | 607 kCoreRegisters |
| 642 }; | 608 }; |
| 643 | 609 |
| 644 | 610 |
| 645 // Loads smis from r0 and r1 (right and left in binary operations) into | 611 // Loads smis from r0 and r1 (right and left in binary operations) into |
| 646 // floating point registers. Depending on the destination the values ends up | 612 // floating point registers. Depending on the destination the values ends up |
| 647 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is | 613 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is |
| 648 // floating point registers VFP3 must be supported. If core registers are | 614 // floating point registers VFP3 must be supported. If core registers are |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 static const int kTotalProbes = 20; | 772 static const int kTotalProbes = 20; |
| 807 | 773 |
| 808 static const int kCapacityOffset = | 774 static const int kCapacityOffset = |
| 809 StringDictionary::kHeaderSize + | 775 StringDictionary::kHeaderSize + |
| 810 StringDictionary::kCapacityIndex * kPointerSize; | 776 StringDictionary::kCapacityIndex * kPointerSize; |
| 811 | 777 |
| 812 static const int kElementsStartOffset = | 778 static const int kElementsStartOffset = |
| 813 StringDictionary::kHeaderSize + | 779 StringDictionary::kHeaderSize + |
| 814 StringDictionary::kElementsStartIndex * kPointerSize; | 780 StringDictionary::kElementsStartIndex * kPointerSize; |
| 815 | 781 |
| 816 | |
| 817 #ifdef DEBUG | |
| 818 void Print() { | |
| 819 PrintF("StringDictionaryLookupStub\n"); | |
| 820 } | |
| 821 #endif | |
| 822 | |
| 823 Major MajorKey() { return StringDictionaryNegativeLookup; } | 782 Major MajorKey() { return StringDictionaryNegativeLookup; } |
| 824 | 783 |
| 825 int MinorKey() { | 784 int MinorKey() { |
| 826 return LookupModeBits::encode(mode_); | 785 return LookupModeBits::encode(mode_); |
| 827 } | 786 } |
| 828 | 787 |
| 829 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 788 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
| 830 | 789 |
| 831 LookupMode mode_; | 790 LookupMode mode_; |
| 832 }; | 791 }; |
| 833 | 792 |
| 834 | 793 |
| 835 } } // namespace v8::internal | 794 } } // namespace v8::internal |
| 836 | 795 |
| 837 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 796 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
| OLD | NEW |