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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 | 808 |
809 void HBinaryCall::PrintDataTo(StringStream* stream) { | 809 void HBinaryCall::PrintDataTo(StringStream* stream) { |
810 first()->PrintNameTo(stream); | 810 first()->PrintNameTo(stream); |
811 stream->Add(" "); | 811 stream->Add(" "); |
812 second()->PrintNameTo(stream); | 812 second()->PrintNameTo(stream); |
813 stream->Add(" "); | 813 stream->Add(" "); |
814 stream->Add("#%d", argument_count()); | 814 stream->Add("#%d", argument_count()); |
815 } | 815 } |
816 | 816 |
817 | 817 |
818 HBoundsCheck* HBoundsCheck::AddAfter( | |
Jakob Kummerow
2013/02/06 13:43:59
I don't see this used anywhere.
Massi
2013/02/06 19:12:31
Removed.
| |
819 HInstruction* insertion_point, HValue* index, HValue* length, | |
820 BoundsCheckKeyMode key_mode, Representation r) { | |
821 Zone* zone = insertion_point->block()->graph()->zone(); | |
822 HDeoptimizeIfTaggedIsNotSmi* checked_index = | |
823 new(zone) HDeoptimizeIfTaggedIsNotSmi(index, r); | |
824 checked_index->InsertAfter(insertion_point); | |
825 HDeoptimizeIfTaggedIsNotSmi* checked_length = | |
826 new(zone) HDeoptimizeIfTaggedIsNotSmi(length, r); | |
827 checked_length->InsertAfter(checked_index); | |
828 HBoundsCheck* result = new(zone) HBoundsCheck( | |
829 checked_index, checked_length, key_mode, r); | |
830 result->InsertAfter(checked_length); | |
831 return result; | |
832 } | |
833 | |
834 | |
835 HBoundsCheck* HBoundsCheck::AddToGraph( | |
836 HGraphBuilder* graph_builder, HValue* index, HValue* length, | |
837 BoundsCheckKeyMode key_mode, Representation r) { | |
838 Zone* zone = graph_builder->graph()->zone(); | |
839 HDeoptimizeIfTaggedIsNotSmi* checked_index = | |
840 new(zone) HDeoptimizeIfTaggedIsNotSmi(index, r); | |
841 graph_builder->AddInstruction(checked_index); | |
842 HDeoptimizeIfTaggedIsNotSmi* checked_length = | |
Jakob Kummerow
2013/02/06 13:43:59
Didn't we agree that HBoundsCheck is only ever use
Massi
2013/02/06 19:12:31
Done.
| |
843 new(zone) HDeoptimizeIfTaggedIsNotSmi(length, r); | |
844 graph_builder->AddInstruction(checked_length); | |
845 HBoundsCheck* result = new(zone) HBoundsCheck( | |
846 checked_index, checked_length, key_mode, r); | |
847 graph_builder->AddInstruction(result); | |
848 return result; | |
849 } | |
850 | |
851 | |
818 void HBoundsCheck::PrintDataTo(StringStream* stream) { | 852 void HBoundsCheck::PrintDataTo(StringStream* stream) { |
819 index()->PrintNameTo(stream); | 853 index()->PrintNameTo(stream); |
820 stream->Add(" "); | 854 stream->Add(" "); |
821 length()->PrintNameTo(stream); | 855 length()->PrintNameTo(stream); |
822 } | 856 } |
823 | 857 |
824 | 858 |
825 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { | 859 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
826 ASSERT(CheckFlag(kFlexibleRepresentation)); | 860 ASSERT(CheckFlag(kFlexibleRepresentation)); |
827 Representation r; | 861 Representation r; |
828 if (key_mode_ == DONT_ALLOW_SMI_KEY || | 862 if (key_mode_ == DONT_ALLOW_SMI_KEY || |
829 !length()->representation().IsTagged()) { | 863 !length()->representation().IsTagged()) { |
830 r = Representation::Integer32(); | 864 r = Representation::Integer32(); |
831 } else if (index()->representation().IsTagged() || | 865 } else if (index()->representation().IsTagged() || |
832 (index()->IsConstant() && | 866 (index()->ActualValue()->IsConstant() && |
833 HConstant::cast(index())->HasInteger32Value() && | 867 HConstant::cast(index()->ActualValue())->HasSmiValue())) { |
834 Smi::IsValid(HConstant::cast(index())->Integer32Value()))) { | |
835 // If the index is tagged, or a constant that holds a Smi, allow the length | 868 // If the index is tagged, or a constant that holds a Smi, allow the length |
836 // to be tagged, since it is usually already tagged from loading it out of | 869 // to be tagged, since it is usually already tagged from loading it out of |
837 // the length field of a JSArray. This allows for direct comparison without | 870 // the length field of a JSArray. This allows for direct comparison without |
838 // untagging. | 871 // untagging. |
839 r = Representation::Tagged(); | 872 r = Representation::Tagged(); |
840 } else { | 873 } else { |
841 r = Representation::Integer32(); | 874 r = Representation::Integer32(); |
842 } | 875 } |
843 UpdateRepresentation(r, h_infer, "boundscheck"); | 876 UpdateRepresentation(r, h_infer, "boundscheck"); |
844 } | 877 } |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2385 // TODO(kasperl): Is there any way to signal that this isn't a smi? | 2418 // TODO(kasperl): Is there any way to signal that this isn't a smi? |
2386 return HType::Tagged(); | 2419 return HType::Tagged(); |
2387 } | 2420 } |
2388 | 2421 |
2389 | 2422 |
2390 HType HCheckSmi::CalculateInferredType() { | 2423 HType HCheckSmi::CalculateInferredType() { |
2391 return HType::Smi(); | 2424 return HType::Smi(); |
2392 } | 2425 } |
2393 | 2426 |
2394 | 2427 |
2428 void HDeoptimizeIfTaggedIsNotSmi::InferRepresentation( | |
2429 HInferRepresentation* h_infer) { | |
2430 ASSERT(CheckFlag(kFlexibleRepresentation)); | |
2431 Representation r = value()->representation().IsTagged() | |
2432 ? Representation::Tagged() : Representation::Integer32(); | |
2433 UpdateRepresentation(r, h_infer, "checksmiorint32"); | |
2434 } | |
2435 | |
2436 | |
2395 HType HPhi::CalculateInferredType() { | 2437 HType HPhi::CalculateInferredType() { |
2396 HType result = HType::Uninitialized(); | 2438 HType result = HType::Uninitialized(); |
2397 for (int i = 0; i < OperandCount(); ++i) { | 2439 for (int i = 0; i < OperandCount(); ++i) { |
2398 HType current = OperandAt(i)->type(); | 2440 HType current = OperandAt(i)->type(); |
2399 result = result.Combine(current); | 2441 result = result.Combine(current); |
2400 } | 2442 } |
2401 return result; | 2443 return result; |
2402 } | 2444 } |
2403 | 2445 |
2404 | 2446 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2920 ASSERT(HasAstId()); | 2962 ASSERT(HasAstId()); |
2921 } | 2963 } |
2922 | 2964 |
2923 | 2965 |
2924 void HCheckSmi::Verify() { | 2966 void HCheckSmi::Verify() { |
2925 HInstruction::Verify(); | 2967 HInstruction::Verify(); |
2926 ASSERT(HasNoUses()); | 2968 ASSERT(HasNoUses()); |
2927 } | 2969 } |
2928 | 2970 |
2929 | 2971 |
2972 void HDeoptimizeIfTaggedIsNotSmi::Verify() { | |
2973 HInstruction::Verify(); | |
Jakob Kummerow
2013/02/06 13:43:59
This is the default implementation, no need to ove
Massi
2013/02/06 19:12:31
The linker complains if I don't override it (and i
Jakob Kummerow
2013/02/07 16:17:14
Not for me. Maybe you've forgotten to remove the d
Massi
2013/02/11 10:35:55
I was sure I had deleted, but I did not :-/
Done :
| |
2974 } | |
2975 | |
2976 | |
2930 void HCheckNonSmi::Verify() { | 2977 void HCheckNonSmi::Verify() { |
2931 HInstruction::Verify(); | 2978 HInstruction::Verify(); |
2932 ASSERT(HasNoUses()); | 2979 ASSERT(HasNoUses()); |
2933 } | 2980 } |
2934 | 2981 |
2935 | 2982 |
2936 void HCheckFunction::Verify() { | 2983 void HCheckFunction::Verify() { |
2937 HInstruction::Verify(); | 2984 HInstruction::Verify(); |
2938 ASSERT(HasNoUses()); | 2985 ASSERT(HasNoUses()); |
2939 } | 2986 } |
2940 | 2987 |
2941 #endif | 2988 #endif |
2942 | 2989 |
2943 } } // namespace v8::internal | 2990 } } // namespace v8::internal |
OLD | NEW |