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/crankshaft/x87/lithium-x87.h" | 5 #include "src/crankshaft/x87/lithium-x87.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_X87 | 9 #if V8_TARGET_ARCH_X87 |
10 | 10 |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 return DoArithmeticT(Token::MOD, instr); | 1527 return DoArithmeticT(Token::MOD, instr); |
1528 } | 1528 } |
1529 } | 1529 } |
1530 | 1530 |
1531 | 1531 |
1532 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1532 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
1533 if (instr->representation().IsSmiOrInteger32()) { | 1533 if (instr->representation().IsSmiOrInteger32()) { |
1534 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1534 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1535 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1535 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1536 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1536 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1537 LOperand* right = UseOrConstant(instr->BetterRightOperand()); | 1537 HValue* h_right = instr->BetterRightOperand(); |
| 1538 LOperand* right = UseOrConstant(h_right); |
1538 LOperand* temp = NULL; | 1539 LOperand* temp = NULL; |
1539 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1540 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1540 temp = TempRegister(); | 1541 temp = TempRegister(); |
1541 } | 1542 } |
1542 LMulI* mul = new(zone()) LMulI(left, right, temp); | 1543 LMulI* mul = new(zone()) LMulI(left, right, temp); |
1543 if (instr->CheckFlag(HValue::kCanOverflow) || | 1544 int constant_value = |
1544 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1545 h_right->IsConstant() ? HConstant::cast(h_right)->Integer32Value() : 0; |
| 1546 // |needs_environment| must mirror the cases where LCodeGen::DoMulI calls |
| 1547 // |DeoptimizeIf|. |
| 1548 bool needs_environment = |
| 1549 instr->CheckFlag(HValue::kCanOverflow) || |
| 1550 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
| 1551 (!right->IsConstantOperand() || constant_value <= 0)); |
| 1552 if (needs_environment) { |
1545 AssignEnvironment(mul); | 1553 AssignEnvironment(mul); |
1546 } | 1554 } |
1547 return DefineSameAsFirst(mul); | 1555 return DefineSameAsFirst(mul); |
1548 } else if (instr->representation().IsDouble()) { | 1556 } else if (instr->representation().IsDouble()) { |
1549 return DoArithmeticD(Token::MUL, instr); | 1557 return DoArithmeticD(Token::MUL, instr); |
1550 } else { | 1558 } else { |
1551 return DoArithmeticT(Token::MUL, instr); | 1559 return DoArithmeticT(Token::MUL, instr); |
1552 } | 1560 } |
1553 } | 1561 } |
1554 | 1562 |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 LAllocateBlockContext* result = | 2699 LAllocateBlockContext* result = |
2692 new(zone()) LAllocateBlockContext(context, function); | 2700 new(zone()) LAllocateBlockContext(context, function); |
2693 return MarkAsCall(DefineFixed(result, esi), instr); | 2701 return MarkAsCall(DefineFixed(result, esi), instr); |
2694 } | 2702 } |
2695 | 2703 |
2696 | 2704 |
2697 } // namespace internal | 2705 } // namespace internal |
2698 } // namespace v8 | 2706 } // namespace v8 |
2699 | 2707 |
2700 #endif // V8_TARGET_ARCH_X87 | 2708 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |