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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 } | 787 } |
788 } else { | 788 } else { |
789 // If the following assert fires, you may have forgotten an | 789 // If the following assert fires, you may have forgotten an |
790 // AddInstruction. | 790 // AddInstruction. |
791 ASSERT(other_block->Dominates(cur_block)); | 791 ASSERT(other_block->Dominates(cur_block)); |
792 } | 792 } |
793 } | 793 } |
794 | 794 |
795 // Verify that instructions that may have side-effects are followed | 795 // Verify that instructions that may have side-effects are followed |
796 // by a simulate instruction. | 796 // by a simulate instruction. |
797 if (HasObservableSideEffects() && !IsOsrEntry()) { | 797 if (HasObservableSideEffects() && !IsOsrEntry() && !IsControlInstruction()) { |
798 ASSERT(next()->IsSimulate()); | 798 ASSERT(next()->IsSimulate()); |
799 } | 799 } |
800 | 800 |
801 // Verify that instructions that can be eliminated by GVN have overridden | 801 // Verify that instructions that can be eliminated by GVN have overridden |
802 // HValue::DataEquals. The default implementation is UNREACHABLE. We | 802 // HValue::DataEquals. The default implementation is UNREACHABLE. We |
803 // don't actually care whether DataEquals returns true or false here. | 803 // don't actually care whether DataEquals returns true or false here. |
804 if (CheckFlag(kUseGVN)) DataEquals(this); | 804 if (CheckFlag(kUseGVN)) DataEquals(this); |
805 | 805 |
806 // Verify that all uses are in the graph. | 806 // Verify that all uses are in the graph. |
807 for (HUseIterator use = uses(); !use.Done(); use.Advance()) { | 807 for (HUseIterator use = uses(); !use.Done(); use.Advance()) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 stream->Add(" goto ("); | 1004 stream->Add(" goto ("); |
1005 bool first_block = true; | 1005 bool first_block = true; |
1006 for (HSuccessorIterator it(this); !it.Done(); it.Advance()) { | 1006 for (HSuccessorIterator it(this); !it.Done(); it.Advance()) { |
1007 stream->Add(first_block ? "B%d" : ", B%d", it.Current()->block_id()); | 1007 stream->Add(first_block ? "B%d" : ", B%d", it.Current()->block_id()); |
1008 first_block = false; | 1008 first_block = false; |
1009 } | 1009 } |
1010 stream->Add(")"); | 1010 stream->Add(")"); |
1011 } | 1011 } |
1012 | 1012 |
1013 | 1013 |
| 1014 #ifdef DEBUG |
| 1015 void HControlInstruction::Verify() { |
| 1016 HInstruction::Verify(); |
| 1017 if (!HasObservableSideEffects()) return; |
| 1018 for (HSuccessorIterator it(this); !it.Done(); it.Advance()) { |
| 1019 // For ControlInstructions we need to verify that the successors all start |
| 1020 // with a Simulate. |
| 1021 HInstruction* first = it.Current()->first()->next(); |
| 1022 ASSERT(first->IsSimulate() || |
| 1023 (first->IsLeaveInlined() && first->next()->IsSimulate())); |
| 1024 } |
| 1025 } |
| 1026 #endif |
| 1027 |
| 1028 |
1014 void HUnaryControlInstruction::PrintDataTo(StringStream* stream) { | 1029 void HUnaryControlInstruction::PrintDataTo(StringStream* stream) { |
1015 value()->PrintNameTo(stream); | 1030 value()->PrintNameTo(stream); |
1016 HControlInstruction::PrintDataTo(stream); | 1031 HControlInstruction::PrintDataTo(stream); |
1017 } | 1032 } |
1018 | 1033 |
1019 | 1034 |
1020 void HReturn::PrintDataTo(StringStream* stream) { | 1035 void HReturn::PrintDataTo(StringStream* stream) { |
1021 value()->PrintNameTo(stream); | 1036 value()->PrintNameTo(stream); |
1022 stream->Add(" (pop "); | 1037 stream->Add(" (pop "); |
1023 parameter_count()->PrintNameTo(stream); | 1038 parameter_count()->PrintNameTo(stream); |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 case EXTERNAL_SHORT_ELEMENTS: | 2831 case EXTERNAL_SHORT_ELEMENTS: |
2817 return new(zone) Range(-32768, 32767); | 2832 return new(zone) Range(-32768, 32767); |
2818 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2833 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
2819 return new(zone) Range(0, 65535); | 2834 return new(zone) Range(0, 65535); |
2820 default: | 2835 default: |
2821 return HValue::InferRange(zone); | 2836 return HValue::InferRange(zone); |
2822 } | 2837 } |
2823 } | 2838 } |
2824 | 2839 |
2825 | 2840 |
2826 void HCompareGeneric::PrintDataTo(StringStream* stream) { | 2841 void HCompareGenericAndBranch::PrintDataTo(StringStream* stream) { |
2827 stream->Add(Token::Name(token())); | 2842 stream->Add(Token::Name(token())); |
2828 stream->Add(" "); | 2843 stream->Add(" "); |
2829 HBinaryOperation::PrintDataTo(stream); | 2844 left()->PrintNameTo(stream); |
| 2845 stream->Add(" "); |
| 2846 right()->PrintNameTo(stream); |
| 2847 if (CheckFlag(kCanOverflow)) stream->Add(" !"); |
| 2848 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
2830 } | 2849 } |
2831 | 2850 |
2832 | 2851 |
2833 void HStringCompareAndBranch::PrintDataTo(StringStream* stream) { | 2852 void HStringCompareAndBranch::PrintDataTo(StringStream* stream) { |
2834 stream->Add(Token::Name(token())); | 2853 stream->Add(Token::Name(token())); |
2835 stream->Add(" "); | 2854 stream->Add(" "); |
2836 HControlInstruction::PrintDataTo(stream); | 2855 HControlInstruction::PrintDataTo(stream); |
2837 } | 2856 } |
2838 | 2857 |
2839 | 2858 |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4223 break; | 4242 break; |
4224 case kExternalMemory: | 4243 case kExternalMemory: |
4225 stream->Add("[external-memory]"); | 4244 stream->Add("[external-memory]"); |
4226 break; | 4245 break; |
4227 } | 4246 } |
4228 | 4247 |
4229 stream->Add("@%d", offset()); | 4248 stream->Add("@%d", offset()); |
4230 } | 4249 } |
4231 | 4250 |
4232 } } // namespace v8::internal | 4251 } } // namespace v8::internal |
OLD | NEW |