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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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: rebase Created 8 years, 1 month 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/ia32/assembler-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('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 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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 1293
1294 void LCodeGen::DoShiftI(LShiftI* instr) { 1294 void LCodeGen::DoShiftI(LShiftI* instr) {
1295 LOperand* left = instr->left(); 1295 LOperand* left = instr->left();
1296 LOperand* right = instr->right(); 1296 LOperand* right = instr->right();
1297 ASSERT(left->Equals(instr->result())); 1297 ASSERT(left->Equals(instr->result()));
1298 ASSERT(left->IsRegister()); 1298 ASSERT(left->IsRegister());
1299 if (right->IsRegister()) { 1299 if (right->IsRegister()) {
1300 ASSERT(ToRegister(right).is(ecx)); 1300 ASSERT(ToRegister(right).is(ecx));
1301 1301
1302 switch (instr->op()) { 1302 switch (instr->op()) {
1303 case Token::ROR:
1304 __ ror_cl(ToRegister(left));
1305 if (instr->can_deopt()) {
1306 __ test(ToRegister(left), Immediate(0x80000000));
1307 DeoptimizeIf(not_zero, instr->environment());
1308 }
1309 break;
1303 case Token::SAR: 1310 case Token::SAR:
1304 __ sar_cl(ToRegister(left)); 1311 __ sar_cl(ToRegister(left));
1305 break; 1312 break;
1306 case Token::SHR: 1313 case Token::SHR:
1307 __ shr_cl(ToRegister(left)); 1314 __ shr_cl(ToRegister(left));
1308 if (instr->can_deopt()) { 1315 if (instr->can_deopt()) {
1309 __ test(ToRegister(left), Immediate(0x80000000)); 1316 __ test(ToRegister(left), Immediate(0x80000000));
1310 DeoptimizeIf(not_zero, instr->environment()); 1317 DeoptimizeIf(not_zero, instr->environment());
1311 } 1318 }
1312 break; 1319 break;
1313 case Token::SHL: 1320 case Token::SHL:
1314 __ shl_cl(ToRegister(left)); 1321 __ shl_cl(ToRegister(left));
1315 break; 1322 break;
1316 default: 1323 default:
1317 UNREACHABLE(); 1324 UNREACHABLE();
1318 break; 1325 break;
1319 } 1326 }
1320 } else { 1327 } else {
1321 int value = ToInteger32(LConstantOperand::cast(right)); 1328 int value = ToInteger32(LConstantOperand::cast(right));
1322 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); 1329 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1323 switch (instr->op()) { 1330 switch (instr->op()) {
1331 case Token::ROR:
1332 if (shift_count == 0 && instr->can_deopt()) {
1333 __ test(ToRegister(left), Immediate(0x80000000));
1334 DeoptimizeIf(not_zero, instr->environment());
1335 } else {
1336 __ ror(ToRegister(left), shift_count);
1337 }
1338 break;
1324 case Token::SAR: 1339 case Token::SAR:
1325 if (shift_count != 0) { 1340 if (shift_count != 0) {
1326 __ sar(ToRegister(left), shift_count); 1341 __ sar(ToRegister(left), shift_count);
1327 } 1342 }
1328 break; 1343 break;
1329 case Token::SHR: 1344 case Token::SHR:
1330 if (shift_count == 0 && instr->can_deopt()) { 1345 if (shift_count == 0 && instr->can_deopt()) {
1331 __ test(ToRegister(left), Immediate(0x80000000)); 1346 __ test(ToRegister(left), Immediate(0x80000000));
1332 DeoptimizeIf(not_zero, instr->environment()); 1347 DeoptimizeIf(not_zero, instr->environment());
1333 } else { 1348 } else {
(...skipping 4223 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 FixedArray::kHeaderSize - kPointerSize)); 5572 FixedArray::kHeaderSize - kPointerSize));
5558 __ bind(&done); 5573 __ bind(&done);
5559 } 5574 }
5560 5575
5561 5576
5562 #undef __ 5577 #undef __
5563 5578
5564 } } // namespace v8::internal 5579 } } // namespace v8::internal
5565 5580
5566 #endif // V8_TARGET_ARCH_IA32 5581 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698