Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 140683011: Improve positions tracking inside the HGraphBuilder. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 673 }
674 674
675 675
676 void HValue::ComputeInitialRange(Zone* zone) { 676 void HValue::ComputeInitialRange(Zone* zone) {
677 ASSERT(!HasRange()); 677 ASSERT(!HasRange());
678 range_ = InferRange(zone); 678 range_ = InferRange(zone);
679 ASSERT(HasRange()); 679 ASSERT(HasRange());
680 } 680 }
681 681
682 682
683 void HSourcePosition::PrintTo(FILE* out) {
684 if (IsUnknown()) {
685 PrintF(out, "<?>");
686 } else {
687 if (FLAG_hydrogen_track_positions) {
688 PrintF(out, "<%d:%d>", inlining_id(), position());
689 } else {
690 PrintF(out, "<0:%d>", raw());
691 }
692 }
693 }
694
695
683 void HInstruction::PrintTo(StringStream* stream) { 696 void HInstruction::PrintTo(StringStream* stream) {
684 PrintMnemonicTo(stream); 697 PrintMnemonicTo(stream);
685 PrintDataTo(stream); 698 PrintDataTo(stream);
686 PrintRangeTo(stream); 699 PrintRangeTo(stream);
687 PrintChangesTo(stream); 700 PrintChangesTo(stream);
688 PrintTypeTo(stream); 701 PrintTypeTo(stream);
689 if (CheckFlag(HValue::kHasNoObservableSideEffects)) { 702 if (CheckFlag(HValue::kHasNoObservableSideEffects)) {
690 stream->Add(" [noOSE]"); 703 stream->Add(" [noOSE]");
691 } 704 }
692 } 705 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 ASSERT(!next->IsBlockEntry()); 739 ASSERT(!next->IsBlockEntry());
727 ASSERT(!IsControlInstruction()); 740 ASSERT(!IsControlInstruction());
728 ASSERT(!next->block()->IsStartBlock()); 741 ASSERT(!next->block()->IsStartBlock());
729 ASSERT(next->previous_ != NULL); 742 ASSERT(next->previous_ != NULL);
730 HInstruction* prev = next->previous(); 743 HInstruction* prev = next->previous();
731 prev->next_ = this; 744 prev->next_ = this;
732 next->previous_ = this; 745 next->previous_ = this;
733 next_ = next; 746 next_ = next;
734 previous_ = prev; 747 previous_ = prev;
735 SetBlock(next->block()); 748 SetBlock(next->block());
736 if (position() == RelocInfo::kNoPosition && 749 if (!has_position() && next->has_position()) {
737 next->position() != RelocInfo::kNoPosition) {
738 set_position(next->position()); 750 set_position(next->position());
739 } 751 }
740 } 752 }
741 753
742 754
743 void HInstruction::InsertAfter(HInstruction* previous) { 755 void HInstruction::InsertAfter(HInstruction* previous) {
744 ASSERT(!IsLinked()); 756 ASSERT(!IsLinked());
745 ASSERT(!previous->IsControlInstruction()); 757 ASSERT(!previous->IsControlInstruction());
746 ASSERT(!IsControlInstruction() || previous->next_ == NULL); 758 ASSERT(!IsControlInstruction() || previous->next_ == NULL);
747 HBasicBlock* block = previous->block(); 759 HBasicBlock* block = previous->block();
(...skipping 16 matching lines...) Expand all
764 } 776 }
765 777
766 previous_ = previous; 778 previous_ = previous;
767 next_ = next; 779 next_ = next;
768 SetBlock(block); 780 SetBlock(block);
769 previous->next_ = this; 781 previous->next_ = this;
770 if (next != NULL) next->previous_ = this; 782 if (next != NULL) next->previous_ = this;
771 if (block->last() == previous) { 783 if (block->last() == previous) {
772 block->set_last(this); 784 block->set_last(this);
773 } 785 }
774 if (position() == RelocInfo::kNoPosition && 786 if (!has_position() && previous->has_position()) {
775 previous->position() != RelocInfo::kNoPosition) {
776 set_position(previous->position()); 787 set_position(previous->position());
777 } 788 }
778 } 789 }
779 790
780 791
781 #ifdef DEBUG 792 #ifdef DEBUG
782 void HInstruction::Verify() { 793 void HInstruction::Verify() {
783 // Verify that input operands are defined before use. 794 // Verify that input operands are defined before use.
784 HBasicBlock* cur_block = block(); 795 HBasicBlock* cur_block = block();
785 for (int i = 0; i < OperandCount(); ++i) { 796 for (int i = 0; i < OperandCount(); ++i) {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 Range* HConstant::InferRange(Zone* zone) { 1672 Range* HConstant::InferRange(Zone* zone) {
1662 if (has_int32_value_) { 1673 if (has_int32_value_) {
1663 Range* result = new(zone) Range(int32_value_, int32_value_); 1674 Range* result = new(zone) Range(int32_value_, int32_value_);
1664 result->set_can_be_minus_zero(false); 1675 result->set_can_be_minus_zero(false);
1665 return result; 1676 return result;
1666 } 1677 }
1667 return HValue::InferRange(zone); 1678 return HValue::InferRange(zone);
1668 } 1679 }
1669 1680
1670 1681
1671 int HPhi::position() const { 1682 HSourcePosition HPhi::position() const {
1672 return block()->first()->position(); 1683 return block()->first()->position();
1673 } 1684 }
1674 1685
1675 1686
1676 Range* HPhi::InferRange(Zone* zone) { 1687 Range* HPhi::InferRange(Zone* zone) {
1677 Representation r = representation(); 1688 Representation r = representation();
1678 if (r.IsSmiOrInteger32()) { 1689 if (r.IsSmiOrInteger32()) {
1679 if (block()->IsLoopHeader()) { 1690 if (block()->IsLoopHeader()) {
1680 Range* range = r.IsSmi() 1691 Range* range = r.IsSmi()
1681 ? new(zone) Range(Smi::kMinValue, Smi::kMaxValue) 1692 ? new(zone) Range(Smi::kMinValue, Smi::kMaxValue)
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
4439 break; 4450 break;
4440 case kExternalMemory: 4451 case kExternalMemory:
4441 stream->Add("[external-memory]"); 4452 stream->Add("[external-memory]");
4442 break; 4453 break;
4443 } 4454 }
4444 4455
4445 stream->Add("@%d", offset()); 4456 stream->Add("@%d", offset());
4446 } 4457 }
4447 4458
4448 } } // namespace v8::internal 4459 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698