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

Side by Side Diff: src/assembler.cc

Issue 8352040: Speed up comparison with a constant. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/assembler.h ('k') | src/ia32/lithium-codegen-ia32.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 (c) 2011 Sun Microsystems Inc. 1 // Copyright (c) 2011 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 BUILTIN_FP_INT_CALL)); 1130 BUILTIN_FP_INT_CALL));
1131 } 1131 }
1132 1132
1133 1133
1134 static int native_compare_doubles(double y, double x) { 1134 static int native_compare_doubles(double y, double x) {
1135 if (x == y) return EQUAL; 1135 if (x == y) return EQUAL;
1136 return x < y ? LESS : GREATER; 1136 return x < y ? LESS : GREATER;
1137 } 1137 }
1138 1138
1139 1139
1140 bool EvalComparison(Token::Value op, double op1, double op2) {
1141 ASSERT(Token::IsCompareOp(op));
1142 switch (op) {
1143 case Token::EQ:
1144 case Token::EQ_STRICT: return (op1 == op2);
1145 case Token::NE: return (op1 != op2);
1146 case Token::LT: return (op1 < op2);
1147 case Token::GT: return (op1 > op2);
1148 case Token::LTE: return (op1 <= op2);
1149 case Token::GTE: return (op1 >= op2);
1150 default:
1151 UNREACHABLE();
1152 return false;
1153 }
1154 }
1155
1156
1140 ExternalReference ExternalReference::double_fp_operation( 1157 ExternalReference ExternalReference::double_fp_operation(
1141 Token::Value operation, Isolate* isolate) { 1158 Token::Value operation, Isolate* isolate) {
1142 typedef double BinaryFPOperation(double x, double y); 1159 typedef double BinaryFPOperation(double x, double y);
1143 BinaryFPOperation* function = NULL; 1160 BinaryFPOperation* function = NULL;
1144 switch (operation) { 1161 switch (operation) {
1145 case Token::ADD: 1162 case Token::ADD:
1146 function = &add_two_doubles; 1163 function = &add_two_doubles;
1147 break; 1164 break;
1148 case Token::SUB: 1165 case Token::SUB:
1149 function = &sub_two_doubles; 1166 function = &sub_two_doubles;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1248 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1232 state_.written_position = state_.current_position; 1249 state_.written_position = state_.current_position;
1233 written = true; 1250 written = true;
1234 } 1251 }
1235 1252
1236 // Return whether something was written. 1253 // Return whether something was written.
1237 return written; 1254 return written;
1238 } 1255 }
1239 1256
1240 } } // namespace v8::internal 1257 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698