Index: src/mips/code-stubs-mips.cc |
=================================================================== |
--- src/mips/code-stubs-mips.cc (revision 8622) |
+++ src/mips/code-stubs-mips.cc (working copy) |
@@ -1797,25 +1797,17 @@ |
} |
-const char* UnaryOpStub::GetName() { |
- if (name_ != NULL) return name_; |
- const int kMaxNameLength = 100; |
- name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( |
- kMaxNameLength); |
- if (name_ == NULL) return "OOM"; |
+void UnaryOpStub::PrintName(StringStream* stream) { |
const char* op_name = Token::Name(op_); |
const char* overwrite_name = NULL; // Make g++ happy. |
switch (mode_) { |
case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; |
case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; |
} |
- |
- OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
- "UnaryOpStub_%s_%s_%s", |
- op_name, |
- overwrite_name, |
- UnaryOpIC::GetName(operand_type_)); |
- return name_; |
+ stream->Add("UnaryOpStub_%s_%s_%s", |
+ op_name, |
+ overwrite_name, |
+ UnaryOpIC::GetName(operand_type_)); |
} |
@@ -2154,12 +2146,7 @@ |
} |
-const char* BinaryOpStub::GetName() { |
- if (name_ != NULL) return name_; |
- const int kMaxNameLength = 100; |
- name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( |
- kMaxNameLength); |
- if (name_ == NULL) return "OOM"; |
+void BinaryOpStub::PrintName(StringStream* stream) { |
const char* op_name = Token::Name(op_); |
const char* overwrite_name; |
switch (mode_) { |
@@ -2168,13 +2155,10 @@ |
case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; |
default: overwrite_name = "UnknownOverwrite"; break; |
} |
- |
- OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
- "BinaryOpStub_%s_%s_%s", |
- op_name, |
- overwrite_name, |
- BinaryOpIC::GetName(operands_type_)); |
- return name_; |
+ stream->Add("BinaryOpStub_%s_%s_%s", |
+ op_name, |
+ overwrite_name, |
+ BinaryOpIC::GetName(operands_type_)); |
} |
@@ -4936,16 +4920,9 @@ |
// Unfortunately you have to run without snapshots to see most of these |
// names in the profile since most compare stubs end up in the snapshot. |
-const char* CompareStub::GetName() { |
+void CompareStub::PrintName(StringStream* stream) { |
ASSERT((lhs_.is(a0) && rhs_.is(a1)) || |
(lhs_.is(a1) && rhs_.is(a0))); |
- |
- if (name_ != NULL) return name_; |
- const int kMaxNameLength = 100; |
- name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( |
- kMaxNameLength); |
- if (name_ == NULL) return "OOM"; |
- |
const char* cc_name; |
switch (cc_) { |
case lt: cc_name = "LT"; break; |
@@ -4956,40 +4933,14 @@ |
case ne: cc_name = "NE"; break; |
default: cc_name = "UnknownCondition"; break; |
} |
- |
- const char* lhs_name = lhs_.is(a0) ? "_a0" : "_a1"; |
- const char* rhs_name = rhs_.is(a0) ? "_a0" : "_a1"; |
- |
- const char* strict_name = ""; |
- if (strict_ && (cc_ == eq || cc_ == ne)) { |
- strict_name = "_STRICT"; |
- } |
- |
- const char* never_nan_nan_name = ""; |
- if (never_nan_nan_ && (cc_ == eq || cc_ == ne)) { |
- never_nan_nan_name = "_NO_NAN"; |
- } |
- |
- const char* include_number_compare_name = ""; |
- if (!include_number_compare_) { |
- include_number_compare_name = "_NO_NUMBER"; |
- } |
- |
- const char* include_smi_compare_name = ""; |
- if (!include_smi_compare_) { |
- include_smi_compare_name = "_NO_SMI"; |
- } |
- |
- OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
- "CompareStub_%s%s%s%s%s%s", |
- cc_name, |
- lhs_name, |
- rhs_name, |
- strict_name, |
- never_nan_nan_name, |
- include_number_compare_name, |
- include_smi_compare_name); |
- return name_; |
+ bool is_equality = cc_ == eq || cc_ == ne; |
+ stream->Add("CompareStub_%s", cc_name); |
+ stream->Add(lhs_.is(a0) ? "_a0" : "_a1"); |
+ stream->Add(rhs_.is(a0) ? "_a0" : "_a1"); |
+ if (strict_ && is_equality) stream->Add("_STRICT"); |
+ if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN"); |
+ if (!include_number_compare_) stream->Add("_NO_NUMBER"); |
+ if (!include_smi_compare_) stream->Add("_NO_SMI"); |
} |