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