| OLD | NEW |
| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/lithium-allocator-inl.h" | 7 #include "src/lithium-allocator-inl.h" |
| 8 #include "src/arm/lithium-arm.h" | 8 #include "src/arm/lithium-arm.h" |
| 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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 } | 1493 } |
| 1494 right_op = UseRegister(right); | 1494 right_op = UseRegister(right); |
| 1495 } | 1495 } |
| 1496 LMulI* mul = new(zone()) LMulI(left_op, right_op); | 1496 LMulI* mul = new(zone()) LMulI(left_op, right_op); |
| 1497 if (can_overflow || bailout_on_minus_zero) { | 1497 if (can_overflow || bailout_on_minus_zero) { |
| 1498 AssignEnvironment(mul); | 1498 AssignEnvironment(mul); |
| 1499 } | 1499 } |
| 1500 return DefineAsRegister(mul); | 1500 return DefineAsRegister(mul); |
| 1501 | 1501 |
| 1502 } else if (instr->representation().IsDouble()) { | 1502 } else if (instr->representation().IsDouble()) { |
| 1503 if (instr->UseCount() == 1 && (instr->uses().value()->IsAdd() || | 1503 if (instr->HasOneUse() && (instr->uses().value()->IsAdd() || |
| 1504 instr->uses().value()->IsSub())) { | 1504 instr->uses().value()->IsSub())) { |
| 1505 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value()); | 1505 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value()); |
| 1506 | 1506 |
| 1507 if (use->IsAdd() && instr == use->left()) { | 1507 if (use->IsAdd() && instr == use->left()) { |
| 1508 // This mul is the lhs of an add. The add and mul will be folded into a | 1508 // This mul is the lhs of an add. The add and mul will be folded into a |
| 1509 // multiply-add in DoAdd. | 1509 // multiply-add in DoAdd. |
| 1510 return NULL; | 1510 return NULL; |
| 1511 } | 1511 } |
| 1512 if (instr == use->right() && use->IsAdd() && !use->left()->IsMul()) { | 1512 if (instr == use->right() && use->IsAdd() && !use->left()->IsMul()) { |
| 1513 // This mul is the rhs of an add, where the lhs is not another mul. | 1513 // This mul is the rhs of an add, where the lhs is not another mul. |
| 1514 // The add and mul will be folded into a multiply-add in DoAdd. | 1514 // The add and mul will be folded into a multiply-add in DoAdd. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1540 | 1540 |
| 1541 LOperand* left = UseRegisterAtStart(instr->left()); | 1541 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1542 LOperand* right = UseOrConstantAtStart(instr->right()); | 1542 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1543 LSubI* sub = new(zone()) LSubI(left, right); | 1543 LSubI* sub = new(zone()) LSubI(left, right); |
| 1544 LInstruction* result = DefineAsRegister(sub); | 1544 LInstruction* result = DefineAsRegister(sub); |
| 1545 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1545 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1546 result = AssignEnvironment(result); | 1546 result = AssignEnvironment(result); |
| 1547 } | 1547 } |
| 1548 return result; | 1548 return result; |
| 1549 } else if (instr->representation().IsDouble()) { | 1549 } else if (instr->representation().IsDouble()) { |
| 1550 if (instr->right()->IsMul()) { | 1550 if (instr->right()->IsMul() && instr->right()->HasOneUse()) { |
| 1551 return DoMultiplySub(instr->left(), HMul::cast(instr->right())); | 1551 return DoMultiplySub(instr->left(), HMul::cast(instr->right())); |
| 1552 } | 1552 } |
| 1553 | 1553 |
| 1554 return DoArithmeticD(Token::SUB, instr); | 1554 return DoArithmeticD(Token::SUB, instr); |
| 1555 } else { | 1555 } else { |
| 1556 return DoArithmeticT(Token::SUB, instr); | 1556 return DoArithmeticT(Token::SUB, instr); |
| 1557 } | 1557 } |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 | 1560 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 } else if (instr->representation().IsExternal()) { | 1611 } else if (instr->representation().IsExternal()) { |
| 1612 ASSERT(instr->left()->representation().IsExternal()); | 1612 ASSERT(instr->left()->representation().IsExternal()); |
| 1613 ASSERT(instr->right()->representation().IsInteger32()); | 1613 ASSERT(instr->right()->representation().IsInteger32()); |
| 1614 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); | 1614 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); |
| 1615 LOperand* left = UseRegisterAtStart(instr->left()); | 1615 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1616 LOperand* right = UseOrConstantAtStart(instr->right()); | 1616 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1617 LAddI* add = new(zone()) LAddI(left, right); | 1617 LAddI* add = new(zone()) LAddI(left, right); |
| 1618 LInstruction* result = DefineAsRegister(add); | 1618 LInstruction* result = DefineAsRegister(add); |
| 1619 return result; | 1619 return result; |
| 1620 } else if (instr->representation().IsDouble()) { | 1620 } else if (instr->representation().IsDouble()) { |
| 1621 if (instr->left()->IsMul()) { | 1621 if (instr->left()->IsMul() && instr->left()->HasOneUse()) { |
| 1622 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1622 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 if (instr->right()->IsMul()) { | 1625 if (instr->right()->IsMul() && instr->right()->HasOneUse()) { |
| 1626 ASSERT(!instr->left()->IsMul()); | 1626 ASSERT(!instr->left()->IsMul() || !instr->left()->HasOneUse()); |
| 1627 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); | 1627 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); |
| 1628 } | 1628 } |
| 1629 | 1629 |
| 1630 return DoArithmeticD(Token::ADD, instr); | 1630 return DoArithmeticD(Token::ADD, instr); |
| 1631 } else { | 1631 } else { |
| 1632 return DoArithmeticT(Token::ADD, instr); | 1632 return DoArithmeticT(Token::ADD, instr); |
| 1633 } | 1633 } |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 | 1636 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 LInstruction* LChunkBuilder::DoAllocateBlockContext( | 2589 LInstruction* LChunkBuilder::DoAllocateBlockContext( |
| 2590 HAllocateBlockContext* instr) { | 2590 HAllocateBlockContext* instr) { |
| 2591 LOperand* context = UseFixed(instr->context(), cp); | 2591 LOperand* context = UseFixed(instr->context(), cp); |
| 2592 LOperand* function = UseRegisterAtStart(instr->function()); | 2592 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2593 LAllocateBlockContext* result = | 2593 LAllocateBlockContext* result = |
| 2594 new(zone()) LAllocateBlockContext(context, function); | 2594 new(zone()) LAllocateBlockContext(context, function); |
| 2595 return MarkAsCall(DefineFixed(result, cp), instr); | 2595 return MarkAsCall(DefineFixed(result, cp), instr); |
| 2596 } | 2596 } |
| 2597 | 2597 |
| 2598 } } // namespace v8::internal | 2598 } } // namespace v8::internal |
| OLD | NEW |