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

Side by Side Diff: src/arm/lithium-codegen-arm.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/arm/lithium-arm.cc ('k') | src/arm/simulator-arm.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 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so 1482 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so
1483 // result may alias either of them. 1483 // result may alias either of them.
1484 LOperand* right_op = instr->right(); 1484 LOperand* right_op = instr->right();
1485 Register left = ToRegister(instr->left()); 1485 Register left = ToRegister(instr->left());
1486 Register result = ToRegister(instr->result()); 1486 Register result = ToRegister(instr->result());
1487 Register scratch = scratch0(); 1487 Register scratch = scratch0();
1488 if (right_op->IsRegister()) { 1488 if (right_op->IsRegister()) {
1489 // Mask the right_op operand. 1489 // Mask the right_op operand.
1490 __ and_(scratch, ToRegister(right_op), Operand(0x1F)); 1490 __ and_(scratch, ToRegister(right_op), Operand(0x1F));
1491 switch (instr->op()) { 1491 switch (instr->op()) {
1492 case Token::ROR:
1493 __ mov(result, Operand(left, ROR, scratch));
1494 break;
1492 case Token::SAR: 1495 case Token::SAR:
1493 __ mov(result, Operand(left, ASR, scratch)); 1496 __ mov(result, Operand(left, ASR, scratch));
1494 break; 1497 break;
1495 case Token::SHR: 1498 case Token::SHR:
1496 if (instr->can_deopt()) { 1499 if (instr->can_deopt()) {
1497 __ mov(result, Operand(left, LSR, scratch), SetCC); 1500 __ mov(result, Operand(left, LSR, scratch), SetCC);
1498 DeoptimizeIf(mi, instr->environment()); 1501 DeoptimizeIf(mi, instr->environment());
1499 } else { 1502 } else {
1500 __ mov(result, Operand(left, LSR, scratch)); 1503 __ mov(result, Operand(left, LSR, scratch));
1501 } 1504 }
1502 break; 1505 break;
1503 case Token::SHL: 1506 case Token::SHL:
1504 __ mov(result, Operand(left, LSL, scratch)); 1507 __ mov(result, Operand(left, LSL, scratch));
1505 break; 1508 break;
1506 default: 1509 default:
1507 UNREACHABLE(); 1510 UNREACHABLE();
1508 break; 1511 break;
1509 } 1512 }
1510 } else { 1513 } else {
1511 // Mask the right_op operand. 1514 // Mask the right_op operand.
1512 int value = ToInteger32(LConstantOperand::cast(right_op)); 1515 int value = ToInteger32(LConstantOperand::cast(right_op));
1513 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); 1516 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1514 switch (instr->op()) { 1517 switch (instr->op()) {
1518 case Token::ROR:
1519 if (shift_count != 0) {
1520 __ mov(result, Operand(left, ROR, shift_count));
1521 } else {
1522 __ Move(result, left);
1523 }
1524 break;
1515 case Token::SAR: 1525 case Token::SAR:
1516 if (shift_count != 0) { 1526 if (shift_count != 0) {
1517 __ mov(result, Operand(left, ASR, shift_count)); 1527 __ mov(result, Operand(left, ASR, shift_count));
1518 } else { 1528 } else {
1519 __ Move(result, left); 1529 __ Move(result, left);
1520 } 1530 }
1521 break; 1531 break;
1522 case Token::SHR: 1532 case Token::SHR:
1523 if (shift_count != 0) { 1533 if (shift_count != 0) {
1524 __ mov(result, Operand(left, LSR, shift_count)); 1534 __ mov(result, Operand(left, LSR, shift_count));
(...skipping 4173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5698 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5708 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5699 __ ldr(result, FieldMemOperand(scratch, 5709 __ ldr(result, FieldMemOperand(scratch,
5700 FixedArray::kHeaderSize - kPointerSize)); 5710 FixedArray::kHeaderSize - kPointerSize));
5701 __ bind(&done); 5711 __ bind(&done);
5702 } 5712 }
5703 5713
5704 5714
5705 #undef __ 5715 #undef __
5706 5716
5707 } } // namespace v8::internal 5717 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/simulator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698