| 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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 block->UpdateEnvironment(last_environment); | 808 block->UpdateEnvironment(last_environment); |
| 809 ASSERT(pred->argument_count() >= 0); | 809 ASSERT(pred->argument_count() >= 0); |
| 810 argument_count_ = pred->argument_count(); | 810 argument_count_ = pred->argument_count(); |
| 811 } else { | 811 } else { |
| 812 // We are at a state join => process phis. | 812 // We are at a state join => process phis. |
| 813 HBasicBlock* pred = block->predecessors()->at(0); | 813 HBasicBlock* pred = block->predecessors()->at(0); |
| 814 // No need to copy the environment, it cannot be used later. | 814 // No need to copy the environment, it cannot be used later. |
| 815 HEnvironment* last_environment = pred->last_environment(); | 815 HEnvironment* last_environment = pred->last_environment(); |
| 816 for (int i = 0; i < block->phis()->length(); ++i) { | 816 for (int i = 0; i < block->phis()->length(); ++i) { |
| 817 HPhi* phi = block->phis()->at(i); | 817 HPhi* phi = block->phis()->at(i); |
| 818 if (phi->merged_index() < last_environment->length()) { | 818 if (phi->HasMergedIndex()) { |
| 819 last_environment->SetValueAt(phi->merged_index(), phi); | 819 last_environment->SetValueAt(phi->merged_index(), phi); |
| 820 } | 820 } |
| 821 } | 821 } |
| 822 for (int i = 0; i < block->deleted_phis()->length(); ++i) { | 822 for (int i = 0; i < block->deleted_phis()->length(); ++i) { |
| 823 if (block->deleted_phis()->at(i) < last_environment->length()) { | 823 if (block->deleted_phis()->at(i) < last_environment->length()) { |
| 824 last_environment->SetValueAt(block->deleted_phis()->at(i), | 824 last_environment->SetValueAt(block->deleted_phis()->at(i), |
| 825 graph_->GetConstantUndefined()); | 825 graph_->GetConstantUndefined()); |
| 826 } | 826 } |
| 827 } | 827 } |
| 828 block->UpdateEnvironment(last_environment); | 828 block->UpdateEnvironment(last_environment); |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 LOperand* right = UseFixed(instr->right(), r0); | 1702 LOperand* right = UseFixed(instr->right(), r0); |
| 1703 LCmpT* result = new(zone()) LCmpT(left, right); | 1703 LCmpT* result = new(zone()) LCmpT(left, right); |
| 1704 return MarkAsCall(DefineFixed(result, r0), instr); | 1704 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1705 } | 1705 } |
| 1706 | 1706 |
| 1707 | 1707 |
| 1708 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1708 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| 1709 HCompareNumericAndBranch* instr) { | 1709 HCompareNumericAndBranch* instr) { |
| 1710 Representation r = instr->representation(); | 1710 Representation r = instr->representation(); |
| 1711 if (r.IsSmiOrInteger32()) { | 1711 if (r.IsSmiOrInteger32()) { |
| 1712 ASSERT(instr->left()->representation().IsSmiOrInteger32()); | 1712 ASSERT(instr->left()->representation().Equals(r)); |
| 1713 ASSERT(instr->left()->representation().Equals( | 1713 ASSERT(instr->right()->representation().Equals(r)); |
| 1714 instr->right()->representation())); | |
| 1715 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1714 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
| 1716 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1715 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
| 1717 return new(zone()) LCompareNumericAndBranch(left, right); | 1716 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1718 } else { | 1717 } else { |
| 1719 ASSERT(r.IsDouble()); | 1718 ASSERT(r.IsDouble()); |
| 1720 ASSERT(instr->left()->representation().IsDouble()); | 1719 ASSERT(instr->left()->representation().IsDouble()); |
| 1721 ASSERT(instr->right()->representation().IsDouble()); | 1720 ASSERT(instr->right()->representation().IsDouble()); |
| 1722 LOperand* left = UseRegisterAtStart(instr->left()); | 1721 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1723 LOperand* right = UseRegisterAtStart(instr->right()); | 1722 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1724 return new(zone()) LCompareNumericAndBranch(left, right); | 1723 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1725 } | 1724 } |
| 1726 } | 1725 } |
| 1727 | 1726 |
| 1728 | 1727 |
| 1729 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1728 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1730 HCompareObjectEqAndBranch* instr) { | 1729 HCompareObjectEqAndBranch* instr) { |
| 1731 LOperand* left = UseRegisterAtStart(instr->left()); | 1730 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1732 LOperand* right = UseRegisterAtStart(instr->right()); | 1731 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1733 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1732 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1734 } | 1733 } |
| 1735 | 1734 |
| 1736 | 1735 |
| 1736 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1737 HCompareHoleAndBranch* instr) { |
| 1738 LOperand* object = UseRegisterAtStart(instr->object()); |
| 1739 return new(zone()) LCmpHoleAndBranch(object); |
| 1740 } |
| 1741 |
| 1742 |
| 1737 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1743 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1738 ASSERT(instr->value()->representation().IsTagged()); | 1744 ASSERT(instr->value()->representation().IsTagged()); |
| 1739 LOperand* value = UseRegisterAtStart(instr->value()); | 1745 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1740 LOperand* temp = TempRegister(); | 1746 LOperand* temp = TempRegister(); |
| 1741 return new(zone()) LIsObjectAndBranch(value, temp); | 1747 return new(zone()) LIsObjectAndBranch(value, temp); |
| 1742 } | 1748 } |
| 1743 | 1749 |
| 1744 | 1750 |
| 1745 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1751 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
| 1746 ASSERT(instr->value()->representation().IsTagged()); | 1752 ASSERT(instr->value()->representation().IsTagged()); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2146 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
| 2141 } | 2147 } |
| 2142 | 2148 |
| 2143 | 2149 |
| 2144 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2150 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 2145 LOperand* obj = UseRegisterAtStart(instr->object()); | 2151 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 2146 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2152 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
| 2147 } | 2153 } |
| 2148 | 2154 |
| 2149 | 2155 |
| 2150 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | |
| 2151 HLoadNamedFieldPolymorphic* instr) { | |
| 2152 ASSERT(instr->representation().IsTagged()); | |
| 2153 if (instr->need_generic()) { | |
| 2154 LOperand* obj = UseFixed(instr->object(), r0); | |
| 2155 LLoadNamedFieldPolymorphic* result = | |
| 2156 new(zone()) LLoadNamedFieldPolymorphic(obj); | |
| 2157 return MarkAsCall(DefineFixed(result, r0), instr); | |
| 2158 } else { | |
| 2159 LOperand* obj = UseRegisterAtStart(instr->object()); | |
| 2160 LLoadNamedFieldPolymorphic* result = | |
| 2161 new(zone()) LLoadNamedFieldPolymorphic(obj); | |
| 2162 return AssignEnvironment(DefineAsRegister(result)); | |
| 2163 } | |
| 2164 } | |
| 2165 | |
| 2166 | |
| 2167 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 2156 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
| 2168 LOperand* object = UseFixed(instr->object(), r0); | 2157 LOperand* object = UseFixed(instr->object(), r0); |
| 2169 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), r0); | 2158 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), r0); |
| 2170 return MarkAsCall(result, instr); | 2159 return MarkAsCall(result, instr); |
| 2171 } | 2160 } |
| 2172 | 2161 |
| 2173 | 2162 |
| 2174 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2163 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 2175 HLoadFunctionPrototype* instr) { | 2164 HLoadFunctionPrototype* instr) { |
| 2176 return AssignEnvironment(DefineAsRegister( | 2165 return AssignEnvironment(DefineAsRegister( |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2610 | 2599 |
| 2611 | 2600 |
| 2612 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2601 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2613 LOperand* object = UseRegister(instr->object()); | 2602 LOperand* object = UseRegister(instr->object()); |
| 2614 LOperand* index = UseRegister(instr->index()); | 2603 LOperand* index = UseRegister(instr->index()); |
| 2615 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2604 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2616 } | 2605 } |
| 2617 | 2606 |
| 2618 | 2607 |
| 2619 } } // namespace v8::internal | 2608 } } // namespace v8::internal |
| OLD | NEW |