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

Side by Side Diff: src/mips/code-stubs-mips.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/mips/code-stubs-mips.h ('k') | src/x64/code-stubs-x64.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 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 // If length is not zero, "tos_" contains a non-zero value ==> true. 1790 // If length is not zero, "tos_" contains a non-zero value ==> true.
1791 __ Ret(); 1791 __ Ret();
1792 1792
1793 // Return 0 in "tos_" for false. 1793 // Return 0 in "tos_" for false.
1794 __ bind(&false_result); 1794 __ bind(&false_result);
1795 __ mov(tos_, zero_reg); 1795 __ mov(tos_, zero_reg);
1796 __ Ret(); 1796 __ Ret();
1797 } 1797 }
1798 1798
1799 1799
1800 const char* UnaryOpStub::GetName() { 1800 void UnaryOpStub::PrintName(StringStream* stream) {
1801 if (name_ != NULL) return name_;
1802 const int kMaxNameLength = 100;
1803 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
1804 kMaxNameLength);
1805 if (name_ == NULL) return "OOM";
1806 const char* op_name = Token::Name(op_); 1801 const char* op_name = Token::Name(op_);
1807 const char* overwrite_name = NULL; // Make g++ happy. 1802 const char* overwrite_name = NULL; // Make g++ happy.
1808 switch (mode_) { 1803 switch (mode_) {
1809 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; 1804 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break;
1810 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; 1805 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break;
1811 } 1806 }
1812 1807 stream->Add("UnaryOpStub_%s_%s_%s",
1813 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 1808 op_name,
1814 "UnaryOpStub_%s_%s_%s", 1809 overwrite_name,
1815 op_name, 1810 UnaryOpIC::GetName(operand_type_));
1816 overwrite_name,
1817 UnaryOpIC::GetName(operand_type_));
1818 return name_;
1819 } 1811 }
1820 1812
1821 1813
1822 // TODO(svenpanne): Use virtual functions instead of switch. 1814 // TODO(svenpanne): Use virtual functions instead of switch.
1823 void UnaryOpStub::Generate(MacroAssembler* masm) { 1815 void UnaryOpStub::Generate(MacroAssembler* masm) {
1824 switch (operand_type_) { 1816 switch (operand_type_) {
1825 case UnaryOpIC::UNINITIALIZED: 1817 case UnaryOpIC::UNINITIALIZED:
1826 GenerateTypeTransition(masm); 1818 GenerateTypeTransition(masm);
1827 break; 1819 break;
1828 case UnaryOpIC::SMI: 1820 case UnaryOpIC::SMI:
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 break; 2139 break;
2148 case BinaryOpIC::GENERIC: 2140 case BinaryOpIC::GENERIC:
2149 GenerateGeneric(masm); 2141 GenerateGeneric(masm);
2150 break; 2142 break;
2151 default: 2143 default:
2152 UNREACHABLE(); 2144 UNREACHABLE();
2153 } 2145 }
2154 } 2146 }
2155 2147
2156 2148
2157 const char* BinaryOpStub::GetName() { 2149 void BinaryOpStub::PrintName(StringStream* stream) {
2158 if (name_ != NULL) return name_;
2159 const int kMaxNameLength = 100;
2160 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
2161 kMaxNameLength);
2162 if (name_ == NULL) return "OOM";
2163 const char* op_name = Token::Name(op_); 2150 const char* op_name = Token::Name(op_);
2164 const char* overwrite_name; 2151 const char* overwrite_name;
2165 switch (mode_) { 2152 switch (mode_) {
2166 case NO_OVERWRITE: overwrite_name = "Alloc"; break; 2153 case NO_OVERWRITE: overwrite_name = "Alloc"; break;
2167 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; 2154 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break;
2168 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; 2155 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break;
2169 default: overwrite_name = "UnknownOverwrite"; break; 2156 default: overwrite_name = "UnknownOverwrite"; break;
2170 } 2157 }
2171 2158 stream->Add("BinaryOpStub_%s_%s_%s",
2172 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 2159 op_name,
2173 "BinaryOpStub_%s_%s_%s", 2160 overwrite_name,
2174 op_name, 2161 BinaryOpIC::GetName(operands_type_));
2175 overwrite_name,
2176 BinaryOpIC::GetName(operands_type_));
2177 return name_;
2178 } 2162 }
2179 2163
2180 2164
2181 2165
2182 void BinaryOpStub::GenerateSmiSmiOperation(MacroAssembler* masm) { 2166 void BinaryOpStub::GenerateSmiSmiOperation(MacroAssembler* masm) {
2183 Register left = a1; 2167 Register left = a1;
2184 Register right = a0; 2168 Register right = a0;
2185 2169
2186 Register scratch1 = t0; 2170 Register scratch1 = t0;
2187 Register scratch2 = t1; 2171 Register scratch2 = t1;
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
4929 __ li(a0, Operand(argc_)); // Setup the number of arguments. 4913 __ li(a0, Operand(argc_)); // Setup the number of arguments.
4930 __ mov(a2, zero_reg); 4914 __ mov(a2, zero_reg);
4931 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); 4915 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION);
4932 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 4916 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
4933 RelocInfo::CODE_TARGET); 4917 RelocInfo::CODE_TARGET);
4934 } 4918 }
4935 4919
4936 4920
4937 // Unfortunately you have to run without snapshots to see most of these 4921 // Unfortunately you have to run without snapshots to see most of these
4938 // names in the profile since most compare stubs end up in the snapshot. 4922 // names in the profile since most compare stubs end up in the snapshot.
4939 const char* CompareStub::GetName() { 4923 void CompareStub::PrintName(StringStream* stream) {
4940 ASSERT((lhs_.is(a0) && rhs_.is(a1)) || 4924 ASSERT((lhs_.is(a0) && rhs_.is(a1)) ||
4941 (lhs_.is(a1) && rhs_.is(a0))); 4925 (lhs_.is(a1) && rhs_.is(a0)));
4942
4943 if (name_ != NULL) return name_;
4944 const int kMaxNameLength = 100;
4945 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
4946 kMaxNameLength);
4947 if (name_ == NULL) return "OOM";
4948
4949 const char* cc_name; 4926 const char* cc_name;
4950 switch (cc_) { 4927 switch (cc_) {
4951 case lt: cc_name = "LT"; break; 4928 case lt: cc_name = "LT"; break;
4952 case gt: cc_name = "GT"; break; 4929 case gt: cc_name = "GT"; break;
4953 case le: cc_name = "LE"; break; 4930 case le: cc_name = "LE"; break;
4954 case ge: cc_name = "GE"; break; 4931 case ge: cc_name = "GE"; break;
4955 case eq: cc_name = "EQ"; break; 4932 case eq: cc_name = "EQ"; break;
4956 case ne: cc_name = "NE"; break; 4933 case ne: cc_name = "NE"; break;
4957 default: cc_name = "UnknownCondition"; break; 4934 default: cc_name = "UnknownCondition"; break;
4958 } 4935 }
4959 4936 bool is_equality = cc_ == eq || cc_ == ne;
4960 const char* lhs_name = lhs_.is(a0) ? "_a0" : "_a1"; 4937 stream->Add("CompareStub_%s", cc_name);
4961 const char* rhs_name = rhs_.is(a0) ? "_a0" : "_a1"; 4938 stream->Add(lhs_.is(a0) ? "_a0" : "_a1");
4962 4939 stream->Add(rhs_.is(a0) ? "_a0" : "_a1");
4963 const char* strict_name = ""; 4940 if (strict_ && is_equality) stream->Add("_STRICT");
4964 if (strict_ && (cc_ == eq || cc_ == ne)) { 4941 if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN");
4965 strict_name = "_STRICT"; 4942 if (!include_number_compare_) stream->Add("_NO_NUMBER");
4966 } 4943 if (!include_smi_compare_) stream->Add("_NO_SMI");
4967
4968 const char* never_nan_nan_name = "";
4969 if (never_nan_nan_ && (cc_ == eq || cc_ == ne)) {
4970 never_nan_nan_name = "_NO_NAN";
4971 }
4972
4973 const char* include_number_compare_name = "";
4974 if (!include_number_compare_) {
4975 include_number_compare_name = "_NO_NUMBER";
4976 }
4977
4978 const char* include_smi_compare_name = "";
4979 if (!include_smi_compare_) {
4980 include_smi_compare_name = "_NO_SMI";
4981 }
4982
4983 OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
4984 "CompareStub_%s%s%s%s%s%s",
4985 cc_name,
4986 lhs_name,
4987 rhs_name,
4988 strict_name,
4989 never_nan_nan_name,
4990 include_number_compare_name,
4991 include_smi_compare_name);
4992 return name_;
4993 } 4944 }
4994 4945
4995 4946
4996 int CompareStub::MinorKey() { 4947 int CompareStub::MinorKey() {
4997 // Encode the two parameters in a unique 16 bit value. 4948 // Encode the two parameters in a unique 16 bit value.
4998 ASSERT(static_cast<unsigned>(cc_) < (1 << 14)); 4949 ASSERT(static_cast<unsigned>(cc_) < (1 << 14));
4999 ASSERT((lhs_.is(a0) && rhs_.is(a1)) || 4950 ASSERT((lhs_.is(a0) && rhs_.is(a1)) ||
5000 (lhs_.is(a1) && rhs_.is(a0))); 4951 (lhs_.is(a1) && rhs_.is(a0)));
5001 return ConditionField::encode(static_cast<unsigned>(cc_)) 4952 return ConditionField::encode(static_cast<unsigned>(cc_))
5002 | RegisterField::encode(lhs_.is(a0)) 4953 | RegisterField::encode(lhs_.is(a0))
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
6869 __ mov(result, zero_reg); 6820 __ mov(result, zero_reg);
6870 __ Ret(); 6821 __ Ret();
6871 } 6822 }
6872 6823
6873 6824
6874 #undef __ 6825 #undef __
6875 6826
6876 } } // namespace v8::internal 6827 } } // namespace v8::internal
6877 6828
6878 #endif // V8_TARGET_ARCH_MIPS 6829 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.h ('k') | src/x64/code-stubs-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698