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

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

Issue 257203002: ARM64: Use the shifter operand to merge in previous shift instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "arm64/lithium-codegen-arm64.h" 7 #include "arm64/lithium-codegen-arm64.h"
8 #include "arm64/lithium-gap-resolver-arm64.h" 8 #include "arm64/lithium-gap-resolver-arm64.h"
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "stub-cache.h" 10 #include "stub-cache.h"
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 } 1248 }
1249 1249
1250 1250
1251 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { 1251 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const {
1252 HConstant* constant = chunk_->LookupConstant(op); 1252 HConstant* constant = chunk_->LookupConstant(op);
1253 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); 1253 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged());
1254 return constant->handle(isolate()); 1254 return constant->handle(isolate());
1255 } 1255 }
1256 1256
1257 1257
1258 Operand LCodeGen::ToShiftedRightOperand32(
1259 LOperand* right, LShiftedRightOpInterface* shift_info,
1260 IntegerSignedness signedness) {
1261 if (shift_info->shift() == NO_SHIFT) {
1262 return (signedness == SIGNED_INT32) ? ToOperand32I(right)
1263 : ToOperand32U(right);
1264 } else {
1265 return Operand(
1266 ToRegister32(right),
1267 shift_info->shift(),
1268 ToInteger32(LConstantOperand::cast(shift_info->shift_amount())) & 0x1f);
ulan 2014/05/02 10:01:18 Could you name the 0x1f constant since it is used
Alexandre Rames 2014/05/02 13:51:44 Abstracted the constant and used a helper.
1269 }
1270 }
ulan 2014/05/02 10:01:18 Two empty lines after function.
Alexandre Rames 2014/05/02 13:51:44 Done.
1258 bool LCodeGen::IsSmi(LConstantOperand* op) const { 1271 bool LCodeGen::IsSmi(LConstantOperand* op) const {
1259 return chunk_->LookupLiteralRepresentation(op).IsSmi(); 1272 return chunk_->LookupLiteralRepresentation(op).IsSmi();
1260 } 1273 }
1261 1274
1262 1275
1263 bool LCodeGen::IsInteger32Constant(LConstantOperand* op) const { 1276 bool LCodeGen::IsInteger32Constant(LConstantOperand* op) const {
1264 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); 1277 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32();
1265 } 1278 }
1266 1279
1267 1280
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 1457
1445 ASSERT(!instr->hydrogen()->CheckFlag(HValue::kCanOverflow)); 1458 ASSERT(!instr->hydrogen()->CheckFlag(HValue::kCanOverflow));
1446 __ Add(result, left, right); 1459 __ Add(result, left, right);
1447 } 1460 }
1448 1461
1449 1462
1450 void LCodeGen::DoAddI(LAddI* instr) { 1463 void LCodeGen::DoAddI(LAddI* instr) {
1451 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); 1464 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1452 Register result = ToRegister32(instr->result()); 1465 Register result = ToRegister32(instr->result());
1453 Register left = ToRegister32(instr->left()); 1466 Register left = ToRegister32(instr->left());
1454 Operand right = ToOperand32I(instr->right()); 1467 Operand right = ToShiftedRightOperand32I(instr->right(), instr);
1468
1455 if (can_overflow) { 1469 if (can_overflow) {
1456 __ Adds(result, left, right); 1470 __ Adds(result, left, right);
1457 DeoptimizeIf(vs, instr->environment()); 1471 DeoptimizeIf(vs, instr->environment());
1458 } else { 1472 } else {
1459 __ Add(result, left, right); 1473 __ Add(result, left, right);
1460 } 1474 }
1461 } 1475 }
1462 1476
1463 1477
1464 void LCodeGen::DoAddS(LAddS* instr) { 1478 void LCodeGen::DoAddS(LAddS* instr) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 ASSERT(ToRegister(instr->result()).is(x0)); 1732 ASSERT(ToRegister(instr->result()).is(x0));
1719 1733
1720 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE); 1734 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE);
1721 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 1735 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1722 } 1736 }
1723 1737
1724 1738
1725 void LCodeGen::DoBitI(LBitI* instr) { 1739 void LCodeGen::DoBitI(LBitI* instr) {
1726 Register result = ToRegister32(instr->result()); 1740 Register result = ToRegister32(instr->result());
1727 Register left = ToRegister32(instr->left()); 1741 Register left = ToRegister32(instr->left());
1728 Operand right = ToOperand32U(instr->right()); 1742 Operand right = ToShiftedRightOperand32U(instr->right(), instr);
1729 1743
1730 switch (instr->op()) { 1744 switch (instr->op()) {
1731 case Token::BIT_AND: __ And(result, left, right); break; 1745 case Token::BIT_AND: __ And(result, left, right); break;
1732 case Token::BIT_OR: __ Orr(result, left, right); break; 1746 case Token::BIT_OR: __ Orr(result, left, right); break;
1733 case Token::BIT_XOR: __ Eor(result, left, right); break; 1747 case Token::BIT_XOR: __ Eor(result, left, right); break;
1734 default: 1748 default:
1735 UNREACHABLE(); 1749 UNREACHABLE();
1736 break; 1750 break;
1737 } 1751 }
1738 } 1752 }
(...skipping 3665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 Condition condition = TokenToCondition(op, false); 5418 Condition condition = TokenToCondition(op, false);
5405 5419
5406 EmitCompareAndBranch(instr, condition, x0, 0); 5420 EmitCompareAndBranch(instr, condition, x0, 0);
5407 } 5421 }
5408 5422
5409 5423
5410 void LCodeGen::DoSubI(LSubI* instr) { 5424 void LCodeGen::DoSubI(LSubI* instr) {
5411 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); 5425 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
5412 Register result = ToRegister32(instr->result()); 5426 Register result = ToRegister32(instr->result());
5413 Register left = ToRegister32(instr->left()); 5427 Register left = ToRegister32(instr->left());
5414 Operand right = ToOperand32I(instr->right()); 5428 Operand right = ToShiftedRightOperand32I(instr->right(), instr);
5429
5415 if (can_overflow) { 5430 if (can_overflow) {
5416 __ Subs(result, left, right); 5431 __ Subs(result, left, right);
5417 DeoptimizeIf(vs, instr->environment()); 5432 DeoptimizeIf(vs, instr->environment());
5418 } else { 5433 } else {
5419 __ Sub(result, left, right); 5434 __ Sub(result, left, right);
5420 } 5435 }
5421 } 5436 }
5422 5437
5423 5438
5424 void LCodeGen::DoSubS(LSubS* instr) { 5439 void LCodeGen::DoSubS(LSubS* instr) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
5876 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5891 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5877 // Index is equal to negated out of object property index plus 1. 5892 // Index is equal to negated out of object property index plus 1.
5878 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5893 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5879 __ Ldr(result, FieldMemOperand(result, 5894 __ Ldr(result, FieldMemOperand(result,
5880 FixedArray::kHeaderSize - kPointerSize)); 5895 FixedArray::kHeaderSize - kPointerSize));
5881 __ Bind(deferred->exit()); 5896 __ Bind(deferred->exit());
5882 __ Bind(&done); 5897 __ Bind(&done);
5883 } 5898 }
5884 5899
5885 } } // namespace v8::internal 5900 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698