| 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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 length()->PrintNameTo(stream); | 923 length()->PrintNameTo(stream); |
| 924 if (skip_check()) { | 924 if (skip_check()) { |
| 925 stream->Add(" [DISABLED]"); | 925 stream->Add(" [DISABLED]"); |
| 926 } | 926 } |
| 927 } | 927 } |
| 928 | 928 |
| 929 | 929 |
| 930 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { | 930 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
| 931 ASSERT(CheckFlag(kFlexibleRepresentation)); | 931 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 932 Representation r; | 932 Representation r; |
| 933 HValue* actual_length = length()->ActualValue(); |
| 934 HValue* actual_index = index()->ActualValue(); |
| 933 if (key_mode_ == DONT_ALLOW_SMI_KEY || | 935 if (key_mode_ == DONT_ALLOW_SMI_KEY || |
| 934 !length()->representation().IsTagged()) { | 936 !actual_length->representation().IsTagged()) { |
| 935 r = Representation::Integer32(); | 937 r = Representation::Integer32(); |
| 936 } else if (index()->representation().IsTagged() || | 938 } else if (actual_index->representation().IsTagged() || |
| 937 (index()->ActualValue()->IsConstant() && | 939 (actual_index->IsConstant() && |
| 938 HConstant::cast(index()->ActualValue())->HasSmiValue())) { | 940 HConstant::cast(actual_index)->HasSmiValue())) { |
| 939 // If the index is tagged, or a constant that holds a Smi, allow the length | 941 // If the index is tagged, or a constant that holds a Smi, allow the length |
| 940 // to be tagged, since it is usually already tagged from loading it out of | 942 // to be tagged, since it is usually already tagged from loading it out of |
| 941 // the length field of a JSArray. This allows for direct comparison without | 943 // the length field of a JSArray. This allows for direct comparison without |
| 942 // untagging. | 944 // untagging. |
| 943 r = Representation::Tagged(); | 945 r = Representation::Tagged(); |
| 944 } else { | 946 } else { |
| 945 r = Representation::Integer32(); | 947 r = Representation::Integer32(); |
| 946 } | 948 } |
| 947 UpdateRepresentation(r, h_infer, "boundscheck"); | 949 UpdateRepresentation(r, h_infer, "boundscheck"); |
| 948 } | 950 } |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 } | 2560 } |
| 2559 | 2561 |
| 2560 | 2562 |
| 2561 HType HCheckSmi::CalculateInferredType() { | 2563 HType HCheckSmi::CalculateInferredType() { |
| 2562 return HType::Smi(); | 2564 return HType::Smi(); |
| 2563 } | 2565 } |
| 2564 | 2566 |
| 2565 | 2567 |
| 2566 void HCheckSmiOrInt32::InferRepresentation(HInferRepresentation* h_infer) { | 2568 void HCheckSmiOrInt32::InferRepresentation(HInferRepresentation* h_infer) { |
| 2567 ASSERT(CheckFlag(kFlexibleRepresentation)); | 2569 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 2568 Representation r = value()->representation().IsTagged() | 2570 ASSERT(UseCount() == 1); |
| 2569 ? Representation::Tagged() : Representation::Integer32(); | 2571 HUseIterator use = uses(); |
| 2572 Representation r = use.value()->RequiredInputRepresentation(use.index()); |
| 2570 UpdateRepresentation(r, h_infer, "checksmiorint32"); | 2573 UpdateRepresentation(r, h_infer, "checksmiorint32"); |
| 2571 } | 2574 } |
| 2572 | 2575 |
| 2573 | 2576 |
| 2574 HType HPhi::CalculateInferredType() { | 2577 HType HPhi::CalculateInferredType() { |
| 2575 HType result = HType::Uninitialized(); | 2578 HType result = HType::Uninitialized(); |
| 2576 for (int i = 0; i < OperandCount(); ++i) { | 2579 for (int i = 0; i < OperandCount(); ++i) { |
| 2577 HType current = OperandAt(i)->type(); | 2580 HType current = OperandAt(i)->type(); |
| 2578 result = result.Combine(current); | 2581 result = result.Combine(current); |
| 2579 } | 2582 } |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 | 3265 |
| 3263 | 3266 |
| 3264 void HCheckFunction::Verify() { | 3267 void HCheckFunction::Verify() { |
| 3265 HInstruction::Verify(); | 3268 HInstruction::Verify(); |
| 3266 ASSERT(HasNoUses()); | 3269 ASSERT(HasNoUses()); |
| 3267 } | 3270 } |
| 3268 | 3271 |
| 3269 #endif | 3272 #endif |
| 3270 | 3273 |
| 3271 } } // namespace v8::internal | 3274 } } // namespace v8::internal |
| OLD | NEW |