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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 572 |
573 void HValue::Kill() { | 573 void HValue::Kill() { |
574 // Instead of going through the entire use list of each operand, we only | 574 // Instead of going through the entire use list of each operand, we only |
575 // check the first item in each use list and rely on the tail() method to | 575 // check the first item in each use list and rely on the tail() method to |
576 // skip dead items, removing them lazily next time we traverse the list. | 576 // skip dead items, removing them lazily next time we traverse the list. |
577 SetFlag(kIsDead); | 577 SetFlag(kIsDead); |
578 for (int i = 0; i < OperandCount(); ++i) { | 578 for (int i = 0; i < OperandCount(); ++i) { |
579 HValue* operand = OperandAt(i); | 579 HValue* operand = OperandAt(i); |
580 if (operand == NULL) continue; | 580 if (operand == NULL) continue; |
581 HUseListNode* first = operand->use_list_; | 581 HUseListNode* first = operand->use_list_; |
582 if (first != NULL && first->value() == this && first->index() == i) { | 582 if (first != NULL && first->value()->CheckFlag(kIsDead)) { |
583 operand->use_list_ = first->tail(); | 583 operand->use_list_ = first->tail(); |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 | 588 |
589 void HValue::SetBlock(HBasicBlock* block) { | 589 void HValue::SetBlock(HBasicBlock* block) { |
590 ASSERT(block_ == NULL || block == NULL); | 590 ASSERT(block_ == NULL || block == NULL); |
591 block_ = block; | 591 block_ = block; |
592 if (id_ == kNoNumber && block != NULL) { | 592 if (id_ == kNoNumber && block != NULL) { |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 } | 1742 } |
1743 | 1743 |
1744 | 1744 |
1745 void HPhi::AddIndirectUsesTo(int* dest) { | 1745 void HPhi::AddIndirectUsesTo(int* dest) { |
1746 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 1746 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
1747 dest[i] += indirect_uses_[i]; | 1747 dest[i] += indirect_uses_[i]; |
1748 } | 1748 } |
1749 } | 1749 } |
1750 | 1750 |
1751 | 1751 |
1752 void HSimulate::MergeInto(HSimulate* other) { | 1752 void HSimulate::MergeWith(ZoneList<HSimulate*>* list) { |
1753 for (int i = 0; i < values_.length(); ++i) { | 1753 while (!list->is_empty()) { |
1754 HValue* value = values_[i]; | 1754 HSimulate* from = list->RemoveLast(); |
1755 if (HasAssignedIndexAt(i)) { | 1755 ZoneList<HValue*>* from_values = &from->values_; |
1756 other->AddAssignedValue(GetAssignedIndexAt(i), value); | 1756 for (int i = 0; i < from_values->length(); ++i) { |
1757 } else { | 1757 if (from->HasAssignedIndexAt(i)) { |
1758 if (other->pop_count_ > 0) { | 1758 AddAssignedValue(from->GetAssignedIndexAt(i), |
1759 other->pop_count_--; | 1759 from_values->at(i)); |
1760 } else { | 1760 } else { |
1761 other->AddPushedValue(value); | 1761 if (pop_count_ > 0) { |
| 1762 pop_count_--; |
| 1763 } else { |
| 1764 AddPushedValue(from_values->at(i)); |
| 1765 } |
1762 } | 1766 } |
1763 } | 1767 } |
| 1768 pop_count_ += from->pop_count_; |
| 1769 from->DeleteAndReplaceWith(NULL); |
1764 } | 1770 } |
1765 other->pop_count_ += pop_count(); | |
1766 } | 1771 } |
1767 | 1772 |
1768 | 1773 |
1769 void HSimulate::PrintDataTo(StringStream* stream) { | 1774 void HSimulate::PrintDataTo(StringStream* stream) { |
1770 stream->Add("id=%d", ast_id().ToInt()); | 1775 stream->Add("id=%d", ast_id().ToInt()); |
1771 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_); | 1776 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_); |
1772 if (values_.length() > 0) { | 1777 if (values_.length() > 0) { |
1773 if (pop_count_ > 0) stream->Add(" /"); | 1778 if (pop_count_ > 0) stream->Add(" /"); |
1774 for (int i = values_.length() - 1; i >= 0; --i) { | 1779 for (int i = values_.length() - 1; i >= 0; --i) { |
1775 if (i > 0) stream->Add(","); | 1780 if (i > 0) stream->Add(","); |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3262 | 3267 |
3263 | 3268 |
3264 void HCheckFunction::Verify() { | 3269 void HCheckFunction::Verify() { |
3265 HInstruction::Verify(); | 3270 HInstruction::Verify(); |
3266 ASSERT(HasNoUses()); | 3271 ASSERT(HasNoUses()); |
3267 } | 3272 } |
3268 | 3273 |
3269 #endif | 3274 #endif |
3270 | 3275 |
3271 } } // namespace v8::internal | 3276 } } // namespace v8::internal |
OLD | NEW |