| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 | 771 |
| 772 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 772 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
| 773 HArithmeticBinaryOperation* instr) { | 773 HArithmeticBinaryOperation* instr) { |
| 774 ASSERT(op == Token::ADD || | 774 ASSERT(op == Token::ADD || |
| 775 op == Token::DIV || | 775 op == Token::DIV || |
| 776 op == Token::MOD || | 776 op == Token::MOD || |
| 777 op == Token::MUL || | 777 op == Token::MUL || |
| 778 op == Token::SUB); | 778 op == Token::SUB); |
| 779 HValue* left = instr->left(); | 779 HValue* left = instr->left(); |
| 780 HValue* right = instr->right(); | 780 HValue* right = instr->right(); |
| 781 ASSERT(left->representation().IsSmiOrTagged()); | 781 ASSERT(left->representation().IsTagged()); |
| 782 ASSERT(right->representation().IsSmiOrTagged()); | 782 ASSERT(right->representation().IsTagged()); |
| 783 LOperand* left_operand = UseFixed(left, r1); | 783 LOperand* left_operand = UseFixed(left, r1); |
| 784 LOperand* right_operand = UseFixed(right, r0); | 784 LOperand* right_operand = UseFixed(right, r0); |
| 785 LArithmeticT* result = | 785 LArithmeticT* result = |
| 786 new(zone()) LArithmeticT(op, left_operand, right_operand); | 786 new(zone()) LArithmeticT(op, left_operand, right_operand); |
| 787 return MarkAsCall(DefineFixed(result, r0), instr); | 787 return MarkAsCall(DefineFixed(result, r0), instr); |
| 788 } | 788 } |
| 789 | 789 |
| 790 | 790 |
| 791 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 791 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
| 792 ASSERT(is_building()); | 792 ASSERT(is_building()); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 return DoShift(Token::SAR, instr); | 1306 return DoShift(Token::SAR, instr); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 | 1309 |
| 1310 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1310 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
| 1311 return DoShift(Token::SHL, instr); | 1311 return DoShift(Token::SHL, instr); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 | 1314 |
| 1315 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1315 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
| 1316 if (instr->representation().IsInteger32()) { | 1316 if (instr->representation().IsSmiOrInteger32()) { |
| 1317 ASSERT(instr->left()->representation().IsInteger32()); | 1317 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1318 ASSERT(instr->right()->representation().IsInteger32()); | 1318 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1319 | 1319 |
| 1320 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1320 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1321 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1321 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1322 return DefineAsRegister(new(zone()) LBitI(left, right)); | 1322 return DefineAsRegister(new(zone()) LBitI(left, right)); |
| 1323 } else { | 1323 } else { |
| 1324 ASSERT(instr->representation().IsSmiOrTagged()); | 1324 ASSERT(instr->representation().IsTagged()); |
| 1325 ASSERT(instr->left()->representation().IsSmiOrTagged()); | 1325 ASSERT(instr->left()->representation().IsTagged()); |
| 1326 ASSERT(instr->right()->representation().IsSmiOrTagged()); | 1326 ASSERT(instr->right()->representation().IsTagged()); |
| 1327 | 1327 |
| 1328 LOperand* left = UseFixed(instr->left(), r1); | 1328 LOperand* left = UseFixed(instr->left(), r1); |
| 1329 LOperand* right = UseFixed(instr->right(), r0); | 1329 LOperand* right = UseFixed(instr->right(), r0); |
| 1330 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right); | 1330 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right); |
| 1331 return MarkAsCall(DefineFixed(result, r0), instr); | 1331 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1332 } | 1332 } |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 | 1335 |
| 1336 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 1336 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { |
| 1337 ASSERT(instr->value()->representation().IsInteger32()); | 1337 ASSERT(instr->value()->representation().IsInteger32()); |
| 1338 ASSERT(instr->representation().IsInteger32()); | 1338 ASSERT(instr->representation().IsInteger32()); |
| 1339 if (instr->HasNoUses()) return NULL; | 1339 if (instr->HasNoUses()) return NULL; |
| 1340 LOperand* value = UseRegisterAtStart(instr->value()); | 1340 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1341 return DefineAsRegister(new(zone()) LBitNotI(value)); | 1341 return DefineAsRegister(new(zone()) LBitNotI(value)); |
| 1342 } | 1342 } |
| 1343 | 1343 |
| 1344 | 1344 |
| 1345 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1345 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1346 if (instr->representation().IsDouble()) { | 1346 if (instr->representation().IsDouble()) { |
| 1347 return DoArithmeticD(Token::DIV, instr); | 1347 return DoArithmeticD(Token::DIV, instr); |
| 1348 } else if (instr->representation().IsInteger32()) { | 1348 } else if (instr->representation().IsSmiOrInteger32()) { |
| 1349 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1350 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1349 if (instr->HasPowerOf2Divisor()) { | 1351 if (instr->HasPowerOf2Divisor()) { |
| 1350 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1352 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1351 LOperand* value = UseRegisterAtStart(instr->left()); | 1353 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1352 LDivI* div = | 1354 LDivI* div = |
| 1353 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); | 1355 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); |
| 1354 return AssignEnvironment(DefineSameAsFirst(div)); | 1356 return AssignEnvironment(DefineSameAsFirst(div)); |
| 1355 } | 1357 } |
| 1356 LOperand* dividend = UseRegister(instr->left()); | 1358 LOperand* dividend = UseRegister(instr->left()); |
| 1357 LOperand* divisor = UseRegister(instr->right()); | 1359 LOperand* divisor = UseRegister(instr->right()); |
| 1358 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); | 1360 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 HConstant::cast(right)->HasInteger32Value() && | 1431 HConstant::cast(right)->HasInteger32Value() && |
| 1430 HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value()))); | 1432 HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value()))); |
| 1431 return AssignEnvironment(DefineAsRegister( | 1433 return AssignEnvironment(DefineAsRegister( |
| 1432 new(zone()) LMathFloorOfDiv(dividend, divisor, remainder))); | 1434 new(zone()) LMathFloorOfDiv(dividend, divisor, remainder))); |
| 1433 } | 1435 } |
| 1434 | 1436 |
| 1435 | 1437 |
| 1436 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1438 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1437 HValue* left = instr->left(); | 1439 HValue* left = instr->left(); |
| 1438 HValue* right = instr->right(); | 1440 HValue* right = instr->right(); |
| 1439 if (instr->representation().IsInteger32()) { | 1441 if (instr->representation().IsSmiOrInteger32()) { |
| 1440 ASSERT(left->representation().IsInteger32()); | 1442 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1441 ASSERT(right->representation().IsInteger32()); | 1443 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1442 if (instr->HasPowerOf2Divisor()) { | 1444 if (instr->HasPowerOf2Divisor()) { |
| 1443 ASSERT(!right->CanBeZero()); | 1445 ASSERT(!right->CanBeZero()); |
| 1444 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1446 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1445 UseOrConstant(right)); | 1447 UseOrConstant(right)); |
| 1446 LInstruction* result = DefineAsRegister(mod); | 1448 LInstruction* result = DefineAsRegister(mod); |
| 1447 return (left->CanBeNegative() && | 1449 return (left->CanBeNegative() && |
| 1448 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1450 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1449 ? AssignEnvironment(result) | 1451 ? AssignEnvironment(result) |
| 1450 : result; | 1452 : result; |
| 1451 } else if (instr->fixed_right_arg().has_value) { | 1453 } else if (instr->fixed_right_arg().has_value) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1471 FixedTemp(d10), | 1473 FixedTemp(d10), |
| 1472 FixedTemp(d11)); | 1474 FixedTemp(d11)); |
| 1473 LInstruction* result = DefineAsRegister(mod); | 1475 LInstruction* result = DefineAsRegister(mod); |
| 1474 return (right->CanBeZero() || | 1476 return (right->CanBeZero() || |
| 1475 (left->CanBeNegative() && | 1477 (left->CanBeNegative() && |
| 1476 instr->CanBeZero() && | 1478 instr->CanBeZero() && |
| 1477 instr->CheckFlag(HValue::kBailoutOnMinusZero))) | 1479 instr->CheckFlag(HValue::kBailoutOnMinusZero))) |
| 1478 ? AssignEnvironment(result) | 1480 ? AssignEnvironment(result) |
| 1479 : result; | 1481 : result; |
| 1480 } | 1482 } |
| 1481 } else if (instr->representation().IsSmiOrTagged()) { | 1483 } else if (instr->representation().IsTagged()) { |
| 1482 return DoArithmeticT(Token::MOD, instr); | 1484 return DoArithmeticT(Token::MOD, instr); |
| 1483 } else { | 1485 } else { |
| 1484 ASSERT(instr->representation().IsDouble()); | 1486 ASSERT(instr->representation().IsDouble()); |
| 1485 // We call a C function for double modulo. It can't trigger a GC. We need | 1487 // We call a C function for double modulo. It can't trigger a GC. We need |
| 1486 // to use fixed result register for the call. | 1488 // to use fixed result register for the call. |
| 1487 // TODO(fschneider): Allow any register as input registers. | 1489 // TODO(fschneider): Allow any register as input registers. |
| 1488 LArithmeticD* mod = new(zone()) LArithmeticD(Token::MOD, | 1490 LArithmeticD* mod = new(zone()) LArithmeticD(Token::MOD, |
| 1489 UseFixedDouble(left, d1), | 1491 UseFixedDouble(left, d1), |
| 1490 UseFixedDouble(right, d2)); | 1492 UseFixedDouble(right, d2)); |
| 1491 return MarkAsCall(DefineFixedDouble(mod, d1), instr); | 1493 return MarkAsCall(DefineFixedDouble(mod, d1), instr); |
| 1492 } | 1494 } |
| 1493 } | 1495 } |
| 1494 | 1496 |
| 1495 | 1497 |
| 1496 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1498 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| 1497 if (instr->representation().IsInteger32()) { | 1499 if (instr->representation().IsSmiOrInteger32()) { |
| 1498 ASSERT(instr->left()->representation().IsInteger32()); | 1500 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1499 ASSERT(instr->right()->representation().IsInteger32()); | 1501 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1500 LOperand* left; | 1502 LOperand* left; |
| 1501 LOperand* right = UseOrConstant(instr->BetterRightOperand()); | 1503 LOperand* right = UseOrConstant(instr->BetterRightOperand()); |
| 1502 LOperand* temp = NULL; | 1504 LOperand* temp = NULL; |
| 1503 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1505 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
| 1504 (instr->CheckFlag(HValue::kCanOverflow) || | 1506 (instr->CheckFlag(HValue::kCanOverflow) || |
| 1505 !right->IsConstantOperand())) { | 1507 !right->IsConstantOperand())) { |
| 1506 left = UseRegister(instr->BetterLeftOperand()); | 1508 left = UseRegister(instr->BetterLeftOperand()); |
| 1507 temp = TempRegister(); | 1509 temp = TempRegister(); |
| 1508 } else { | 1510 } else { |
| 1509 left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1511 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1538 } | 1540 } |
| 1539 | 1541 |
| 1540 return DoArithmeticD(Token::MUL, instr); | 1542 return DoArithmeticD(Token::MUL, instr); |
| 1541 } else { | 1543 } else { |
| 1542 return DoArithmeticT(Token::MUL, instr); | 1544 return DoArithmeticT(Token::MUL, instr); |
| 1543 } | 1545 } |
| 1544 } | 1546 } |
| 1545 | 1547 |
| 1546 | 1548 |
| 1547 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1549 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
| 1548 if (instr->representation().IsInteger32()) { | 1550 if (instr->representation().IsSmiOrInteger32()) { |
| 1549 ASSERT(instr->left()->representation().IsInteger32()); | 1551 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1550 ASSERT(instr->right()->representation().IsInteger32()); | 1552 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1551 | 1553 |
| 1552 if (instr->left()->IsConstant()) { | 1554 if (instr->left()->IsConstant()) { |
| 1553 // If lhs is constant, do reverse subtraction instead. | 1555 // If lhs is constant, do reverse subtraction instead. |
| 1554 return DoRSub(instr); | 1556 return DoRSub(instr); |
| 1555 } | 1557 } |
| 1556 | 1558 |
| 1557 LOperand* left = UseRegisterAtStart(instr->left()); | 1559 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1558 LOperand* right = UseOrConstantAtStart(instr->right()); | 1560 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1559 LSubI* sub = new(zone()) LSubI(left, right); | 1561 LSubI* sub = new(zone()) LSubI(left, right); |
| 1560 LInstruction* result = DefineAsRegister(sub); | 1562 LInstruction* result = DefineAsRegister(sub); |
| 1561 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1563 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1562 result = AssignEnvironment(result); | 1564 result = AssignEnvironment(result); |
| 1563 } | 1565 } |
| 1564 return result; | 1566 return result; |
| 1565 } else if (instr->representation().IsDouble()) { | 1567 } else if (instr->representation().IsDouble()) { |
| 1566 if (instr->right()->IsMul()) { | 1568 if (instr->right()->IsMul()) { |
| 1567 return DoMultiplySub(instr->left(), HMul::cast(instr->right())); | 1569 return DoMultiplySub(instr->left(), HMul::cast(instr->right())); |
| 1568 } | 1570 } |
| 1569 | 1571 |
| 1570 return DoArithmeticD(Token::SUB, instr); | 1572 return DoArithmeticD(Token::SUB, instr); |
| 1571 } else { | 1573 } else { |
| 1572 return DoArithmeticT(Token::SUB, instr); | 1574 return DoArithmeticT(Token::SUB, instr); |
| 1573 } | 1575 } |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 | 1578 |
| 1577 LInstruction* LChunkBuilder::DoRSub(HSub* instr) { | 1579 LInstruction* LChunkBuilder::DoRSub(HSub* instr) { |
| 1578 ASSERT(instr->representation().IsInteger32()); | 1580 ASSERT(instr->representation().IsSmiOrInteger32()); |
| 1579 ASSERT(instr->left()->representation().IsInteger32()); | 1581 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1580 ASSERT(instr->right()->representation().IsInteger32()); | 1582 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1581 | 1583 |
| 1582 // Note: The lhs of the subtraction becomes the rhs of the | 1584 // Note: The lhs of the subtraction becomes the rhs of the |
| 1583 // reverse-subtraction. | 1585 // reverse-subtraction. |
| 1584 LOperand* left = UseRegisterAtStart(instr->right()); | 1586 LOperand* left = UseRegisterAtStart(instr->right()); |
| 1585 LOperand* right = UseOrConstantAtStart(instr->left()); | 1587 LOperand* right = UseOrConstantAtStart(instr->left()); |
| 1586 LRSubI* rsb = new(zone()) LRSubI(left, right); | 1588 LRSubI* rsb = new(zone()) LRSubI(left, right); |
| 1587 LInstruction* result = DefineAsRegister(rsb); | 1589 LInstruction* result = DefineAsRegister(rsb); |
| 1588 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1590 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1589 result = AssignEnvironment(result); | 1591 result = AssignEnvironment(result); |
| 1590 } | 1592 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1606 LOperand* multiplier_op = UseRegisterAtStart(mul->left()); | 1608 LOperand* multiplier_op = UseRegisterAtStart(mul->left()); |
| 1607 LOperand* multiplicand_op = UseRegisterAtStart(mul->right()); | 1609 LOperand* multiplicand_op = UseRegisterAtStart(mul->right()); |
| 1608 | 1610 |
| 1609 return DefineSameAsFirst(new(zone()) LMultiplySubD(minuend_op, | 1611 return DefineSameAsFirst(new(zone()) LMultiplySubD(minuend_op, |
| 1610 multiplier_op, | 1612 multiplier_op, |
| 1611 multiplicand_op)); | 1613 multiplicand_op)); |
| 1612 } | 1614 } |
| 1613 | 1615 |
| 1614 | 1616 |
| 1615 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1617 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
| 1616 if (instr->representation().IsInteger32()) { | 1618 if (instr->representation().IsSmiOrInteger32()) { |
| 1617 ASSERT(instr->left()->representation().IsInteger32()); | 1619 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1618 ASSERT(instr->right()->representation().IsInteger32()); | 1620 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1619 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1621 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1620 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1622 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1621 LAddI* add = new(zone()) LAddI(left, right); | 1623 LAddI* add = new(zone()) LAddI(left, right); |
| 1622 LInstruction* result = DefineAsRegister(add); | 1624 LInstruction* result = DefineAsRegister(add); |
| 1623 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1625 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1624 result = AssignEnvironment(result); | 1626 result = AssignEnvironment(result); |
| 1625 } | 1627 } |
| 1626 return result; | 1628 return result; |
| 1627 } else if (instr->representation().IsDouble()) { | 1629 } else if (instr->representation().IsDouble()) { |
| 1628 if (instr->left()->IsMul()) { | 1630 if (instr->left()->IsMul()) { |
| 1629 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1631 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
| 1630 } | 1632 } |
| 1631 | 1633 |
| 1632 if (instr->right()->IsMul()) { | 1634 if (instr->right()->IsMul()) { |
| 1633 ASSERT(!instr->left()->IsMul()); | 1635 ASSERT(!instr->left()->IsMul()); |
| 1634 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); | 1636 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); |
| 1635 } | 1637 } |
| 1636 | 1638 |
| 1637 return DoArithmeticD(Token::ADD, instr); | 1639 return DoArithmeticD(Token::ADD, instr); |
| 1638 } else { | 1640 } else { |
| 1639 ASSERT(instr->representation().IsSmiOrTagged()); | 1641 ASSERT(instr->representation().IsTagged()); |
| 1640 return DoArithmeticT(Token::ADD, instr); | 1642 return DoArithmeticT(Token::ADD, instr); |
| 1641 } | 1643 } |
| 1642 } | 1644 } |
| 1643 | 1645 |
| 1644 | 1646 |
| 1645 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1647 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
| 1646 LOperand* left = NULL; | 1648 LOperand* left = NULL; |
| 1647 LOperand* right = NULL; | 1649 LOperand* right = NULL; |
| 1648 if (instr->representation().IsInteger32()) { | 1650 if (instr->representation().IsSmiOrInteger32()) { |
| 1649 ASSERT(instr->left()->representation().IsInteger32()); | 1651 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1650 ASSERT(instr->right()->representation().IsInteger32()); | 1652 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1651 left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1653 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1652 right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1654 right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1653 } else { | 1655 } else { |
| 1654 ASSERT(instr->representation().IsDouble()); | 1656 ASSERT(instr->representation().IsDouble()); |
| 1655 ASSERT(instr->left()->representation().IsDouble()); | 1657 ASSERT(instr->left()->representation().IsDouble()); |
| 1656 ASSERT(instr->right()->representation().IsDouble()); | 1658 ASSERT(instr->right()->representation().IsDouble()); |
| 1657 left = UseRegisterAtStart(instr->left()); | 1659 left = UseRegisterAtStart(instr->left()); |
| 1658 right = UseRegisterAtStart(instr->right()); | 1660 right = UseRegisterAtStart(instr->right()); |
| 1659 } | 1661 } |
| 1660 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); | 1662 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 | 2203 |
| 2202 | 2204 |
| 2203 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 2205 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
| 2204 HLoadExternalArrayPointer* instr) { | 2206 HLoadExternalArrayPointer* instr) { |
| 2205 LOperand* input = UseRegisterAtStart(instr->value()); | 2207 LOperand* input = UseRegisterAtStart(instr->value()); |
| 2206 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2208 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2207 } | 2209 } |
| 2208 | 2210 |
| 2209 | 2211 |
| 2210 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2212 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2211 ASSERT(instr->key()->representation().IsInteger32() || | 2213 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2212 instr->key()->representation().IsSmi()); | |
| 2213 ElementsKind elements_kind = instr->elements_kind(); | 2214 ElementsKind elements_kind = instr->elements_kind(); |
| 2214 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2215 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2215 LLoadKeyed* result = NULL; | 2216 LLoadKeyed* result = NULL; |
| 2216 | 2217 |
| 2217 if (!instr->is_external()) { | 2218 if (!instr->is_external()) { |
| 2218 LOperand* obj = NULL; | 2219 LOperand* obj = NULL; |
| 2219 if (instr->representation().IsDouble()) { | 2220 if (instr->representation().IsDouble()) { |
| 2220 obj = UseTempRegister(instr->elements()); | 2221 obj = UseTempRegister(instr->elements()); |
| 2221 } else { | 2222 } else { |
| 2222 ASSERT(instr->representation().IsSmiOrTagged()); | 2223 ASSERT(instr->representation().IsSmiOrTagged()); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2642 | 2643 |
| 2643 | 2644 |
| 2644 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2645 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2645 LOperand* object = UseRegister(instr->object()); | 2646 LOperand* object = UseRegister(instr->object()); |
| 2646 LOperand* index = UseRegister(instr->index()); | 2647 LOperand* index = UseRegister(instr->index()); |
| 2647 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2648 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2648 } | 2649 } |
| 2649 | 2650 |
| 2650 | 2651 |
| 2651 } } // namespace v8::internal | 2652 } } // namespace v8::internal |
| OLD | NEW |