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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 ASSERT(!next->IsBlockEntry()); | 734 ASSERT(!next->IsBlockEntry()); |
735 ASSERT(!IsControlInstruction()); | 735 ASSERT(!IsControlInstruction()); |
736 ASSERT(!next->block()->IsStartBlock()); | 736 ASSERT(!next->block()->IsStartBlock()); |
737 ASSERT(next->previous_ != NULL); | 737 ASSERT(next->previous_ != NULL); |
738 HInstruction* prev = next->previous(); | 738 HInstruction* prev = next->previous(); |
739 prev->next_ = this; | 739 prev->next_ = this; |
740 next->previous_ = this; | 740 next->previous_ = this; |
741 next_ = next; | 741 next_ = next; |
742 previous_ = prev; | 742 previous_ = prev; |
743 SetBlock(next->block()); | 743 SetBlock(next->block()); |
744 if (position() == RelocInfo::kNoPosition) { | |
745 if (next->position() != RelocInfo::kNoPosition) { | |
746 set_position(next->position()); | |
747 } else { | |
748 ASSERT(next->position() == RelocInfo::kNoPosition); | |
Michael Starzinger
2013/10/18 13:04:21
nit: This if cascade looks awfully complex, especi
danno
2013/10/19 17:11:40
Done.
| |
749 } | |
750 } | |
744 } | 751 } |
745 | 752 |
746 | 753 |
747 void HInstruction::InsertAfter(HInstruction* previous) { | 754 void HInstruction::InsertAfter(HInstruction* previous) { |
748 ASSERT(!IsLinked()); | 755 ASSERT(!IsLinked()); |
749 ASSERT(!previous->IsControlInstruction()); | 756 ASSERT(!previous->IsControlInstruction()); |
750 ASSERT(!IsControlInstruction() || previous->next_ == NULL); | 757 ASSERT(!IsControlInstruction() || previous->next_ == NULL); |
751 HBasicBlock* block = previous->block(); | 758 HBasicBlock* block = previous->block(); |
752 // Never insert anything except constants into the start block after finishing | 759 // Never insert anything except constants into the start block after finishing |
753 // it. | 760 // it. |
(...skipping 14 matching lines...) Expand all Loading... | |
768 } | 775 } |
769 | 776 |
770 previous_ = previous; | 777 previous_ = previous; |
771 next_ = next; | 778 next_ = next; |
772 SetBlock(block); | 779 SetBlock(block); |
773 previous->next_ = this; | 780 previous->next_ = this; |
774 if (next != NULL) next->previous_ = this; | 781 if (next != NULL) next->previous_ = this; |
775 if (block->last() == previous) { | 782 if (block->last() == previous) { |
776 block->set_last(this); | 783 block->set_last(this); |
777 } | 784 } |
785 if (position() == RelocInfo::kNoPosition) { | |
786 if (previous->position() != RelocInfo::kNoPosition) { | |
787 set_position(previous->position()); | |
788 } else { | |
789 ASSERT(previous->position() == RelocInfo::kNoPosition); | |
Michael Starzinger
2013/10/18 13:04:21
nit: Likewise.
Michael Starzinger
2013/10/18 13:04:21
nit: Likewise.
danno
2013/10/19 17:11:40
Done.
danno
2013/10/19 17:11:40
Done.
| |
790 } | |
791 } | |
778 } | 792 } |
779 | 793 |
780 | 794 |
781 #ifdef DEBUG | 795 #ifdef DEBUG |
782 void HInstruction::Verify() { | 796 void HInstruction::Verify() { |
783 // Verify that input operands are defined before use. | 797 // Verify that input operands are defined before use. |
784 HBasicBlock* cur_block = block(); | 798 HBasicBlock* cur_block = block(); |
785 for (int i = 0; i < OperandCount(); ++i) { | 799 for (int i = 0; i < OperandCount(); ++i) { |
786 HValue* other_operand = OperandAt(i); | 800 HValue* other_operand = OperandAt(i); |
787 if (other_operand == NULL) continue; | 801 if (other_operand == NULL) continue; |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1585 Range* HConstant::InferRange(Zone* zone) { | 1599 Range* HConstant::InferRange(Zone* zone) { |
1586 if (has_int32_value_) { | 1600 if (has_int32_value_) { |
1587 Range* result = new(zone) Range(int32_value_, int32_value_); | 1601 Range* result = new(zone) Range(int32_value_, int32_value_); |
1588 result->set_can_be_minus_zero(false); | 1602 result->set_can_be_minus_zero(false); |
1589 return result; | 1603 return result; |
1590 } | 1604 } |
1591 return HValue::InferRange(zone); | 1605 return HValue::InferRange(zone); |
1592 } | 1606 } |
1593 | 1607 |
1594 | 1608 |
1609 int HPhi::position() const { | |
1610 return block()->first()->position(); | |
1611 } | |
1612 | |
1613 | |
1595 Range* HPhi::InferRange(Zone* zone) { | 1614 Range* HPhi::InferRange(Zone* zone) { |
1596 Representation r = representation(); | 1615 Representation r = representation(); |
1597 if (r.IsSmiOrInteger32()) { | 1616 if (r.IsSmiOrInteger32()) { |
1598 if (block()->IsLoopHeader()) { | 1617 if (block()->IsLoopHeader()) { |
1599 Range* range = r.IsSmi() | 1618 Range* range = r.IsSmi() |
1600 ? new(zone) Range(Smi::kMinValue, Smi::kMaxValue) | 1619 ? new(zone) Range(Smi::kMinValue, Smi::kMaxValue) |
1601 : new(zone) Range(kMinInt, kMaxInt); | 1620 : new(zone) Range(kMinInt, kMaxInt); |
1602 return range; | 1621 return range; |
1603 } else { | 1622 } else { |
1604 Range* range = OperandAt(0)->range()->Copy(zone); | 1623 Range* range = OperandAt(0)->range()->Copy(zone); |
(...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4271 break; | 4290 break; |
4272 case kExternalMemory: | 4291 case kExternalMemory: |
4273 stream->Add("[external-memory]"); | 4292 stream->Add("[external-memory]"); |
4274 break; | 4293 break; |
4275 } | 4294 } |
4276 | 4295 |
4277 stream->Add("@%d", offset()); | 4296 stream->Add("@%d", offset()); |
4278 } | 4297 } |
4279 | 4298 |
4280 } } // namespace v8::internal | 4299 } } // namespace v8::internal |
OLD | NEW |