Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 7342042: Disentangle printing of stub names and memory allocation. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 // Return 1/0 for true/false in tos_. 1676 // Return 1/0 for true/false in tos_.
1677 __ bind(&true_result); 1677 __ bind(&true_result);
1678 __ mov(tos_, Operand(1, RelocInfo::NONE)); 1678 __ mov(tos_, Operand(1, RelocInfo::NONE));
1679 __ Ret(); 1679 __ Ret();
1680 __ bind(&false_result); 1680 __ bind(&false_result);
1681 __ mov(tos_, Operand(0, RelocInfo::NONE)); 1681 __ mov(tos_, Operand(0, RelocInfo::NONE));
1682 __ Ret(); 1682 __ Ret();
1683 } 1683 }
1684 1684
1685 1685
1686 const char* UnaryOpStub::GetName() { 1686 void UnaryOpStub::PrintName(StringStream* stream) {
1687 if (name_ != NULL) return name_;
1688 const int kMaxNameLength = 100;
1689 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
1690 kMaxNameLength);
1691 if (name_ == NULL) return "OOM";
1692 const char* op_name = Token::Name(op_); 1687 const char* op_name = Token::Name(op_);
1693 const char* overwrite_name = NULL; // Make g++ happy. 1688 const char* overwrite_name = NULL; // Make g++ happy.
1694 switch (mode_) { 1689 switch (mode_) {
1695 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; 1690 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break;
1696 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; 1691 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break;
1697 } 1692 }
1698 1693 stream->Add("UnaryOpStub_%s_%s_%s",
1699 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 1694 op_name,
1700 "UnaryOpStub_%s_%s_%s", 1695 overwrite_name,
1701 op_name, 1696 UnaryOpIC::GetName(operand_type_));
1702 overwrite_name,
1703 UnaryOpIC::GetName(operand_type_));
1704 return name_;
1705 } 1697 }
1706 1698
1707 1699
1708 // TODO(svenpanne): Use virtual functions instead of switch. 1700 // TODO(svenpanne): Use virtual functions instead of switch.
1709 void UnaryOpStub::Generate(MacroAssembler* masm) { 1701 void UnaryOpStub::Generate(MacroAssembler* masm) {
1710 switch (operand_type_) { 1702 switch (operand_type_) {
1711 case UnaryOpIC::UNINITIALIZED: 1703 case UnaryOpIC::UNINITIALIZED:
1712 GenerateTypeTransition(masm); 1704 GenerateTypeTransition(masm);
1713 break; 1705 break;
1714 case UnaryOpIC::SMI: 1706 case UnaryOpIC::SMI:
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 break; 2022 break;
2031 case BinaryOpIC::GENERIC: 2023 case BinaryOpIC::GENERIC:
2032 GenerateGeneric(masm); 2024 GenerateGeneric(masm);
2033 break; 2025 break;
2034 default: 2026 default:
2035 UNREACHABLE(); 2027 UNREACHABLE();
2036 } 2028 }
2037 } 2029 }
2038 2030
2039 2031
2040 const char* BinaryOpStub::GetName() { 2032 void BinaryOpStub::PrintName(StringStream* stream) {
2041 if (name_ != NULL) return name_;
2042 const int kMaxNameLength = 100;
2043 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
2044 kMaxNameLength);
2045 if (name_ == NULL) return "OOM";
2046 const char* op_name = Token::Name(op_); 2033 const char* op_name = Token::Name(op_);
2047 const char* overwrite_name; 2034 const char* overwrite_name;
2048 switch (mode_) { 2035 switch (mode_) {
2049 case NO_OVERWRITE: overwrite_name = "Alloc"; break; 2036 case NO_OVERWRITE: overwrite_name = "Alloc"; break;
2050 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; 2037 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break;
2051 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; 2038 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break;
2052 default: overwrite_name = "UnknownOverwrite"; break; 2039 default: overwrite_name = "UnknownOverwrite"; break;
2053 } 2040 }
2054 2041 stream->Add("BinaryOpStub_%s_%s_%s",
2055 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 2042 op_name,
2056 "BinaryOpStub_%s_%s_%s", 2043 overwrite_name,
2057 op_name, 2044 BinaryOpIC::GetName(operands_type_));
2058 overwrite_name,
2059 BinaryOpIC::GetName(operands_type_));
2060 return name_;
2061 } 2045 }
2062 2046
2063 2047
2064 void BinaryOpStub::GenerateSmiSmiOperation(MacroAssembler* masm) { 2048 void BinaryOpStub::GenerateSmiSmiOperation(MacroAssembler* masm) {
2065 Register left = r1; 2049 Register left = r1;
2066 Register right = r0; 2050 Register right = r0;
2067 Register scratch1 = r7; 2051 Register scratch1 = r7;
2068 Register scratch2 = r9; 2052 Register scratch2 = r9;
2069 2053
2070 ASSERT(right.is(r0)); 2054 ASSERT(right.is(r0));
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after
4738 __ mov(r0, Operand(argc_)); // Setup the number of arguments. 4722 __ mov(r0, Operand(argc_)); // Setup the number of arguments.
4739 __ mov(r2, Operand(0, RelocInfo::NONE)); 4723 __ mov(r2, Operand(0, RelocInfo::NONE));
4740 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 4724 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
4741 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 4725 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
4742 RelocInfo::CODE_TARGET); 4726 RelocInfo::CODE_TARGET);
4743 } 4727 }
4744 4728
4745 4729
4746 // Unfortunately you have to run without snapshots to see most of these 4730 // Unfortunately you have to run without snapshots to see most of these
4747 // names in the profile since most compare stubs end up in the snapshot. 4731 // names in the profile since most compare stubs end up in the snapshot.
4748 const char* CompareStub::GetName() { 4732 void CompareStub::PrintName(StringStream* stream) {
4749 ASSERT((lhs_.is(r0) && rhs_.is(r1)) || 4733 ASSERT((lhs_.is(r0) && rhs_.is(r1)) ||
4750 (lhs_.is(r1) && rhs_.is(r0))); 4734 (lhs_.is(r1) && rhs_.is(r0)));
4751
4752 if (name_ != NULL) return name_;
4753 const int kMaxNameLength = 100;
4754 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
4755 kMaxNameLength);
4756 if (name_ == NULL) return "OOM";
4757
4758 const char* cc_name; 4735 const char* cc_name;
4759 switch (cc_) { 4736 switch (cc_) {
4760 case lt: cc_name = "LT"; break; 4737 case lt: cc_name = "LT"; break;
4761 case gt: cc_name = "GT"; break; 4738 case gt: cc_name = "GT"; break;
4762 case le: cc_name = "LE"; break; 4739 case le: cc_name = "LE"; break;
4763 case ge: cc_name = "GE"; break; 4740 case ge: cc_name = "GE"; break;
4764 case eq: cc_name = "EQ"; break; 4741 case eq: cc_name = "EQ"; break;
4765 case ne: cc_name = "NE"; break; 4742 case ne: cc_name = "NE"; break;
4766 default: cc_name = "UnknownCondition"; break; 4743 default: cc_name = "UnknownCondition"; break;
4767 } 4744 }
4768 4745 bool is_equality = cc_ == eq || cc_ == ne;
4769 const char* lhs_name = lhs_.is(r0) ? "_r0" : "_r1"; 4746 stream->Add("CompareStub_%s", cc_name);
4770 const char* rhs_name = rhs_.is(r0) ? "_r0" : "_r1"; 4747 stream->Add(lhs_.is(r0) ? "_r0" : "_r1");
4771 4748 stream->Add(rhs_.is(r0) ? "_r0" : "_r1");
4772 const char* strict_name = ""; 4749 if (strict_ && is_equality) stream->Add("_STRICT");
4773 if (strict_ && (cc_ == eq || cc_ == ne)) { 4750 if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN");
4774 strict_name = "_STRICT"; 4751 if (!include_number_compare_) stream->Add("_NO_NUMBER");
4775 } 4752 if (!include_smi_compare_) stream->Add("_NO_SMI");
4776
4777 const char* never_nan_nan_name = "";
4778 if (never_nan_nan_ && (cc_ == eq || cc_ == ne)) {
4779 never_nan_nan_name = "_NO_NAN";
4780 }
4781
4782 const char* include_number_compare_name = "";
4783 if (!include_number_compare_) {
4784 include_number_compare_name = "_NO_NUMBER";
4785 }
4786
4787 const char* include_smi_compare_name = "";
4788 if (!include_smi_compare_) {
4789 include_smi_compare_name = "_NO_SMI";
4790 }
4791
4792 OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
4793 "CompareStub_%s%s%s%s%s%s",
4794 cc_name,
4795 lhs_name,
4796 rhs_name,
4797 strict_name,
4798 never_nan_nan_name,
4799 include_number_compare_name,
4800 include_smi_compare_name);
4801 return name_;
4802 } 4753 }
4803 4754
4804 4755
4805 int CompareStub::MinorKey() { 4756 int CompareStub::MinorKey() {
4806 // Encode the three parameters in a unique 16 bit value. To avoid duplicate 4757 // Encode the three parameters in a unique 16 bit value. To avoid duplicate
4807 // stubs the never NaN NaN condition is only taken into account if the 4758 // stubs the never NaN NaN condition is only taken into account if the
4808 // condition is equals. 4759 // condition is equals.
4809 ASSERT((static_cast<unsigned>(cc_) >> 28) < (1 << 12)); 4760 ASSERT((static_cast<unsigned>(cc_) >> 28) < (1 << 12));
4810 ASSERT((lhs_.is(r0) && rhs_.is(r1)) || 4761 ASSERT((lhs_.is(r0) && rhs_.is(r1)) ||
4811 (lhs_.is(r1) && rhs_.is(r0))); 4762 (lhs_.is(r1) && rhs_.is(r0)));
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
6583 __ mov(result, Operand(0)); 6534 __ mov(result, Operand(0));
6584 __ Ret(); 6535 __ Ret();
6585 } 6536 }
6586 6537
6587 6538
6588 #undef __ 6539 #undef __
6589 6540
6590 } } // namespace v8::internal 6541 } } // namespace v8::internal
6591 6542
6592 #endif // V8_TARGET_ARCH_ARM 6543 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698