Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 11cc901b38ccfccf7a3607f99e1088b47b7f4ac9..988d958b48223eb026bc9631a56e9682fad1add3 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -815,6 +815,40 @@ void HBinaryCall::PrintDataTo(StringStream* stream) { |
} |
+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.
|
+ HInstruction* insertion_point, HValue* index, HValue* length, |
+ BoundsCheckKeyMode key_mode, Representation r) { |
+ Zone* zone = insertion_point->block()->graph()->zone(); |
+ HDeoptimizeIfTaggedIsNotSmi* checked_index = |
+ new(zone) HDeoptimizeIfTaggedIsNotSmi(index, r); |
+ checked_index->InsertAfter(insertion_point); |
+ HDeoptimizeIfTaggedIsNotSmi* checked_length = |
+ new(zone) HDeoptimizeIfTaggedIsNotSmi(length, r); |
+ checked_length->InsertAfter(checked_index); |
+ HBoundsCheck* result = new(zone) HBoundsCheck( |
+ checked_index, checked_length, key_mode, r); |
+ result->InsertAfter(checked_length); |
+ return result; |
+} |
+ |
+ |
+HBoundsCheck* HBoundsCheck::AddToGraph( |
+ HGraphBuilder* graph_builder, HValue* index, HValue* length, |
+ BoundsCheckKeyMode key_mode, Representation r) { |
+ Zone* zone = graph_builder->graph()->zone(); |
+ HDeoptimizeIfTaggedIsNotSmi* checked_index = |
+ new(zone) HDeoptimizeIfTaggedIsNotSmi(index, r); |
+ graph_builder->AddInstruction(checked_index); |
+ 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.
|
+ new(zone) HDeoptimizeIfTaggedIsNotSmi(length, r); |
+ graph_builder->AddInstruction(checked_length); |
+ HBoundsCheck* result = new(zone) HBoundsCheck( |
+ checked_index, checked_length, key_mode, r); |
+ graph_builder->AddInstruction(result); |
+ return result; |
+} |
+ |
+ |
void HBoundsCheck::PrintDataTo(StringStream* stream) { |
index()->PrintNameTo(stream); |
stream->Add(" "); |
@@ -829,9 +863,8 @@ void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
!length()->representation().IsTagged()) { |
r = Representation::Integer32(); |
} else if (index()->representation().IsTagged() || |
- (index()->IsConstant() && |
- HConstant::cast(index())->HasInteger32Value() && |
- Smi::IsValid(HConstant::cast(index())->Integer32Value()))) { |
+ (index()->ActualValue()->IsConstant() && |
+ HConstant::cast(index()->ActualValue())->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 |
@@ -2392,6 +2425,15 @@ HType HCheckSmi::CalculateInferredType() { |
} |
+void HDeoptimizeIfTaggedIsNotSmi::InferRepresentation( |
+ HInferRepresentation* h_infer) { |
+ ASSERT(CheckFlag(kFlexibleRepresentation)); |
+ Representation r = value()->representation().IsTagged() |
+ ? Representation::Tagged() : Representation::Integer32(); |
+ UpdateRepresentation(r, h_infer, "checksmiorint32"); |
+} |
+ |
+ |
HType HPhi::CalculateInferredType() { |
HType result = HType::Uninitialized(); |
for (int i = 0; i < OperandCount(); ++i) { |
@@ -2927,6 +2969,11 @@ void HCheckSmi::Verify() { |
} |
+void HDeoptimizeIfTaggedIsNotSmi::Verify() { |
+ 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 :
|
+} |
+ |
+ |
void HCheckNonSmi::Verify() { |
HInstruction::Verify(); |
ASSERT(HasNoUses()); |