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

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

Issue 873703002: Fixed Hydrogen environment handling for mul-i on ARM and ARM64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed ARM64, too. 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/arm64/lithium-arm64.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 #include "src/arm/lithium-codegen-arm.h" 9 #include "src/arm/lithium-codegen-arm.h"
10 #include "src/hydrogen-osr.h" 10 #include "src/hydrogen-osr.h"
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 if (instr->representation().IsSmiOrInteger32()) { 1501 if (instr->representation().IsSmiOrInteger32()) {
1502 DCHECK(instr->left()->representation().Equals(instr->representation())); 1502 DCHECK(instr->left()->representation().Equals(instr->representation()));
1503 DCHECK(instr->right()->representation().Equals(instr->representation())); 1503 DCHECK(instr->right()->representation().Equals(instr->representation()));
1504 HValue* left = instr->BetterLeftOperand(); 1504 HValue* left = instr->BetterLeftOperand();
1505 HValue* right = instr->BetterRightOperand(); 1505 HValue* right = instr->BetterRightOperand();
1506 LOperand* left_op; 1506 LOperand* left_op;
1507 LOperand* right_op; 1507 LOperand* right_op;
1508 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); 1508 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1509 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero); 1509 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1510 1510
1511 int32_t constant_value = 0;
1511 if (right->IsConstant()) { 1512 if (right->IsConstant()) {
1512 HConstant* constant = HConstant::cast(right); 1513 HConstant* constant = HConstant::cast(right);
1513 int32_t constant_value = constant->Integer32Value(); 1514 constant_value = constant->Integer32Value();
1514 // Constants -1, 0 and 1 can be optimized if the result can overflow. 1515 // Constants -1, 0 and 1 can be optimized if the result can overflow.
1515 // For other constants, it can be optimized only without overflow. 1516 // For other constants, it can be optimized only without overflow.
1516 if (!can_overflow || ((constant_value >= -1) && (constant_value <= 1))) { 1517 if (!can_overflow || ((constant_value >= -1) && (constant_value <= 1))) {
1517 left_op = UseRegisterAtStart(left); 1518 left_op = UseRegisterAtStart(left);
1518 right_op = UseConstant(right); 1519 right_op = UseConstant(right);
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 } else { 1528 } else {
1528 if (bailout_on_minus_zero) { 1529 if (bailout_on_minus_zero) {
1529 left_op = UseRegister(left); 1530 left_op = UseRegister(left);
1530 } else { 1531 } else {
1531 left_op = UseRegisterAtStart(left); 1532 left_op = UseRegisterAtStart(left);
1532 } 1533 }
1533 right_op = UseRegister(right); 1534 right_op = UseRegister(right);
1534 } 1535 }
1535 LMulI* mul = new(zone()) LMulI(left_op, right_op); 1536 LMulI* mul = new(zone()) LMulI(left_op, right_op);
1536 if (can_overflow || bailout_on_minus_zero) { 1537 if (right_op->IsConstantOperand()
1538 ? ((can_overflow && constant_value == -1) ||
1539 (bailout_on_minus_zero && constant_value <= 0))
1540 : (can_overflow || bailout_on_minus_zero)) {
1537 AssignEnvironment(mul); 1541 AssignEnvironment(mul);
1538 } 1542 }
1539 return DefineAsRegister(mul); 1543 return DefineAsRegister(mul);
1540 1544
1541 } else if (instr->representation().IsDouble()) { 1545 } else if (instr->representation().IsDouble()) {
1542 if (instr->HasOneUse() && (instr->uses().value()->IsAdd() || 1546 if (instr->HasOneUse() && (instr->uses().value()->IsAdd() ||
1543 instr->uses().value()->IsSub())) { 1547 instr->uses().value()->IsSub())) {
1544 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value()); 1548 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value());
1545 1549
1546 if (use->IsAdd() && instr == use->left()) { 1550 if (use->IsAdd() && instr == use->left()) {
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 LInstruction* LChunkBuilder::DoAllocateBlockContext( 2651 LInstruction* LChunkBuilder::DoAllocateBlockContext(
2648 HAllocateBlockContext* instr) { 2652 HAllocateBlockContext* instr) {
2649 LOperand* context = UseFixed(instr->context(), cp); 2653 LOperand* context = UseFixed(instr->context(), cp);
2650 LOperand* function = UseRegisterAtStart(instr->function()); 2654 LOperand* function = UseRegisterAtStart(instr->function());
2651 LAllocateBlockContext* result = 2655 LAllocateBlockContext* result =
2652 new(zone()) LAllocateBlockContext(context, function); 2656 new(zone()) LAllocateBlockContext(context, function);
2653 return MarkAsCall(DefineFixed(result, cp), instr); 2657 return MarkAsCall(DefineFixed(result, cp), instr);
2654 } 2658 }
2655 2659
2656 } } // namespace v8::internal 2660 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm64/lithium-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698