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

Side by Side Diff: src/mips/lithium-mips.cc

Issue 879473002: MIPS: Fixed Hydrogen environment handling for mul-i ARM and ARM64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | src/mips64/lithium-mips64.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 // 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 <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 if (instr->representation().IsSmiOrInteger32()) { 1493 if (instr->representation().IsSmiOrInteger32()) {
1494 DCHECK(instr->left()->representation().Equals(instr->representation())); 1494 DCHECK(instr->left()->representation().Equals(instr->representation()));
1495 DCHECK(instr->right()->representation().Equals(instr->representation())); 1495 DCHECK(instr->right()->representation().Equals(instr->representation()));
1496 HValue* left = instr->BetterLeftOperand(); 1496 HValue* left = instr->BetterLeftOperand();
1497 HValue* right = instr->BetterRightOperand(); 1497 HValue* right = instr->BetterRightOperand();
1498 LOperand* left_op; 1498 LOperand* left_op;
1499 LOperand* right_op; 1499 LOperand* right_op;
1500 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); 1500 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1501 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero); 1501 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1502 1502
1503 int32_t constant_value = 0;
1503 if (right->IsConstant()) { 1504 if (right->IsConstant()) {
1504 HConstant* constant = HConstant::cast(right); 1505 HConstant* constant = HConstant::cast(right);
1505 int32_t constant_value = constant->Integer32Value(); 1506 constant_value = constant->Integer32Value();
1506 // Constants -1, 0 and 1 can be optimized if the result can overflow. 1507 // Constants -1, 0 and 1 can be optimized if the result can overflow.
1507 // For other constants, it can be optimized only without overflow. 1508 // For other constants, it can be optimized only without overflow.
1508 if (!can_overflow || ((constant_value >= -1) && (constant_value <= 1))) { 1509 if (!can_overflow || ((constant_value >= -1) && (constant_value <= 1))) {
1509 left_op = UseRegisterAtStart(left); 1510 left_op = UseRegisterAtStart(left);
1510 right_op = UseConstant(right); 1511 right_op = UseConstant(right);
1511 } else { 1512 } else {
1512 if (bailout_on_minus_zero) { 1513 if (bailout_on_minus_zero) {
1513 left_op = UseRegister(left); 1514 left_op = UseRegister(left);
1514 } else { 1515 } else {
1515 left_op = UseRegisterAtStart(left); 1516 left_op = UseRegisterAtStart(left);
1516 } 1517 }
1517 right_op = UseRegister(right); 1518 right_op = UseRegister(right);
1518 } 1519 }
1519 } else { 1520 } else {
1520 if (bailout_on_minus_zero) { 1521 if (bailout_on_minus_zero) {
1521 left_op = UseRegister(left); 1522 left_op = UseRegister(left);
1522 } else { 1523 } else {
1523 left_op = UseRegisterAtStart(left); 1524 left_op = UseRegisterAtStart(left);
1524 } 1525 }
1525 right_op = UseRegister(right); 1526 right_op = UseRegister(right);
1526 } 1527 }
1527 LMulI* mul = new(zone()) LMulI(left_op, right_op); 1528 LMulI* mul = new(zone()) LMulI(left_op, right_op);
1528 if (can_overflow || bailout_on_minus_zero) { 1529 if (right_op->IsConstantOperand()
1530 ? ((can_overflow && constant_value == -1) ||
1531 (bailout_on_minus_zero && constant_value <= 0))
1532 : (can_overflow || bailout_on_minus_zero)) {
1529 AssignEnvironment(mul); 1533 AssignEnvironment(mul);
1530 } 1534 }
1531 return DefineAsRegister(mul); 1535 return DefineAsRegister(mul);
1532 1536
1533 } else if (instr->representation().IsDouble()) { 1537 } else if (instr->representation().IsDouble()) {
1534 if (IsMipsArchVariant(kMips32r2)) { 1538 if (IsMipsArchVariant(kMips32r2)) {
1535 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) { 1539 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) {
1536 HAdd* add = HAdd::cast(instr->uses().value()); 1540 HAdd* add = HAdd::cast(instr->uses().value());
1537 if (instr == add->left()) { 1541 if (instr == add->left()) {
1538 // This mul is the lhs of an add. The add and mul will be folded 1542 // This mul is the lhs of an add. The add and mul will be folded
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 LOperand* context = UseFixed(instr->context(), cp); 2601 LOperand* context = UseFixed(instr->context(), cp);
2598 LOperand* function = UseRegisterAtStart(instr->function()); 2602 LOperand* function = UseRegisterAtStart(instr->function());
2599 LAllocateBlockContext* result = 2603 LAllocateBlockContext* result =
2600 new(zone()) LAllocateBlockContext(context, function); 2604 new(zone()) LAllocateBlockContext(context, function);
2601 return MarkAsCall(DefineFixed(result, cp), instr); 2605 return MarkAsCall(DefineFixed(result, cp), instr);
2602 } 2606 }
2603 2607
2604 } } // namespace v8::internal 2608 } } // namespace v8::internal
2605 2609
2606 #endif // V8_TARGET_ARCH_MIPS 2610 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/lithium-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698