| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 break; | 635 break; |
| 636 case Token::BIT_NOT: | 636 case Token::BIT_NOT: |
| 637 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION); | 637 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION); |
| 638 break; | 638 break; |
| 639 default: | 639 default: |
| 640 UNREACHABLE(); | 640 UNREACHABLE(); |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 | 643 |
| 644 | 644 |
| 645 const char* UnaryOpStub::GetName() { | 645 void UnaryOpStub::PrintName(StringStream* stream) { |
| 646 if (name_ != NULL) return name_; | |
| 647 const int kMaxNameLength = 100; | |
| 648 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( | |
| 649 kMaxNameLength); | |
| 650 if (name_ == NULL) return "OOM"; | |
| 651 const char* op_name = Token::Name(op_); | 646 const char* op_name = Token::Name(op_); |
| 652 const char* overwrite_name = NULL; // Make g++ happy. | 647 const char* overwrite_name = NULL; // Make g++ happy. |
| 653 switch (mode_) { | 648 switch (mode_) { |
| 654 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; | 649 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; |
| 655 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; | 650 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; |
| 656 } | 651 } |
| 657 | 652 stream->Add("UnaryOpStub_%s_%s_%s", |
| 658 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), | 653 op_name, |
| 659 "UnaryOpStub_%s_%s_%s", | 654 overwrite_name, |
| 660 op_name, | 655 UnaryOpIC::GetName(operand_type_)); |
| 661 overwrite_name, | |
| 662 UnaryOpIC::GetName(operand_type_)); | |
| 663 return name_; | |
| 664 } | 656 } |
| 665 | 657 |
| 666 | 658 |
| 667 void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { | 659 void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { |
| 668 __ pop(rcx); // Save return address. | 660 __ pop(rcx); // Save return address. |
| 669 __ push(rdx); | 661 __ push(rdx); |
| 670 __ push(rax); | 662 __ push(rax); |
| 671 // Left and right arguments are now on top. | 663 // Left and right arguments are now on top. |
| 672 // Push this stub's key. Although the operation and the type info are | 664 // Push this stub's key. Although the operation and the type info are |
| 673 // encoded into the key, the encoding is opaque, so push them too. | 665 // encoded into the key, the encoding is opaque, so push them too. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 break; | 706 break; |
| 715 case BinaryOpIC::GENERIC: | 707 case BinaryOpIC::GENERIC: |
| 716 GenerateGeneric(masm); | 708 GenerateGeneric(masm); |
| 717 break; | 709 break; |
| 718 default: | 710 default: |
| 719 UNREACHABLE(); | 711 UNREACHABLE(); |
| 720 } | 712 } |
| 721 } | 713 } |
| 722 | 714 |
| 723 | 715 |
| 724 const char* BinaryOpStub::GetName() { | 716 void BinaryOpStub::PrintName(StringStream* stream) { |
| 725 if (name_ != NULL) return name_; | |
| 726 const int kMaxNameLength = 100; | |
| 727 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( | |
| 728 kMaxNameLength); | |
| 729 if (name_ == NULL) return "OOM"; | |
| 730 const char* op_name = Token::Name(op_); | 717 const char* op_name = Token::Name(op_); |
| 731 const char* overwrite_name; | 718 const char* overwrite_name; |
| 732 switch (mode_) { | 719 switch (mode_) { |
| 733 case NO_OVERWRITE: overwrite_name = "Alloc"; break; | 720 case NO_OVERWRITE: overwrite_name = "Alloc"; break; |
| 734 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; | 721 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; |
| 735 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; | 722 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; |
| 736 default: overwrite_name = "UnknownOverwrite"; break; | 723 default: overwrite_name = "UnknownOverwrite"; break; |
| 737 } | 724 } |
| 738 | 725 stream->Add("BinaryOpStub_%s_%s_%s", |
| 739 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), | 726 op_name, |
| 740 "BinaryOpStub_%s_%s_%s", | 727 overwrite_name, |
| 741 op_name, | 728 BinaryOpIC::GetName(operands_type_)); |
| 742 overwrite_name, | |
| 743 BinaryOpIC::GetName(operands_type_)); | |
| 744 return name_; | |
| 745 } | 729 } |
| 746 | 730 |
| 747 | 731 |
| 748 void BinaryOpStub::GenerateSmiCode( | 732 void BinaryOpStub::GenerateSmiCode( |
| 749 MacroAssembler* masm, | 733 MacroAssembler* masm, |
| 750 Label* slow, | 734 Label* slow, |
| 751 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) { | 735 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) { |
| 752 | 736 |
| 753 // Arguments to BinaryOpStub are in rdx and rax. | 737 // Arguments to BinaryOpStub are in rdx and rax. |
| 754 Register left = rdx; | 738 Register left = rdx; |
| (...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3759 | RegisterField::encode(false) // lhs_ and rhs_ are not used | 3743 | RegisterField::encode(false) // lhs_ and rhs_ are not used |
| 3760 | StrictField::encode(strict_) | 3744 | StrictField::encode(strict_) |
| 3761 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) | 3745 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) |
| 3762 | IncludeNumberCompareField::encode(include_number_compare_) | 3746 | IncludeNumberCompareField::encode(include_number_compare_) |
| 3763 | IncludeSmiCompareField::encode(include_smi_compare_); | 3747 | IncludeSmiCompareField::encode(include_smi_compare_); |
| 3764 } | 3748 } |
| 3765 | 3749 |
| 3766 | 3750 |
| 3767 // Unfortunately you have to run without snapshots to see most of these | 3751 // Unfortunately you have to run without snapshots to see most of these |
| 3768 // names in the profile since most compare stubs end up in the snapshot. | 3752 // names in the profile since most compare stubs end up in the snapshot. |
| 3769 const char* CompareStub::GetName() { | 3753 void CompareStub::PrintName(StringStream* stream) { |
| 3770 ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg)); | 3754 ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg)); |
| 3771 | |
| 3772 if (name_ != NULL) return name_; | |
| 3773 const int kMaxNameLength = 100; | |
| 3774 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( | |
| 3775 kMaxNameLength); | |
| 3776 if (name_ == NULL) return "OOM"; | |
| 3777 | |
| 3778 const char* cc_name; | 3755 const char* cc_name; |
| 3779 switch (cc_) { | 3756 switch (cc_) { |
| 3780 case less: cc_name = "LT"; break; | 3757 case less: cc_name = "LT"; break; |
| 3781 case greater: cc_name = "GT"; break; | 3758 case greater: cc_name = "GT"; break; |
| 3782 case less_equal: cc_name = "LE"; break; | 3759 case less_equal: cc_name = "LE"; break; |
| 3783 case greater_equal: cc_name = "GE"; break; | 3760 case greater_equal: cc_name = "GE"; break; |
| 3784 case equal: cc_name = "EQ"; break; | 3761 case equal: cc_name = "EQ"; break; |
| 3785 case not_equal: cc_name = "NE"; break; | 3762 case not_equal: cc_name = "NE"; break; |
| 3786 default: cc_name = "UnknownCondition"; break; | 3763 default: cc_name = "UnknownCondition"; break; |
| 3787 } | 3764 } |
| 3788 | 3765 bool is_equality = cc_ == equal || cc_ == not_equal; |
| 3789 const char* strict_name = ""; | 3766 stream->Add("CompareStub_%s", cc_name); |
| 3790 if (strict_ && (cc_ == equal || cc_ == not_equal)) { | 3767 if (strict_ && is_equality) stream->Add("_STRICT"); |
| 3791 strict_name = "_STRICT"; | 3768 if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN"); |
| 3792 } | 3769 if (!include_number_compare_) stream->Add("_NO_NUMBER"); |
| 3793 | 3770 if (!include_smi_compare_) stream->Add("_NO_SMI"); |
| 3794 const char* never_nan_nan_name = ""; | |
| 3795 if (never_nan_nan_ && (cc_ == equal || cc_ == not_equal)) { | |
| 3796 never_nan_nan_name = "_NO_NAN"; | |
| 3797 } | |
| 3798 | |
| 3799 const char* include_number_compare_name = ""; | |
| 3800 if (!include_number_compare_) { | |
| 3801 include_number_compare_name = "_NO_NUMBER"; | |
| 3802 } | |
| 3803 | |
| 3804 const char* include_smi_compare_name = ""; | |
| 3805 if (!include_smi_compare_) { | |
| 3806 include_smi_compare_name = "_NO_SMI"; | |
| 3807 } | |
| 3808 | |
| 3809 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), | |
| 3810 "CompareStub_%s%s%s%s", | |
| 3811 cc_name, | |
| 3812 strict_name, | |
| 3813 never_nan_nan_name, | |
| 3814 include_number_compare_name, | |
| 3815 include_smi_compare_name); | |
| 3816 return name_; | |
| 3817 } | 3771 } |
| 3818 | 3772 |
| 3819 | 3773 |
| 3820 // ------------------------------------------------------------------------- | 3774 // ------------------------------------------------------------------------- |
| 3821 // StringCharCodeAtGenerator | 3775 // StringCharCodeAtGenerator |
| 3822 | 3776 |
| 3823 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 3777 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 3824 Label flat_string; | 3778 Label flat_string; |
| 3825 Label ascii_string; | 3779 Label ascii_string; |
| 3826 Label got_char_code; | 3780 Label got_char_code; |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5327 __ Drop(1); | 5281 __ Drop(1); |
| 5328 __ ret(2 * kPointerSize); | 5282 __ ret(2 * kPointerSize); |
| 5329 } | 5283 } |
| 5330 | 5284 |
| 5331 | 5285 |
| 5332 #undef __ | 5286 #undef __ |
| 5333 | 5287 |
| 5334 } } // namespace v8::internal | 5288 } } // namespace v8::internal |
| 5335 | 5289 |
| 5336 #endif // V8_TARGET_ARCH_X64 | 5290 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |