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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 678 |
679 void HValue::Kill() { | 679 void HValue::Kill() { |
680 // Instead of going through the entire use list of each operand, we only | 680 // Instead of going through the entire use list of each operand, we only |
681 // check the first item in each use list and rely on the tail() method to | 681 // check the first item in each use list and rely on the tail() method to |
682 // skip dead items, removing them lazily next time we traverse the list. | 682 // skip dead items, removing them lazily next time we traverse the list. |
683 SetFlag(kIsDead); | 683 SetFlag(kIsDead); |
684 for (int i = 0; i < OperandCount(); ++i) { | 684 for (int i = 0; i < OperandCount(); ++i) { |
685 HValue* operand = OperandAt(i); | 685 HValue* operand = OperandAt(i); |
686 if (operand == NULL) continue; | 686 if (operand == NULL) continue; |
687 HUseListNode* first = operand->use_list_; | 687 HUseListNode* first = operand->use_list_; |
688 if (first != NULL && first->value() == this && first->index() == i) { | 688 if (first != NULL && first->value()->CheckFlag(kIsDead)) { |
689 operand->use_list_ = first->tail(); | 689 operand->use_list_ = first->tail(); |
690 } | 690 } |
691 } | 691 } |
692 } | 692 } |
693 | 693 |
694 | 694 |
695 void HValue::SetBlock(HBasicBlock* block) { | 695 void HValue::SetBlock(HBasicBlock* block) { |
696 ASSERT(block_ == NULL || block == NULL); | 696 ASSERT(block_ == NULL || block == NULL); |
697 block_ = block; | 697 block_ = block; |
698 if (id_ == kNoNumber && block != NULL) { | 698 if (id_ == kNoNumber && block != NULL) { |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 } | 1973 } |
1974 | 1974 |
1975 | 1975 |
1976 void HPhi::AddIndirectUsesTo(int* dest) { | 1976 void HPhi::AddIndirectUsesTo(int* dest) { |
1977 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 1977 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
1978 dest[i] += indirect_uses_[i]; | 1978 dest[i] += indirect_uses_[i]; |
1979 } | 1979 } |
1980 } | 1980 } |
1981 | 1981 |
1982 | 1982 |
1983 void HSimulate::MergeInto(HSimulate* other) { | 1983 void HSimulate::MergeWith(ZoneList<HSimulate*>* list) { |
1984 for (int i = 0; i < values_.length(); ++i) { | 1984 while (!list->is_empty()) { |
1985 HValue* value = values_[i]; | 1985 HSimulate* from = list->RemoveLast(); |
1986 if (HasAssignedIndexAt(i)) { | 1986 ZoneList<HValue*>* from_values = &from->values_; |
1987 other->AddAssignedValue(GetAssignedIndexAt(i), value); | 1987 for (int i = 0; i < from_values->length(); ++i) { |
1988 } else { | 1988 if (from->HasAssignedIndexAt(i)) { |
1989 if (other->pop_count_ > 0) { | 1989 AddAssignedValue(from->GetAssignedIndexAt(i), |
1990 other->pop_count_--; | 1990 from_values->at(i)); |
1991 } else { | 1991 } else { |
1992 other->AddPushedValue(value); | 1992 if (pop_count_ > 0) { |
| 1993 pop_count_--; |
| 1994 } else { |
| 1995 AddPushedValue(from_values->at(i)); |
| 1996 } |
1993 } | 1997 } |
1994 } | 1998 } |
| 1999 pop_count_ += from->pop_count_; |
| 2000 from->DeleteAndReplaceWith(NULL); |
1995 } | 2001 } |
1996 other->pop_count_ += pop_count(); | |
1997 } | 2002 } |
1998 | 2003 |
1999 | 2004 |
2000 void HSimulate::PrintDataTo(StringStream* stream) { | 2005 void HSimulate::PrintDataTo(StringStream* stream) { |
2001 stream->Add("id=%d", ast_id().ToInt()); | 2006 stream->Add("id=%d", ast_id().ToInt()); |
2002 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_); | 2007 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_); |
2003 if (values_.length() > 0) { | 2008 if (values_.length() > 0) { |
2004 if (pop_count_ > 0) stream->Add(" /"); | 2009 if (pop_count_ > 0) stream->Add(" /"); |
2005 for (int i = values_.length() - 1; i >= 0; --i) { | 2010 for (int i = values_.length() - 1; i >= 0; --i) { |
2006 if (i > 0) stream->Add(","); | 2011 if (i > 0) stream->Add(","); |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3531 | 3536 |
3532 | 3537 |
3533 void HCheckFunction::Verify() { | 3538 void HCheckFunction::Verify() { |
3534 HInstruction::Verify(); | 3539 HInstruction::Verify(); |
3535 ASSERT(HasNoUses()); | 3540 ASSERT(HasNoUses()); |
3536 } | 3541 } |
3537 | 3542 |
3538 #endif | 3543 #endif |
3539 | 3544 |
3540 } } // namespace v8::internal | 3545 } } // namespace v8::internal |
OLD | NEW |