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 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/lithium-inl.h" | 10 #include "src/lithium-inl.h" |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 return result; | 1318 return result; |
1319 } | 1319 } |
1320 | 1320 |
1321 | 1321 |
1322 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { | 1322 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { |
1323 DCHECK(instr->representation().IsSmiOrInteger32()); | 1323 DCHECK(instr->representation().IsSmiOrInteger32()); |
1324 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1324 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1325 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1325 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1326 LOperand* dividend = UseRegister(instr->left()); | 1326 LOperand* dividend = UseRegister(instr->left()); |
1327 LOperand* divisor = UseRegister(instr->right()); | 1327 LOperand* divisor = UseRegister(instr->right()); |
1328 LOperand* temp = TempRegister(); | |
1329 LInstruction* result = | 1328 LInstruction* result = |
1330 DefineAsRegister(new(zone()) LDivI(dividend, divisor, temp)); | 1329 DefineAsRegister(new(zone()) LDivI(dividend, divisor)); |
1331 if (instr->CheckFlag(HValue::kCanBeDivByZero) || | 1330 if (instr->CheckFlag(HValue::kCanBeDivByZero) || |
1332 instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1331 instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
1333 (instr->CheckFlag(HValue::kCanOverflow) && | 1332 (instr->CheckFlag(HValue::kCanOverflow) && |
1334 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) || | 1333 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) || |
1335 (!instr->IsMathFloorOfDiv() && | 1334 (!instr->IsMathFloorOfDiv() && |
1336 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) { | 1335 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) { |
1337 result = AssignEnvironment(result); | 1336 result = AssignEnvironment(result); |
1338 } | 1337 } |
1339 return result; | 1338 return result; |
1340 } | 1339 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 } | 1504 } |
1506 right_op = UseRegister(right); | 1505 right_op = UseRegister(right); |
1507 } | 1506 } |
1508 LMulI* mul = new(zone()) LMulI(left_op, right_op); | 1507 LMulI* mul = new(zone()) LMulI(left_op, right_op); |
1509 if (can_overflow || bailout_on_minus_zero) { | 1508 if (can_overflow || bailout_on_minus_zero) { |
1510 AssignEnvironment(mul); | 1509 AssignEnvironment(mul); |
1511 } | 1510 } |
1512 return DefineAsRegister(mul); | 1511 return DefineAsRegister(mul); |
1513 | 1512 |
1514 } else if (instr->representation().IsDouble()) { | 1513 } else if (instr->representation().IsDouble()) { |
1515 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { | 1514 if (kArchVariant == kMips32r2) { |
1516 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) { | 1515 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) { |
1517 HAdd* add = HAdd::cast(instr->uses().value()); | 1516 HAdd* add = HAdd::cast(instr->uses().value()); |
1518 if (instr == add->left()) { | 1517 if (instr == add->left()) { |
1519 // This mul is the lhs of an add. The add and mul will be folded | 1518 // This mul is the lhs of an add. The add and mul will be folded |
1520 // into a multiply-add. | 1519 // into a multiply-add. |
1521 return NULL; | 1520 return NULL; |
1522 } | 1521 } |
1523 if (instr == add->right() && !add->left()->IsMul()) { | 1522 if (instr == add->right() && !add->left()->IsMul()) { |
1524 // This mul is the rhs of an add, where the lhs is not another mul. | 1523 // This mul is the rhs of an add, where the lhs is not another mul. |
1525 // The add and mul will be folded into a multiply-add. | 1524 // The add and mul will be folded into a multiply-add. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 } else if (instr->representation().IsExternal()) { | 1577 } else if (instr->representation().IsExternal()) { |
1579 DCHECK(instr->left()->representation().IsExternal()); | 1578 DCHECK(instr->left()->representation().IsExternal()); |
1580 DCHECK(instr->right()->representation().IsInteger32()); | 1579 DCHECK(instr->right()->representation().IsInteger32()); |
1581 DCHECK(!instr->CheckFlag(HValue::kCanOverflow)); | 1580 DCHECK(!instr->CheckFlag(HValue::kCanOverflow)); |
1582 LOperand* left = UseRegisterAtStart(instr->left()); | 1581 LOperand* left = UseRegisterAtStart(instr->left()); |
1583 LOperand* right = UseOrConstantAtStart(instr->right()); | 1582 LOperand* right = UseOrConstantAtStart(instr->right()); |
1584 LAddI* add = new(zone()) LAddI(left, right); | 1583 LAddI* add = new(zone()) LAddI(left, right); |
1585 LInstruction* result = DefineAsRegister(add); | 1584 LInstruction* result = DefineAsRegister(add); |
1586 return result; | 1585 return result; |
1587 } else if (instr->representation().IsDouble()) { | 1586 } else if (instr->representation().IsDouble()) { |
1588 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { | 1587 if (kArchVariant == kMips32r2) { |
1589 if (instr->left()->IsMul()) | 1588 if (instr->left()->IsMul()) |
1590 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1589 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
1591 | 1590 |
1592 if (instr->right()->IsMul()) { | 1591 if (instr->right()->IsMul()) { |
1593 DCHECK(!instr->left()->IsMul()); | 1592 DCHECK(!instr->left()->IsMul()); |
1594 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); | 1593 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); |
1595 } | 1594 } |
1596 } | 1595 } |
1597 return DoArithmeticD(Token::ADD, instr); | 1596 return DoArithmeticD(Token::ADD, instr); |
1598 } else { | 1597 } else { |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 LOperand* context = UseFixed(instr->context(), cp); | 2571 LOperand* context = UseFixed(instr->context(), cp); |
2573 LOperand* function = UseRegisterAtStart(instr->function()); | 2572 LOperand* function = UseRegisterAtStart(instr->function()); |
2574 LAllocateBlockContext* result = | 2573 LAllocateBlockContext* result = |
2575 new(zone()) LAllocateBlockContext(context, function); | 2574 new(zone()) LAllocateBlockContext(context, function); |
2576 return MarkAsCall(DefineFixed(result, cp), instr); | 2575 return MarkAsCall(DefineFixed(result, cp), instr); |
2577 } | 2576 } |
2578 | 2577 |
2579 } } // namespace v8::internal | 2578 } } // namespace v8::internal |
2580 | 2579 |
2581 #endif // V8_TARGET_ARCH_MIPS | 2580 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |