| 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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1453 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1454 if (instr->HasPowerOf2Divisor()) { | 1454 if (instr->HasPowerOf2Divisor()) { |
| 1455 ASSERT(!right->CanBeZero()); | 1455 ASSERT(!right->CanBeZero()); |
| 1456 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1456 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1457 UseOrConstant(right)); | 1457 UseOrConstant(right)); |
| 1458 LInstruction* result = DefineAsRegister(mod); | 1458 LInstruction* result = DefineAsRegister(mod); |
| 1459 return (left->CanBeNegative() && | 1459 return (left->CanBeNegative() && |
| 1460 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1460 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1461 ? AssignEnvironment(result) | 1461 ? AssignEnvironment(result) |
| 1462 : result; | 1462 : result; |
| 1463 } else if (instr->fixed_right_arg().has_value) { | |
| 1464 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | |
| 1465 UseRegisterAtStart(right)); | |
| 1466 return AssignEnvironment(DefineAsRegister(mod)); | |
| 1467 } else { | 1463 } else { |
| 1468 LModI* mod = new(zone()) LModI(UseRegister(left), | 1464 LModI* mod = new(zone()) LModI(UseRegister(left), |
| 1469 UseRegister(right), | 1465 UseRegister(right), |
| 1470 TempRegister(), | 1466 TempRegister(), |
| 1471 FixedTemp(f20), | 1467 FixedTemp(f20), |
| 1472 FixedTemp(f22)); | 1468 FixedTemp(f22)); |
| 1473 LInstruction* result = DefineAsRegister(mod); | 1469 LInstruction* result = DefineAsRegister(mod); |
| 1474 return (right->CanBeZero() || | 1470 return (right->CanBeZero() || |
| 1475 (left->RangeCanInclude(kMinInt) && | 1471 (left->RangeCanInclude(kMinInt) && |
| 1476 right->RangeCanInclude(-1)) || | 1472 right->RangeCanInclude(-1)) || |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1580 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1585 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1581 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1586 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1582 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1587 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1583 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1588 LAddI* add = new(zone()) LAddI(left, right); | 1584 LAddI* add = new(zone()) LAddI(left, right); |
| 1589 LInstruction* result = DefineAsRegister(add); | 1585 LInstruction* result = DefineAsRegister(add); |
| 1590 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1586 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1591 result = AssignEnvironment(result); | 1587 result = AssignEnvironment(result); |
| 1592 } | 1588 } |
| 1593 return result; | 1589 return result; |
| 1590 } else if (instr->representation().IsExternal()) { |
| 1591 ASSERT(instr->left()->representation().IsExternal()); |
| 1592 ASSERT(instr->right()->representation().IsInteger32()); |
| 1593 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); |
| 1594 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1595 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1596 LAddI* add = new(zone()) LAddI(left, right); |
| 1597 LInstruction* result = DefineAsRegister(add); |
| 1598 return result; |
| 1594 } else if (instr->representation().IsDouble()) { | 1599 } else if (instr->representation().IsDouble()) { |
| 1595 if (kArchVariant == kMips32r2) { | 1600 if (kArchVariant == kMips32r2) { |
| 1596 if (instr->left()->IsMul()) | 1601 if (instr->left()->IsMul()) |
| 1597 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1602 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
| 1598 | 1603 |
| 1599 if (instr->right()->IsMul()) { | 1604 if (instr->right()->IsMul()) { |
| 1600 ASSERT(!instr->left()->IsMul()); | 1605 ASSERT(!instr->left()->IsMul()); |
| 1601 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); | 1606 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); |
| 1602 } | 1607 } |
| 1603 } | 1608 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 LOperand* right = exponent_type.IsDouble() ? | 1642 LOperand* right = exponent_type.IsDouble() ? |
| 1638 UseFixedDouble(instr->right(), f4) : | 1643 UseFixedDouble(instr->right(), f4) : |
| 1639 UseFixed(instr->right(), a2); | 1644 UseFixed(instr->right(), a2); |
| 1640 LPower* result = new(zone()) LPower(left, right); | 1645 LPower* result = new(zone()) LPower(left, right); |
| 1641 return MarkAsCall(DefineFixedDouble(result, f0), | 1646 return MarkAsCall(DefineFixedDouble(result, f0), |
| 1642 instr, | 1647 instr, |
| 1643 CAN_DEOPTIMIZE_EAGERLY); | 1648 CAN_DEOPTIMIZE_EAGERLY); |
| 1644 } | 1649 } |
| 1645 | 1650 |
| 1646 | 1651 |
| 1647 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | |
| 1648 ASSERT(instr->representation().IsDouble()); | |
| 1649 ASSERT(instr->global_object()->representation().IsTagged()); | |
| 1650 LOperand* global_object = UseTempRegister(instr->global_object()); | |
| 1651 LOperand* scratch = TempRegister(); | |
| 1652 LOperand* scratch2 = TempRegister(); | |
| 1653 LOperand* scratch3 = TempRegister(); | |
| 1654 LRandom* result = new(zone()) LRandom( | |
| 1655 global_object, scratch, scratch2, scratch3); | |
| 1656 return DefineFixedDouble(result, f0); | |
| 1657 } | |
| 1658 | |
| 1659 | |
| 1660 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1652 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1661 ASSERT(instr->left()->representation().IsTagged()); | 1653 ASSERT(instr->left()->representation().IsTagged()); |
| 1662 ASSERT(instr->right()->representation().IsTagged()); | 1654 ASSERT(instr->right()->representation().IsTagged()); |
| 1663 LOperand* context = UseFixed(instr->context(), cp); | 1655 LOperand* context = UseFixed(instr->context(), cp); |
| 1664 LOperand* left = UseFixed(instr->left(), a1); | 1656 LOperand* left = UseFixed(instr->left(), a1); |
| 1665 LOperand* right = UseFixed(instr->right(), a0); | 1657 LOperand* right = UseFixed(instr->right(), a0); |
| 1666 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1658 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1667 return MarkAsCall(DefineFixed(result, v0), instr); | 1659 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1668 } | 1660 } |
| 1669 | 1661 |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 instr->ReplayEnvironment(current_block_->last_environment()); | 2461 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2470 | 2462 |
| 2471 // There are no real uses of a captured object. | 2463 // There are no real uses of a captured object. |
| 2472 return NULL; | 2464 return NULL; |
| 2473 } | 2465 } |
| 2474 | 2466 |
| 2475 | 2467 |
| 2476 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2468 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
| 2477 info()->MarkAsRequiresFrame(); | 2469 info()->MarkAsRequiresFrame(); |
| 2478 LOperand* args = UseRegister(instr->arguments()); | 2470 LOperand* args = UseRegister(instr->arguments()); |
| 2479 LOperand* length; | 2471 LOperand* length = UseRegisterOrConstantAtStart(instr->length()); |
| 2480 LOperand* index; | 2472 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 2481 if (instr->length()->IsConstant() && instr->index()->IsConstant()) { | |
| 2482 length = UseRegisterOrConstant(instr->length()); | |
| 2483 index = UseOrConstant(instr->index()); | |
| 2484 } else { | |
| 2485 length = UseTempRegister(instr->length()); | |
| 2486 index = UseRegisterAtStart(instr->index()); | |
| 2487 } | |
| 2488 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); | 2473 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); |
| 2489 } | 2474 } |
| 2490 | 2475 |
| 2491 | 2476 |
| 2492 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2477 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
| 2493 LOperand* object = UseFixed(instr->value(), a0); | 2478 LOperand* object = UseFixed(instr->value(), a0); |
| 2494 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2479 LToFastProperties* result = new(zone()) LToFastProperties(object); |
| 2495 return MarkAsCall(DefineFixed(result, v0), instr); | 2480 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2496 } | 2481 } |
| 2497 | 2482 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2612 | 2597 |
| 2613 | 2598 |
| 2614 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2599 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2615 LOperand* object = UseRegister(instr->object()); | 2600 LOperand* object = UseRegister(instr->object()); |
| 2616 LOperand* index = UseRegister(instr->index()); | 2601 LOperand* index = UseRegister(instr->index()); |
| 2617 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2602 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2618 } | 2603 } |
| 2619 | 2604 |
| 2620 | 2605 |
| 2621 } } // namespace v8::internal | 2606 } } // namespace v8::internal |
| OLD | NEW |