Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index aef227f60d0b98a67c59c980fcbfc9947550a598..38fca76dece4200d711b44fd433b01557e1be2e9 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -930,12 +930,14 @@ void HBoundsCheck::PrintDataTo(StringStream* stream) { |
void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
ASSERT(CheckFlag(kFlexibleRepresentation)); |
Representation r; |
+ HValue* actual_length = length()->ActualValue(); |
+ HValue* actual_index = index()->ActualValue(); |
if (key_mode_ == DONT_ALLOW_SMI_KEY || |
- !length()->representation().IsTagged()) { |
+ !actual_length->representation().IsTagged()) { |
r = Representation::Integer32(); |
- } else if (index()->representation().IsTagged() || |
- (index()->ActualValue()->IsConstant() && |
- HConstant::cast(index()->ActualValue())->HasSmiValue())) { |
+ } else if (actual_index->representation().IsTagged() || |
+ (actual_index->IsConstant() && |
+ HConstant::cast(actual_index)->HasSmiValue())) { |
// If the index is tagged, or a constant that holds a Smi, allow the length |
// to be tagged, since it is usually already tagged from loading it out of |
// the length field of a JSArray. This allows for direct comparison without |
@@ -2565,8 +2567,9 @@ HType HCheckSmi::CalculateInferredType() { |
void HCheckSmiOrInt32::InferRepresentation(HInferRepresentation* h_infer) { |
ASSERT(CheckFlag(kFlexibleRepresentation)); |
- Representation r = value()->representation().IsTagged() |
- ? Representation::Tagged() : Representation::Integer32(); |
+ ASSERT(UseCount() == 1); |
+ HUseIterator use = uses(); |
+ Representation r = use.value()->RequiredInputRepresentation(use.index()); |
UpdateRepresentation(r, h_infer, "checksmiorint32"); |
} |