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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 1251009: Re-apply "Inline floating point compare"... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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
OLDNEW
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 9087 matching lines...) Expand 10 before | Expand all | Expand 10 after
9098 Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) { 9098 Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) {
9099 GenericBinaryOpStub stub(key, type_info); 9099 GenericBinaryOpStub stub(key, type_info);
9100 return stub.GetCode(); 9100 return stub.GetCode();
9101 } 9101 }
9102 9102
9103 9103
9104 int CompareStub::MinorKey() { 9104 int CompareStub::MinorKey() {
9105 // Encode the three parameters in a unique 16 bit value. To avoid duplicate 9105 // Encode the three parameters in a unique 16 bit value. To avoid duplicate
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 << 14)); 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 } 9113 }
9113 9114
9114 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.
9115 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;
9116 switch (cc_) { 9125 switch (cc_) {
9117 case less: return "CompareStub_LT"; 9126 case less: cc_name = "LT"; break;
9118 case greater: return "CompareStub_GT"; 9127 case greater: cc_name = "GT"; break;
9119 case less_equal: return "CompareStub_LE"; 9128 case less_equal: cc_name = "LE"; break;
9120 case greater_equal: return "CompareStub_GE"; 9129 case greater_equal: cc_name = "GE"; break;
9121 case not_equal: { 9130 case equal: cc_name = "EQ"; break;
9122 if (strict_) { 9131 case not_equal: cc_name = "NE"; break;
9123 if (never_nan_nan_) { 9132 default: cc_name = "UnknownCondition"; break;
9124 return "CompareStub_NE_STRICT_NO_NAN";
9125 } else {
9126 return "CompareStub_NE_STRICT";
9127 }
9128 } else {
9129 if (never_nan_nan_) {
9130 return "CompareStub_NE_NO_NAN";
9131 } else {
9132 return "CompareStub_NE";
9133 }
9134 }
9135 }
9136 case equal: {
9137 if (strict_) {
9138 if (never_nan_nan_) {
9139 return "CompareStub_EQ_STRICT_NO_NAN";
9140 } else {
9141 return "CompareStub_EQ_STRICT";
9142 }
9143 } else {
9144 if (never_nan_nan_) {
9145 return "CompareStub_EQ_NO_NAN";
9146 } else {
9147 return "CompareStub_EQ";
9148 }
9149 }
9150 }
9151 default: return "CompareStub";
9152 } 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_;
9153 } 9157 }
9154 9158
9155 9159
9156 void StringAddStub::Generate(MacroAssembler* masm) { 9160 void StringAddStub::Generate(MacroAssembler* masm) {
9157 Label string_add_runtime; 9161 Label string_add_runtime;
9158 9162
9159 // Load the two arguments. 9163 // Load the two arguments.
9160 __ movq(rax, Operand(rsp, 2 * kPointerSize)); // First argument. 9164 __ movq(rax, Operand(rsp, 2 * kPointerSize)); // First argument.
9161 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); // Second argument. 9165 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); // Second argument.
9162 9166
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
9987 // Call the function from C++. 9991 // Call the function from C++.
9988 return FUNCTION_CAST<ModuloFunction>(buffer); 9992 return FUNCTION_CAST<ModuloFunction>(buffer);
9989 } 9993 }
9990 9994
9991 #endif 9995 #endif
9992 9996
9993 9997
9994 #undef __ 9998 #undef __
9995 9999
9996 } } // namespace v8::internal 10000 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698