OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 9095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9106 // stubs the never NaN NaN condition is only taken into account if the | 9106 // stubs the never NaN NaN condition is only taken into account if the |
9107 // condition is equals. | 9107 // condition is equals. |
9108 ASSERT(static_cast<unsigned>(cc_) < (1 << 13)); | 9108 ASSERT(static_cast<unsigned>(cc_) < (1 << 13)); |
9109 return ConditionField::encode(static_cast<unsigned>(cc_)) | 9109 return ConditionField::encode(static_cast<unsigned>(cc_)) |
9110 | StrictField::encode(strict_) | 9110 | StrictField::encode(strict_) |
9111 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) | 9111 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) |
9112 | IncludeNumberCompareField::encode(include_number_compare_); | 9112 | IncludeNumberCompareField::encode(include_number_compare_); |
9113 } | 9113 } |
9114 | 9114 |
9115 | 9115 |
| 9116 // Unfortunately you have to run without snapshots to see most of these |
| 9117 // names in the profile since most compare stubs end up in the snapshot. |
9116 const char* CompareStub::GetName() { | 9118 const char* CompareStub::GetName() { |
| 9119 if (name_ != NULL) return name_; |
| 9120 const int kMaxNameLength = 100; |
| 9121 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); |
| 9122 if (name_ == NULL) return "OOM"; |
| 9123 |
| 9124 const char* cc_name; |
9117 switch (cc_) { | 9125 switch (cc_) { |
9118 case less: return "CompareStub_LT"; | 9126 case less: cc_name = "LT"; break; |
9119 case greater: return "CompareStub_GT"; | 9127 case greater: cc_name = "GT"; break; |
9120 case less_equal: return "CompareStub_LE"; | 9128 case less_equal: cc_name = "LE"; break; |
9121 case greater_equal: return "CompareStub_GE"; | 9129 case greater_equal: cc_name = "GE"; break; |
9122 case not_equal: { | 9130 case equal: cc_name = "EQ"; break; |
9123 if (strict_) { | 9131 case not_equal: cc_name = "NE"; break; |
9124 if (never_nan_nan_) { | 9132 default: cc_name = "UnknownCondition"; break; |
9125 return "CompareStub_NE_STRICT_NO_NAN"; | |
9126 } else { | |
9127 return "CompareStub_NE_STRICT"; | |
9128 } | |
9129 } else { | |
9130 if (never_nan_nan_) { | |
9131 return "CompareStub_NE_NO_NAN"; | |
9132 } else { | |
9133 return "CompareStub_NE"; | |
9134 } | |
9135 } | |
9136 } | |
9137 case equal: { | |
9138 if (strict_) { | |
9139 if (never_nan_nan_) { | |
9140 return "CompareStub_EQ_STRICT_NO_NAN"; | |
9141 } else { | |
9142 return "CompareStub_EQ_STRICT"; | |
9143 } | |
9144 } else { | |
9145 if (never_nan_nan_) { | |
9146 return "CompareStub_EQ_NO_NAN"; | |
9147 } else { | |
9148 return "CompareStub_EQ"; | |
9149 } | |
9150 } | |
9151 } | |
9152 default: return "CompareStub"; | |
9153 } | 9133 } |
| 9134 |
| 9135 const char* strict_name = ""; |
| 9136 if (strict_ && (cc_ == equal || cc_ == not_equal)) { |
| 9137 strict_name = "_STRICT"; |
| 9138 } |
| 9139 |
| 9140 const char* never_nan_nan_name = ""; |
| 9141 if (never_nan_nan_ && (cc_ == equal || cc_ == not_equal)) { |
| 9142 never_nan_nan_name = "_NO_NAN"; |
| 9143 } |
| 9144 |
| 9145 const char* include_number_compare_name = ""; |
| 9146 if (!include_number_compare_) { |
| 9147 include_number_compare_name = "_NO_NUMBER"; |
| 9148 } |
| 9149 |
| 9150 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
| 9151 "CompareStub_%s%s%s%s", |
| 9152 cc_name, |
| 9153 strict_name, |
| 9154 never_nan_nan_name, |
| 9155 include_number_compare_name); |
| 9156 return name_; |
9154 } | 9157 } |
9155 | 9158 |
9156 | 9159 |
9157 void StringAddStub::Generate(MacroAssembler* masm) { | 9160 void StringAddStub::Generate(MacroAssembler* masm) { |
9158 Label string_add_runtime; | 9161 Label string_add_runtime; |
9159 | 9162 |
9160 // Load the two arguments. | 9163 // Load the two arguments. |
9161 __ movq(rax, Operand(rsp, 2 * kPointerSize)); // First argument. | 9164 __ movq(rax, Operand(rsp, 2 * kPointerSize)); // First argument. |
9162 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); // Second argument. | 9165 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); // Second argument. |
9163 | 9166 |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9988 // Call the function from C++. | 9991 // Call the function from C++. |
9989 return FUNCTION_CAST<ModuloFunction>(buffer); | 9992 return FUNCTION_CAST<ModuloFunction>(buffer); |
9990 } | 9993 } |
9991 | 9994 |
9992 #endif | 9995 #endif |
9993 | 9996 |
9994 | 9997 |
9995 #undef __ | 9998 #undef __ |
9996 | 9999 |
9997 } } // namespace v8::internal | 10000 } } // namespace v8::internal |
OLD | NEW |