| 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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1660 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1661 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1661 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1662 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1662 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1663 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1663 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1664 LAddI* add = new(zone()) LAddI(left, right); | 1664 LAddI* add = new(zone()) LAddI(left, right); |
| 1665 LInstruction* result = DefineAsRegister(add); | 1665 LInstruction* result = DefineAsRegister(add); |
| 1666 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1666 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1667 result = AssignEnvironment(result); | 1667 result = AssignEnvironment(result); |
| 1668 } | 1668 } |
| 1669 return result; | 1669 return result; |
| 1670 } else if (instr->representation().IsExternal()) { |
| 1671 ASSERT(instr->left()->representation().IsExternal()); |
| 1672 ASSERT(instr->right()->representation().IsInteger32()); |
| 1673 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); |
| 1674 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1675 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1676 LAddI* add = new(zone()) LAddI(left, right); |
| 1677 LInstruction* result = DefineAsRegister(add); |
| 1678 return result; |
| 1670 } else if (instr->representation().IsDouble()) { | 1679 } else if (instr->representation().IsDouble()) { |
| 1671 if (instr->left()->IsMul()) { | 1680 if (instr->left()->IsMul()) { |
| 1672 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1681 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
| 1673 } | 1682 } |
| 1674 | 1683 |
| 1675 if (instr->right()->IsMul()) { | 1684 if (instr->right()->IsMul()) { |
| 1676 ASSERT(!instr->left()->IsMul()); | 1685 ASSERT(!instr->left()->IsMul()); |
| 1677 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); | 1686 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); |
| 1678 } | 1687 } |
| 1679 | 1688 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 LOperand* right = exponent_type.IsDouble() ? | 1722 LOperand* right = exponent_type.IsDouble() ? |
| 1714 UseFixedDouble(instr->right(), d2) : | 1723 UseFixedDouble(instr->right(), d2) : |
| 1715 UseFixed(instr->right(), r2); | 1724 UseFixed(instr->right(), r2); |
| 1716 LPower* result = new(zone()) LPower(left, right); | 1725 LPower* result = new(zone()) LPower(left, right); |
| 1717 return MarkAsCall(DefineFixedDouble(result, d3), | 1726 return MarkAsCall(DefineFixedDouble(result, d3), |
| 1718 instr, | 1727 instr, |
| 1719 CAN_DEOPTIMIZE_EAGERLY); | 1728 CAN_DEOPTIMIZE_EAGERLY); |
| 1720 } | 1729 } |
| 1721 | 1730 |
| 1722 | 1731 |
| 1723 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | |
| 1724 ASSERT(instr->representation().IsDouble()); | |
| 1725 ASSERT(instr->global_object()->representation().IsTagged()); | |
| 1726 LOperand* global_object = UseTempRegister(instr->global_object()); | |
| 1727 LOperand* scratch = TempRegister(); | |
| 1728 LOperand* scratch2 = TempRegister(); | |
| 1729 LOperand* scratch3 = TempRegister(); | |
| 1730 LRandom* result = new(zone()) LRandom( | |
| 1731 global_object, scratch, scratch2, scratch3); | |
| 1732 return DefineFixedDouble(result, d7); | |
| 1733 } | |
| 1734 | |
| 1735 | |
| 1736 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1732 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1737 ASSERT(instr->left()->representation().IsTagged()); | 1733 ASSERT(instr->left()->representation().IsTagged()); |
| 1738 ASSERT(instr->right()->representation().IsTagged()); | 1734 ASSERT(instr->right()->representation().IsTagged()); |
| 1739 LOperand* context = UseFixed(instr->context(), cp); | 1735 LOperand* context = UseFixed(instr->context(), cp); |
| 1740 LOperand* left = UseFixed(instr->left(), r1); | 1736 LOperand* left = UseFixed(instr->left(), r1); |
| 1741 LOperand* right = UseFixed(instr->right(), r0); | 1737 LOperand* right = UseFixed(instr->right(), r0); |
| 1742 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1738 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1743 return MarkAsCall(DefineFixed(result, r0), instr); | 1739 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1744 } | 1740 } |
| 1745 | 1741 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 2024 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 2029 return DefineAsRegister(new(zone()) LSmiTag(value)); | 2025 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 2030 } else { | 2026 } else { |
| 2031 LNumberTagI* result = new(zone()) LNumberTagI(value); | 2027 LNumberTagI* result = new(zone()) LNumberTagI(value); |
| 2032 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2028 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2033 } | 2029 } |
| 2034 } else if (to.IsSmi()) { | 2030 } else if (to.IsSmi()) { |
| 2035 HValue* val = instr->value(); | 2031 HValue* val = instr->value(); |
| 2036 LOperand* value = UseRegister(val); | 2032 LOperand* value = UseRegister(val); |
| 2037 LInstruction* result = val->CheckFlag(HInstruction::kUint32) | 2033 LInstruction* result = val->CheckFlag(HInstruction::kUint32) |
| 2038 ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value)) | 2034 ? DefineAsRegister(new(zone()) LUint32ToSmi(value)) |
| 2039 : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); | 2035 : DefineAsRegister(new(zone()) LInteger32ToSmi(value)); |
| 2040 if (val->HasRange() && val->range()->IsInSmiRange()) { | 2036 if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 2041 return result; | 2037 return result; |
| 2042 } | 2038 } |
| 2043 return AssignEnvironment(result); | 2039 return AssignEnvironment(result); |
| 2044 } else { | 2040 } else { |
| 2045 ASSERT(to.IsDouble()); | 2041 ASSERT(to.IsDouble()); |
| 2046 if (instr->value()->CheckFlag(HInstruction::kUint32)) { | 2042 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
| 2047 return DefineAsRegister( | 2043 return DefineAsRegister( |
| 2048 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); | 2044 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); |
| 2049 } else { | 2045 } else { |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2567 LOperand* context = UseFixed(instr->context(), cp); | 2563 LOperand* context = UseFixed(instr->context(), cp); |
| 2568 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); | 2564 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); |
| 2569 return MarkAsCall(DefineFixed(result, r0), instr); | 2565 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2570 } | 2566 } |
| 2571 | 2567 |
| 2572 | 2568 |
| 2573 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2569 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2574 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 2570 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 2575 if (goto_instr != NULL) return goto_instr; | 2571 if (goto_instr != NULL) return goto_instr; |
| 2576 | 2572 |
| 2577 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2573 return new(zone()) LTypeofIsAndBranch(UseRegister(instr->value())); |
| 2578 } | 2574 } |
| 2579 | 2575 |
| 2580 | 2576 |
| 2581 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2577 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2582 HIsConstructCallAndBranch* instr) { | 2578 HIsConstructCallAndBranch* instr) { |
| 2583 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2579 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2584 } | 2580 } |
| 2585 | 2581 |
| 2586 | 2582 |
| 2587 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2583 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 | 2675 |
| 2680 | 2676 |
| 2681 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2677 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2682 LOperand* object = UseRegister(instr->object()); | 2678 LOperand* object = UseRegister(instr->object()); |
| 2683 LOperand* index = UseRegister(instr->index()); | 2679 LOperand* index = UseRegister(instr->index()); |
| 2684 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2680 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2685 } | 2681 } |
| 2686 | 2682 |
| 2687 | 2683 |
| 2688 } } // namespace v8::internal | 2684 } } // namespace v8::internal |
| OLD | NEW |