| 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 block->UpdateEnvironment(last_environment); | 807 block->UpdateEnvironment(last_environment); |
| 808 ASSERT(pred->argument_count() >= 0); | 808 ASSERT(pred->argument_count() >= 0); |
| 809 argument_count_ = pred->argument_count(); | 809 argument_count_ = pred->argument_count(); |
| 810 } else { | 810 } else { |
| 811 // We are at a state join => process phis. | 811 // We are at a state join => process phis. |
| 812 HBasicBlock* pred = block->predecessors()->at(0); | 812 HBasicBlock* pred = block->predecessors()->at(0); |
| 813 // No need to copy the environment, it cannot be used later. | 813 // No need to copy the environment, it cannot be used later. |
| 814 HEnvironment* last_environment = pred->last_environment(); | 814 HEnvironment* last_environment = pred->last_environment(); |
| 815 for (int i = 0; i < block->phis()->length(); ++i) { | 815 for (int i = 0; i < block->phis()->length(); ++i) { |
| 816 HPhi* phi = block->phis()->at(i); | 816 HPhi* phi = block->phis()->at(i); |
| 817 if (phi->merged_index() < last_environment->length()) { | 817 if (phi->HasMergedIndex()) { |
| 818 last_environment->SetValueAt(phi->merged_index(), phi); | 818 last_environment->SetValueAt(phi->merged_index(), phi); |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 for (int i = 0; i < block->deleted_phis()->length(); ++i) { | 821 for (int i = 0; i < block->deleted_phis()->length(); ++i) { |
| 822 if (block->deleted_phis()->at(i) < last_environment->length()) { | 822 if (block->deleted_phis()->at(i) < last_environment->length()) { |
| 823 last_environment->SetValueAt(block->deleted_phis()->at(i), | 823 last_environment->SetValueAt(block->deleted_phis()->at(i), |
| 824 graph_->GetConstantUndefined()); | 824 graph_->GetConstantUndefined()); |
| 825 } | 825 } |
| 826 } | 826 } |
| 827 block->UpdateEnvironment(last_environment); | 827 block->UpdateEnvironment(last_environment); |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 LOperand* right = UseFixed(instr->right(), rax); | 1605 LOperand* right = UseFixed(instr->right(), rax); |
| 1606 LCmpT* result = new(zone()) LCmpT(left, right); | 1606 LCmpT* result = new(zone()) LCmpT(left, right); |
| 1607 return MarkAsCall(DefineFixed(result, rax), instr); | 1607 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 | 1610 |
| 1611 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1611 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| 1612 HCompareNumericAndBranch* instr) { | 1612 HCompareNumericAndBranch* instr) { |
| 1613 Representation r = instr->representation(); | 1613 Representation r = instr->representation(); |
| 1614 if (r.IsSmiOrInteger32()) { | 1614 if (r.IsSmiOrInteger32()) { |
| 1615 ASSERT(instr->left()->representation().IsSmiOrInteger32()); | 1615 ASSERT(instr->left()->representation().Equals(r)); |
| 1616 ASSERT(instr->left()->representation().Equals( | 1616 ASSERT(instr->right()->representation().Equals(r)); |
| 1617 instr->right()->representation())); | |
| 1618 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1617 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
| 1619 LOperand* right = UseOrConstantAtStart(instr->right()); | 1618 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1620 return new(zone()) LCompareNumericAndBranch(left, right); | 1619 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1621 } else { | 1620 } else { |
| 1622 ASSERT(r.IsDouble()); | 1621 ASSERT(r.IsDouble()); |
| 1623 ASSERT(instr->left()->representation().IsDouble()); | 1622 ASSERT(instr->left()->representation().IsDouble()); |
| 1624 ASSERT(instr->right()->representation().IsDouble()); | 1623 ASSERT(instr->right()->representation().IsDouble()); |
| 1625 LOperand* left; | 1624 LOperand* left; |
| 1626 LOperand* right; | 1625 LOperand* right; |
| 1627 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { | 1626 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { |
| 1628 left = UseRegisterOrConstantAtStart(instr->left()); | 1627 left = UseRegisterOrConstantAtStart(instr->left()); |
| 1629 right = UseRegisterOrConstantAtStart(instr->right()); | 1628 right = UseRegisterOrConstantAtStart(instr->right()); |
| 1630 } else { | 1629 } else { |
| 1631 left = UseRegisterAtStart(instr->left()); | 1630 left = UseRegisterAtStart(instr->left()); |
| 1632 right = UseRegisterAtStart(instr->right()); | 1631 right = UseRegisterAtStart(instr->right()); |
| 1633 } | 1632 } |
| 1634 return new(zone()) LCompareNumericAndBranch(left, right); | 1633 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1635 } | 1634 } |
| 1636 } | 1635 } |
| 1637 | 1636 |
| 1638 | 1637 |
| 1639 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1638 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1640 HCompareObjectEqAndBranch* instr) { | 1639 HCompareObjectEqAndBranch* instr) { |
| 1641 LOperand* left = UseRegisterAtStart(instr->left()); | 1640 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1642 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1641 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
| 1643 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1642 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1644 } | 1643 } |
| 1645 | 1644 |
| 1646 | 1645 |
| 1646 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1647 HCompareHoleAndBranch* instr) { |
| 1648 LOperand* object = UseRegisterAtStart(instr->object()); |
| 1649 return new(zone()) LCmpHoleAndBranch(object); |
| 1650 } |
| 1651 |
| 1652 |
| 1647 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1653 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1648 ASSERT(instr->value()->representation().IsTagged()); | 1654 ASSERT(instr->value()->representation().IsTagged()); |
| 1649 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value())); | 1655 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value())); |
| 1650 } | 1656 } |
| 1651 | 1657 |
| 1652 | 1658 |
| 1653 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1659 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
| 1654 ASSERT(instr->value()->representation().IsTagged()); | 1660 ASSERT(instr->value()->representation().IsTagged()); |
| 1655 LOperand* value = UseRegisterAtStart(instr->value()); | 1661 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1656 LOperand* temp = TempRegister(); | 1662 LOperand* temp = TempRegister(); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2058 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 2053 if (instr->access().IsExternalMemory() && instr->access().offset() == 0) { | 2059 if (instr->access().IsExternalMemory() && instr->access().offset() == 0) { |
| 2054 LOperand* obj = UseRegisterOrConstantAtStart(instr->object()); | 2060 LOperand* obj = UseRegisterOrConstantAtStart(instr->object()); |
| 2055 return DefineFixed(new(zone()) LLoadNamedField(obj), rax); | 2061 return DefineFixed(new(zone()) LLoadNamedField(obj), rax); |
| 2056 } | 2062 } |
| 2057 LOperand* obj = UseRegisterAtStart(instr->object()); | 2063 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 2058 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2064 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
| 2059 } | 2065 } |
| 2060 | 2066 |
| 2061 | 2067 |
| 2062 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | |
| 2063 HLoadNamedFieldPolymorphic* instr) { | |
| 2064 ASSERT(instr->representation().IsTagged()); | |
| 2065 if (instr->need_generic()) { | |
| 2066 LOperand* obj = UseFixed(instr->object(), rax); | |
| 2067 LLoadNamedFieldPolymorphic* result = | |
| 2068 new(zone()) LLoadNamedFieldPolymorphic(obj); | |
| 2069 return MarkAsCall(DefineFixed(result, rax), instr); | |
| 2070 } else { | |
| 2071 LOperand* obj = UseRegisterAtStart(instr->object()); | |
| 2072 LLoadNamedFieldPolymorphic* result = | |
| 2073 new(zone()) LLoadNamedFieldPolymorphic(obj); | |
| 2074 return AssignEnvironment(DefineAsRegister(result)); | |
| 2075 } | |
| 2076 } | |
| 2077 | |
| 2078 | |
| 2079 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 2068 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
| 2080 LOperand* object = UseFixed(instr->object(), rax); | 2069 LOperand* object = UseFixed(instr->object(), rax); |
| 2081 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(object); | 2070 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(object); |
| 2082 return MarkAsCall(DefineFixed(result, rax), instr); | 2071 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2083 } | 2072 } |
| 2084 | 2073 |
| 2085 | 2074 |
| 2086 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2075 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 2087 HLoadFunctionPrototype* instr) { | 2076 HLoadFunctionPrototype* instr) { |
| 2088 return AssignEnvironment(DefineAsRegister( | 2077 return AssignEnvironment(DefineAsRegister( |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2543 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2544 LOperand* object = UseRegister(instr->object()); | 2533 LOperand* object = UseRegister(instr->object()); |
| 2545 LOperand* index = UseTempRegister(instr->index()); | 2534 LOperand* index = UseTempRegister(instr->index()); |
| 2546 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2535 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2547 } | 2536 } |
| 2548 | 2537 |
| 2549 | 2538 |
| 2550 } } // namespace v8::internal | 2539 } } // namespace v8::internal |
| 2551 | 2540 |
| 2552 #endif // V8_TARGET_ARCH_X64 | 2541 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |