| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 block->UpdateEnvironment(last_environment); | 813 block->UpdateEnvironment(last_environment); |
| 814 ASSERT(pred->argument_count() >= 0); | 814 ASSERT(pred->argument_count() >= 0); |
| 815 argument_count_ = pred->argument_count(); | 815 argument_count_ = pred->argument_count(); |
| 816 } else { | 816 } else { |
| 817 // We are at a state join => process phis. | 817 // We are at a state join => process phis. |
| 818 HBasicBlock* pred = block->predecessors()->at(0); | 818 HBasicBlock* pred = block->predecessors()->at(0); |
| 819 // No need to copy the environment, it cannot be used later. | 819 // No need to copy the environment, it cannot be used later. |
| 820 HEnvironment* last_environment = pred->last_environment(); | 820 HEnvironment* last_environment = pred->last_environment(); |
| 821 for (int i = 0; i < block->phis()->length(); ++i) { | 821 for (int i = 0; i < block->phis()->length(); ++i) { |
| 822 HPhi* phi = block->phis()->at(i); | 822 HPhi* phi = block->phis()->at(i); |
| 823 if (phi->merged_index() < last_environment->length()) { | 823 if (phi->HasMergedIndex()) { |
| 824 last_environment->SetValueAt(phi->merged_index(), phi); | 824 last_environment->SetValueAt(phi->merged_index(), phi); |
| 825 } | 825 } |
| 826 } | 826 } |
| 827 for (int i = 0; i < block->deleted_phis()->length(); ++i) { | 827 for (int i = 0; i < block->deleted_phis()->length(); ++i) { |
| 828 if (block->deleted_phis()->at(i) < last_environment->length()) { | 828 if (block->deleted_phis()->at(i) < last_environment->length()) { |
| 829 last_environment->SetValueAt(block->deleted_phis()->at(i), | 829 last_environment->SetValueAt(block->deleted_phis()->at(i), |
| 830 graph_->GetConstantUndefined()); | 830 graph_->GetConstantUndefined()); |
| 831 } | 831 } |
| 832 } | 832 } |
| 833 block->UpdateEnvironment(last_environment); | 833 block->UpdateEnvironment(last_environment); |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 LOperand* right = UseFixed(instr->right(), a0); | 1621 LOperand* right = UseFixed(instr->right(), a0); |
| 1622 LCmpT* result = new(zone()) LCmpT(left, right); | 1622 LCmpT* result = new(zone()) LCmpT(left, right); |
| 1623 return MarkAsCall(DefineFixed(result, v0), instr); | 1623 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 | 1626 |
| 1627 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1627 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| 1628 HCompareNumericAndBranch* instr) { | 1628 HCompareNumericAndBranch* instr) { |
| 1629 Representation r = instr->representation(); | 1629 Representation r = instr->representation(); |
| 1630 if (r.IsSmiOrInteger32()) { | 1630 if (r.IsSmiOrInteger32()) { |
| 1631 ASSERT(instr->left()->representation().IsSmiOrInteger32()); | 1631 ASSERT(instr->left()->representation().Equals(r)); |
| 1632 ASSERT(instr->left()->representation().Equals( | 1632 ASSERT(instr->right()->representation().Equals(r)); |
| 1633 instr->right()->representation())); | |
| 1634 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1633 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
| 1635 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1634 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
| 1636 return new(zone()) LCompareNumericAndBranch(left, right); | 1635 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1637 } else { | 1636 } else { |
| 1638 ASSERT(r.IsDouble()); | 1637 ASSERT(r.IsDouble()); |
| 1639 ASSERT(instr->left()->representation().IsDouble()); | 1638 ASSERT(instr->left()->representation().IsDouble()); |
| 1640 ASSERT(instr->right()->representation().IsDouble()); | 1639 ASSERT(instr->right()->representation().IsDouble()); |
| 1641 LOperand* left = UseRegisterAtStart(instr->left()); | 1640 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1642 LOperand* right = UseRegisterAtStart(instr->right()); | 1641 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1643 return new(zone()) LCompareNumericAndBranch(left, right); | 1642 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1644 } | 1643 } |
| 1645 } | 1644 } |
| 1646 | 1645 |
| 1647 | 1646 |
| 1648 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1647 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1649 HCompareObjectEqAndBranch* instr) { | 1648 HCompareObjectEqAndBranch* instr) { |
| 1650 LOperand* left = UseRegisterAtStart(instr->left()); | 1649 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1651 LOperand* right = UseRegisterAtStart(instr->right()); | 1650 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1652 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1651 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1653 } | 1652 } |
| 1654 | 1653 |
| 1655 | 1654 |
| 1655 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1656 HCompareHoleAndBranch* instr) { |
| 1657 LOperand* object = UseRegisterAtStart(instr->object()); |
| 1658 return new(zone()) LCmpHoleAndBranch(object); |
| 1659 } |
| 1660 |
| 1661 |
| 1656 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1662 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1657 ASSERT(instr->value()->representation().IsTagged()); | 1663 ASSERT(instr->value()->representation().IsTagged()); |
| 1658 LOperand* temp = TempRegister(); | 1664 LOperand* temp = TempRegister(); |
| 1659 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), | 1665 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), |
| 1660 temp); | 1666 temp); |
| 1661 } | 1667 } |
| 1662 | 1668 |
| 1663 | 1669 |
| 1664 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1670 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
| 1665 ASSERT(instr->value()->representation().IsTagged()); | 1671 ASSERT(instr->value()->representation().IsTagged()); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2060 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2066 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
| 2061 } | 2067 } |
| 2062 | 2068 |
| 2063 | 2069 |
| 2064 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2070 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 2065 LOperand* obj = UseRegisterAtStart(instr->object()); | 2071 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 2066 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2072 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
| 2067 } | 2073 } |
| 2068 | 2074 |
| 2069 | 2075 |
| 2070 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | |
| 2071 HLoadNamedFieldPolymorphic* instr) { | |
| 2072 ASSERT(instr->representation().IsTagged()); | |
| 2073 if (instr->need_generic()) { | |
| 2074 LOperand* obj = UseFixed(instr->object(), a0); | |
| 2075 LLoadNamedFieldPolymorphic* result = | |
| 2076 new(zone()) LLoadNamedFieldPolymorphic(obj); | |
| 2077 return MarkAsCall(DefineFixed(result, v0), instr); | |
| 2078 } else { | |
| 2079 LOperand* obj = UseRegisterAtStart(instr->object()); | |
| 2080 LLoadNamedFieldPolymorphic* result = | |
| 2081 new(zone()) LLoadNamedFieldPolymorphic(obj); | |
| 2082 return AssignEnvironment(DefineAsRegister(result)); | |
| 2083 } | |
| 2084 } | |
| 2085 | |
| 2086 | |
| 2087 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 2076 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
| 2088 LOperand* object = UseFixed(instr->object(), a0); | 2077 LOperand* object = UseFixed(instr->object(), a0); |
| 2089 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), v0); | 2078 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), v0); |
| 2090 return MarkAsCall(result, instr); | 2079 return MarkAsCall(result, instr); |
| 2091 } | 2080 } |
| 2092 | 2081 |
| 2093 | 2082 |
| 2094 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2083 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 2095 HLoadFunctionPrototype* instr) { | 2084 HLoadFunctionPrototype* instr) { |
| 2096 return AssignEnvironment(DefineAsRegister( | 2085 return AssignEnvironment(DefineAsRegister( |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 | 2520 |
| 2532 | 2521 |
| 2533 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2522 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2534 LOperand* object = UseRegister(instr->object()); | 2523 LOperand* object = UseRegister(instr->object()); |
| 2535 LOperand* index = UseRegister(instr->index()); | 2524 LOperand* index = UseRegister(instr->index()); |
| 2536 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2525 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2537 } | 2526 } |
| 2538 | 2527 |
| 2539 | 2528 |
| 2540 } } // namespace v8::internal | 2529 } } // namespace v8::internal |
| OLD | NEW |