| 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/x64/lithium-x64.h" | 5 #include "src/crankshaft/x64/lithium-x64.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
| 10 | 10 |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 return DoArithmeticT(Token::MOD, instr); | 1504 return DoArithmeticT(Token::MOD, instr); |
| 1505 } | 1505 } |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 | 1508 |
| 1509 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1509 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| 1510 if (instr->representation().IsSmiOrInteger32()) { | 1510 if (instr->representation().IsSmiOrInteger32()) { |
| 1511 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1511 DCHECK(instr->left()->representation().Equals(instr->representation())); |
| 1512 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1512 DCHECK(instr->right()->representation().Equals(instr->representation())); |
| 1513 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1513 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1514 LOperand* right = UseOrConstant(instr->BetterRightOperand()); | 1514 HValue* h_right = instr->BetterRightOperand(); |
| 1515 LOperand* right = UseOrConstant(h_right); |
| 1515 LMulI* mul = new(zone()) LMulI(left, right); | 1516 LMulI* mul = new(zone()) LMulI(left, right); |
| 1516 if (instr->CheckFlag(HValue::kCanOverflow) || | 1517 int constant_value = |
| 1517 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1518 h_right->IsConstant() ? HConstant::cast(h_right)->Integer32Value() : 0; |
| 1519 // |needs_environment| must mirror the cases where LCodeGen::DoMulI calls |
| 1520 // |DeoptimizeIf|. |
| 1521 bool needs_environment = |
| 1522 instr->CheckFlag(HValue::kCanOverflow) || |
| 1523 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
| 1524 (!right->IsConstantOperand() || constant_value <= 0)); |
| 1525 if (needs_environment) { |
| 1518 AssignEnvironment(mul); | 1526 AssignEnvironment(mul); |
| 1519 } | 1527 } |
| 1520 return DefineSameAsFirst(mul); | 1528 return DefineSameAsFirst(mul); |
| 1521 } else if (instr->representation().IsDouble()) { | 1529 } else if (instr->representation().IsDouble()) { |
| 1522 return DoArithmeticD(Token::MUL, instr); | 1530 return DoArithmeticD(Token::MUL, instr); |
| 1523 } else { | 1531 } else { |
| 1524 return DoArithmeticT(Token::MUL, instr); | 1532 return DoArithmeticT(Token::MUL, instr); |
| 1525 } | 1533 } |
| 1526 } | 1534 } |
| 1527 | 1535 |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 LAllocateBlockContext* result = | 2684 LAllocateBlockContext* result = |
| 2677 new(zone()) LAllocateBlockContext(context, function); | 2685 new(zone()) LAllocateBlockContext(context, function); |
| 2678 return MarkAsCall(DefineFixed(result, rsi), instr); | 2686 return MarkAsCall(DefineFixed(result, rsi), instr); |
| 2679 } | 2687 } |
| 2680 | 2688 |
| 2681 | 2689 |
| 2682 } // namespace internal | 2690 } // namespace internal |
| 2683 } // namespace v8 | 2691 } // namespace v8 |
| 2684 | 2692 |
| 2685 #endif // V8_TARGET_ARCH_X64 | 2693 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |