Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1385 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
| 1386 return DoShift(Token::SHL, instr); | 1386 return DoShift(Token::SHL, instr); |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 | 1389 |
| 1390 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1390 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
| 1391 if (instr->representation().IsInteger32()) { | 1391 if (instr->representation().IsInteger32()) { |
| 1392 ASSERT(instr->left()->representation().IsInteger32()); | 1392 ASSERT(instr->left()->representation().IsInteger32()); |
| 1393 ASSERT(instr->right()->representation().IsInteger32()); | 1393 ASSERT(instr->right()->representation().IsInteger32()); |
| 1394 | 1394 |
| 1395 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1395 LOperand* left = |
| 1396 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1396 UseRegisterAtStart(instr->BetterCandidateForRegisterOperand()); |
| 1397 LOperand* right = | |
| 1398 UseOrConstantAtStart(instr->WorseCandidateForRegisterOperand()); | |
| 1397 return DefineSameAsFirst(new(zone()) LBitI(left, right)); | 1399 return DefineSameAsFirst(new(zone()) LBitI(left, right)); |
| 1398 } else { | 1400 } else { |
| 1399 ASSERT(instr->representation().IsTagged()); | 1401 ASSERT(instr->representation().IsTagged()); |
| 1400 ASSERT(instr->left()->representation().IsTagged()); | 1402 ASSERT(instr->left()->representation().IsTagged()); |
| 1401 ASSERT(instr->right()->representation().IsTagged()); | 1403 ASSERT(instr->right()->representation().IsTagged()); |
| 1402 | 1404 |
| 1403 LOperand* context = UseFixed(instr->context(), esi); | 1405 LOperand* context = UseFixed(instr->context(), esi); |
| 1404 LOperand* left = UseFixed(instr->left(), edx); | 1406 LOperand* left = UseFixed(instr->left(), edx); |
| 1405 LOperand* right = UseFixed(instr->right(), eax); | 1407 LOperand* right = UseFixed(instr->right(), eax); |
| 1406 LArithmeticT* result = | 1408 LArithmeticT* result = |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1553 LArithmeticD* result = new(zone()) LArithmeticD(Token::MOD, left, right); | 1555 LArithmeticD* result = new(zone()) LArithmeticD(Token::MOD, left, right); |
| 1554 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1556 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
| 1555 } | 1557 } |
| 1556 } | 1558 } |
| 1557 | 1559 |
| 1558 | 1560 |
| 1559 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1561 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| 1560 if (instr->representation().IsInteger32()) { | 1562 if (instr->representation().IsInteger32()) { |
| 1561 ASSERT(instr->left()->representation().IsInteger32()); | 1563 ASSERT(instr->left()->representation().IsInteger32()); |
| 1562 ASSERT(instr->right()->representation().IsInteger32()); | 1564 ASSERT(instr->right()->representation().IsInteger32()); |
| 1563 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1565 LOperand* left = |
| 1564 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1566 UseRegisterAtStart(instr->BetterCandidateForRegisterOperand()); |
| 1567 LOperand* right = | |
| 1568 UseOrConstant(instr->WorseCandidateForRegisterOperand()); | |
| 1565 LOperand* temp = NULL; | 1569 LOperand* temp = NULL; |
| 1566 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1570 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1567 temp = TempRegister(); | 1571 temp = TempRegister(); |
| 1568 } | 1572 } |
| 1569 LMulI* mul = new(zone()) LMulI(left, right, temp); | 1573 LMulI* mul = new(zone()) LMulI(left, right, temp); |
| 1570 if (instr->CheckFlag(HValue::kCanOverflow) || | 1574 if (instr->CheckFlag(HValue::kCanOverflow) || |
| 1571 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1575 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1572 AssignEnvironment(mul); | 1576 AssignEnvironment(mul); |
| 1573 } | 1577 } |
| 1574 return DefineSameAsFirst(mul); | 1578 return DefineSameAsFirst(mul); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1597 return DoArithmeticD(Token::SUB, instr); | 1601 return DoArithmeticD(Token::SUB, instr); |
| 1598 } else { | 1602 } else { |
| 1599 ASSERT(instr->representation().IsTagged()); | 1603 ASSERT(instr->representation().IsTagged()); |
| 1600 return DoArithmeticT(Token::SUB, instr); | 1604 return DoArithmeticT(Token::SUB, instr); |
| 1601 } | 1605 } |
| 1602 } | 1606 } |
| 1603 | 1607 |
| 1604 | 1608 |
| 1605 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1609 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
| 1606 if (instr->representation().IsInteger32()) { | 1610 if (instr->representation().IsInteger32()) { |
| 1611 bool use_lea = LAddI::UseLea(instr); | |
| 1607 ASSERT(instr->left()->representation().IsInteger32()); | 1612 ASSERT(instr->left()->representation().IsInteger32()); |
| 1608 ASSERT(instr->right()->representation().IsInteger32()); | 1613 ASSERT(instr->right()->representation().IsInteger32()); |
| 1609 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1614 LOperand* left = |
| 1610 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1615 UseRegisterAtStart(instr->BetterCandidateForRegisterOperand()); |
| 1616 HValue* worse_candidate = instr->WorseCandidateForRegisterOperand(); | |
| 1617 LOperand* right = use_lea | |
| 1618 ? UseRegisterOrConstantAtStart(worse_candidate) | |
| 1619 : UseOrConstantAtStart(worse_candidate); | |
| 1611 LAddI* add = new(zone()) LAddI(left, right); | 1620 LAddI* add = new(zone()) LAddI(left, right); |
| 1612 LInstruction* result = DefineSameAsFirst(add); | 1621 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); |
| 1613 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1622 // Check to see if it would be advantageous to use |
|
Jakob Kummerow
2013/05/03 09:01:37
nit: use what?
| |
| 1623 LInstruction* result = NULL; | |
| 1624 if (use_lea) { | |
| 1625 result = DefineAsRegister(add); | |
| 1626 } else { | |
| 1627 result = DefineSameAsFirst(add); | |
| 1628 } | |
| 1629 if (can_overflow) { | |
| 1614 result = AssignEnvironment(result); | 1630 result = AssignEnvironment(result); |
| 1615 } | 1631 } |
| 1616 return result; | 1632 return result; |
| 1617 } else if (instr->representation().IsDouble()) { | 1633 } else if (instr->representation().IsDouble()) { |
| 1618 return DoArithmeticD(Token::ADD, instr); | 1634 return DoArithmeticD(Token::ADD, instr); |
| 1619 } else { | 1635 } else { |
| 1620 ASSERT(instr->representation().IsTagged()); | 1636 ASSERT(instr->representation().IsTagged()); |
| 1621 return DoArithmeticT(Token::ADD, instr); | 1637 return DoArithmeticT(Token::ADD, instr); |
| 1622 } | 1638 } |
| 1623 } | 1639 } |
| 1624 | 1640 |
| 1625 | 1641 |
| 1626 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1642 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
| 1627 LOperand* left = NULL; | 1643 LOperand* left = NULL; |
| 1628 LOperand* right = NULL; | 1644 LOperand* right = NULL; |
| 1629 if (instr->representation().IsInteger32()) { | 1645 if (instr->representation().IsInteger32()) { |
| 1630 ASSERT(instr->left()->representation().IsInteger32()); | 1646 ASSERT(instr->left()->representation().IsInteger32()); |
| 1631 ASSERT(instr->right()->representation().IsInteger32()); | 1647 ASSERT(instr->right()->representation().IsInteger32()); |
| 1632 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1648 left = UseRegisterAtStart(instr->BetterCandidateForRegisterOperand()); |
| 1633 right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1649 right = UseOrConstantAtStart(instr->WorseCandidateForRegisterOperand()); |
| 1634 } else { | 1650 } else { |
| 1635 ASSERT(instr->representation().IsDouble()); | 1651 ASSERT(instr->representation().IsDouble()); |
| 1636 ASSERT(instr->left()->representation().IsDouble()); | 1652 ASSERT(instr->left()->representation().IsDouble()); |
| 1637 ASSERT(instr->right()->representation().IsDouble()); | 1653 ASSERT(instr->right()->representation().IsDouble()); |
| 1638 left = UseRegisterAtStart(instr->left()); | 1654 left = UseRegisterAtStart(instr->left()); |
| 1639 right = UseRegisterAtStart(instr->right()); | 1655 right = UseRegisterAtStart(instr->right()); |
| 1640 } | 1656 } |
| 1641 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right); | 1657 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right); |
| 1642 return DefineSameAsFirst(minmax); | 1658 return DefineSameAsFirst(minmax); |
| 1643 } | 1659 } |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2771 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2787 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2772 LOperand* object = UseRegister(instr->object()); | 2788 LOperand* object = UseRegister(instr->object()); |
| 2773 LOperand* index = UseTempRegister(instr->index()); | 2789 LOperand* index = UseTempRegister(instr->index()); |
| 2774 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2790 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2775 } | 2791 } |
| 2776 | 2792 |
| 2777 | 2793 |
| 2778 } } // namespace v8::internal | 2794 } } // namespace v8::internal |
| 2779 | 2795 |
| 2780 #endif // V8_TARGET_ARCH_IA32 | 2796 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |