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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1298 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
1299 return DoShift(Token::SHL, instr); | 1299 return DoShift(Token::SHL, instr); |
1300 } | 1300 } |
1301 | 1301 |
1302 | 1302 |
1303 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1303 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
1304 if (instr->representation().IsInteger32()) { | 1304 if (instr->representation().IsInteger32()) { |
1305 ASSERT(instr->left()->representation().IsInteger32()); | 1305 ASSERT(instr->left()->representation().IsInteger32()); |
1306 ASSERT(instr->right()->representation().IsInteger32()); | 1306 ASSERT(instr->right()->representation().IsInteger32()); |
1307 | 1307 |
1308 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1308 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1309 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1309 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1310 return DefineAsRegister(new(zone()) LBitI(left, right)); | 1310 return DefineAsRegister(new(zone()) LBitI(left, right)); |
1311 } else { | 1311 } else { |
1312 ASSERT(instr->representation().IsTagged()); | 1312 ASSERT(instr->representation().IsTagged()); |
1313 ASSERT(instr->left()->representation().IsTagged()); | 1313 ASSERT(instr->left()->representation().IsTagged()); |
1314 ASSERT(instr->right()->representation().IsTagged()); | 1314 ASSERT(instr->right()->representation().IsTagged()); |
1315 | 1315 |
1316 LOperand* left = UseFixed(instr->left(), r1); | 1316 LOperand* left = UseFixed(instr->left(), r1); |
1317 LOperand* right = UseFixed(instr->right(), r0); | 1317 LOperand* right = UseFixed(instr->right(), r0); |
1318 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right); | 1318 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right); |
1319 return MarkAsCall(DefineFixed(result, r0), instr); | 1319 return MarkAsCall(DefineFixed(result, r0), instr); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 return MarkAsCall(DefineFixedDouble(result, d1), instr); | 1477 return MarkAsCall(DefineFixedDouble(result, d1), instr); |
1478 } | 1478 } |
1479 } | 1479 } |
1480 | 1480 |
1481 | 1481 |
1482 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1482 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
1483 if (instr->representation().IsInteger32()) { | 1483 if (instr->representation().IsInteger32()) { |
1484 ASSERT(instr->left()->representation().IsInteger32()); | 1484 ASSERT(instr->left()->representation().IsInteger32()); |
1485 ASSERT(instr->right()->representation().IsInteger32()); | 1485 ASSERT(instr->right()->representation().IsInteger32()); |
1486 LOperand* left; | 1486 LOperand* left; |
1487 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1487 LOperand* right = UseOrConstant(instr->BetterRightOperand()); |
1488 LOperand* temp = NULL; | 1488 LOperand* temp = NULL; |
1489 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1489 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
1490 (instr->CheckFlag(HValue::kCanOverflow) || | 1490 (instr->CheckFlag(HValue::kCanOverflow) || |
1491 !right->IsConstantOperand())) { | 1491 !right->IsConstantOperand())) { |
1492 left = UseRegister(instr->LeastConstantOperand()); | 1492 left = UseRegister(instr->BetterLeftOperand()); |
1493 temp = TempRegister(); | 1493 temp = TempRegister(); |
1494 } else { | 1494 } else { |
1495 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1495 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1496 } | 1496 } |
1497 LMulI* mul = new(zone()) LMulI(left, right, temp); | 1497 LMulI* mul = new(zone()) LMulI(left, right, temp); |
1498 if (instr->CheckFlag(HValue::kCanOverflow) || | 1498 if (instr->CheckFlag(HValue::kCanOverflow) || |
1499 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1499 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1500 AssignEnvironment(mul); | 1500 AssignEnvironment(mul); |
1501 } | 1501 } |
1502 return DefineAsRegister(mul); | 1502 return DefineAsRegister(mul); |
1503 | 1503 |
1504 } else if (instr->representation().IsDouble()) { | 1504 } else if (instr->representation().IsDouble()) { |
1505 if (instr->UseCount() == 1 && (instr->uses().value()->IsAdd() || | 1505 if (instr->UseCount() == 1 && (instr->uses().value()->IsAdd() || |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 return DefineSameAsFirst(new(zone()) LMultiplySubD(minuend_op, | 1595 return DefineSameAsFirst(new(zone()) LMultiplySubD(minuend_op, |
1596 multiplier_op, | 1596 multiplier_op, |
1597 multiplicand_op)); | 1597 multiplicand_op)); |
1598 } | 1598 } |
1599 | 1599 |
1600 | 1600 |
1601 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1601 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
1602 if (instr->representation().IsInteger32()) { | 1602 if (instr->representation().IsInteger32()) { |
1603 ASSERT(instr->left()->representation().IsInteger32()); | 1603 ASSERT(instr->left()->representation().IsInteger32()); |
1604 ASSERT(instr->right()->representation().IsInteger32()); | 1604 ASSERT(instr->right()->representation().IsInteger32()); |
1605 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1605 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1606 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1606 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1607 LAddI* add = new(zone()) LAddI(left, right); | 1607 LAddI* add = new(zone()) LAddI(left, right); |
1608 LInstruction* result = DefineAsRegister(add); | 1608 LInstruction* result = DefineAsRegister(add); |
1609 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1609 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1610 result = AssignEnvironment(result); | 1610 result = AssignEnvironment(result); |
1611 } | 1611 } |
1612 return result; | 1612 return result; |
1613 } else if (instr->representation().IsDouble()) { | 1613 } else if (instr->representation().IsDouble()) { |
1614 if (instr->left()->IsMul()) { | 1614 if (instr->left()->IsMul()) { |
1615 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1615 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
1616 } | 1616 } |
(...skipping 10 matching lines...) Expand all Loading... |
1627 } | 1627 } |
1628 } | 1628 } |
1629 | 1629 |
1630 | 1630 |
1631 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1631 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
1632 LOperand* left = NULL; | 1632 LOperand* left = NULL; |
1633 LOperand* right = NULL; | 1633 LOperand* right = NULL; |
1634 if (instr->representation().IsInteger32()) { | 1634 if (instr->representation().IsInteger32()) { |
1635 ASSERT(instr->left()->representation().IsInteger32()); | 1635 ASSERT(instr->left()->representation().IsInteger32()); |
1636 ASSERT(instr->right()->representation().IsInteger32()); | 1636 ASSERT(instr->right()->representation().IsInteger32()); |
1637 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1637 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1638 right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1638 right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1639 } else { | 1639 } else { |
1640 ASSERT(instr->representation().IsDouble()); | 1640 ASSERT(instr->representation().IsDouble()); |
1641 ASSERT(instr->left()->representation().IsDouble()); | 1641 ASSERT(instr->left()->representation().IsDouble()); |
1642 ASSERT(instr->right()->representation().IsDouble()); | 1642 ASSERT(instr->right()->representation().IsDouble()); |
1643 left = UseRegisterAtStart(instr->left()); | 1643 left = UseRegisterAtStart(instr->left()); |
1644 right = UseRegisterAtStart(instr->right()); | 1644 right = UseRegisterAtStart(instr->right()); |
1645 } | 1645 } |
1646 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); | 1646 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); |
1647 } | 1647 } |
1648 | 1648 |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 | 2621 |
2622 | 2622 |
2623 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2623 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2624 LOperand* object = UseRegister(instr->object()); | 2624 LOperand* object = UseRegister(instr->object()); |
2625 LOperand* index = UseRegister(instr->index()); | 2625 LOperand* index = UseRegister(instr->index()); |
2626 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2626 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2627 } | 2627 } |
2628 | 2628 |
2629 | 2629 |
2630 } } // namespace v8::internal | 2630 } } // namespace v8::internal |
OLD | NEW |