Commit 41c63d88 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Only infer int32 in HBoundsCheck if input is double or int32.

R=jkummerow@chromium.org, mmassi@chromium.org

Review URL: https://chromiumcodereview.appspot.com/17057004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15156 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 84759d7e
...@@ -1151,19 +1151,14 @@ void HBoundsCheck::PrintDataTo(StringStream* stream) { ...@@ -1151,19 +1151,14 @@ void HBoundsCheck::PrintDataTo(StringStream* stream) {
void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) {
ASSERT(CheckFlag(kFlexibleRepresentation)); ASSERT(CheckFlag(kFlexibleRepresentation));
Representation r;
HValue* actual_index = index()->ActualValue(); HValue* actual_index = index()->ActualValue();
HValue* actual_length = length()->ActualValue(); HValue* actual_length = length()->ActualValue();
Representation index_rep = actual_index->representation(); Representation index_rep = actual_index->representation();
if (!actual_length->representation().IsSmiOrTagged()) { Representation length_rep = actual_length->representation();
r = Representation::Integer32(); if (index_rep.IsTagged()) index_rep = Representation::Smi();
} else if ((index_rep.IsTagged() && actual_index->type().IsSmi()) || if (length_rep.IsTagged()) length_rep = Representation::Smi();
index_rep.IsSmi()) { Representation r = index_rep.generalize(length_rep);
// If the index is smi, allow the length to be smi, since it is usually if (r.is_more_general_than(Representation::Integer32())) {
// already smi from loading it out of the length field of a JSArray. This
// allows for direct comparison without untagging.
r = Representation::Smi();
} else {
r = Representation::Integer32(); r = Representation::Integer32();
} }
UpdateRepresentation(r, h_infer, "boundscheck"); UpdateRepresentation(r, h_infer, "boundscheck");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment