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

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

Issue 11033005: Add rotate-right instruction to hydrogen and use it instead of bitwise operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 1203
1204 void LCodeGen::DoShiftI(LShiftI* instr) { 1204 void LCodeGen::DoShiftI(LShiftI* instr) {
1205 LOperand* left = instr->left(); 1205 LOperand* left = instr->left();
1206 LOperand* right = instr->right(); 1206 LOperand* right = instr->right();
1207 ASSERT(left->Equals(instr->result())); 1207 ASSERT(left->Equals(instr->result()));
1208 ASSERT(left->IsRegister()); 1208 ASSERT(left->IsRegister());
1209 if (right->IsRegister()) { 1209 if (right->IsRegister()) {
1210 ASSERT(ToRegister(right).is(rcx)); 1210 ASSERT(ToRegister(right).is(rcx));
1211 1211
1212 switch (instr->op()) { 1212 switch (instr->op()) {
1213 case Token::ROR:
1214 __ rorl_cl(ToRegister(left));
1215 break;
1213 case Token::SAR: 1216 case Token::SAR:
1214 __ sarl_cl(ToRegister(left)); 1217 __ sarl_cl(ToRegister(left));
1215 break; 1218 break;
1216 case Token::SHR: 1219 case Token::SHR:
1217 __ shrl_cl(ToRegister(left)); 1220 __ shrl_cl(ToRegister(left));
1218 if (instr->can_deopt()) { 1221 if (instr->can_deopt()) {
1219 __ testl(ToRegister(left), ToRegister(left)); 1222 __ testl(ToRegister(left), ToRegister(left));
1220 DeoptimizeIf(negative, instr->environment()); 1223 DeoptimizeIf(negative, instr->environment());
1221 } 1224 }
1222 break; 1225 break;
1223 case Token::SHL: 1226 case Token::SHL:
1224 __ shll_cl(ToRegister(left)); 1227 __ shll_cl(ToRegister(left));
1225 break; 1228 break;
1226 default: 1229 default:
1227 UNREACHABLE(); 1230 UNREACHABLE();
1228 break; 1231 break;
1229 } 1232 }
1230 } else { 1233 } else {
1231 int value = ToInteger32(LConstantOperand::cast(right)); 1234 int value = ToInteger32(LConstantOperand::cast(right));
1232 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); 1235 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1233 switch (instr->op()) { 1236 switch (instr->op()) {
1237 case Token::ROR:
1238 if (shift_count != 0) {
1239 __ rorl(ToRegister(left), Immediate(shift_count));
1240 }
1241 break;
1234 case Token::SAR: 1242 case Token::SAR:
1235 if (shift_count != 0) { 1243 if (shift_count != 0) {
1236 __ sarl(ToRegister(left), Immediate(shift_count)); 1244 __ sarl(ToRegister(left), Immediate(shift_count));
1237 } 1245 }
1238 break; 1246 break;
1239 case Token::SHR: 1247 case Token::SHR:
1240 if (shift_count == 0 && instr->can_deopt()) { 1248 if (shift_count == 0 && instr->can_deopt()) {
1241 __ testl(ToRegister(left), ToRegister(left)); 1249 __ testl(ToRegister(left), ToRegister(left));
1242 DeoptimizeIf(negative, instr->environment()); 1250 DeoptimizeIf(negative, instr->environment());
1243 } else { 1251 } else {
(...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after
5322 FixedArray::kHeaderSize - kPointerSize)); 5330 FixedArray::kHeaderSize - kPointerSize));
5323 __ bind(&done); 5331 __ bind(&done);
5324 } 5332 }
5325 5333
5326 5334
5327 #undef __ 5335 #undef __
5328 5336
5329 } } // namespace v8::internal 5337 } } // namespace v8::internal
5330 5338
5331 #endif // V8_TARGET_ARCH_X64 5339 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698