Revision: 15156
Author:   [email protected]
Date:     Fri Jun 14 07:14:07 2013
Log:      Only infer int32 in HBoundsCheck if input is double or int32.

[email protected], [email protected]

Review URL: https://chromiumcodereview.appspot.com/17057004
http://code.google.com/p/v8/source/detail?r=15156

Modified:
 /branches/bleeding_edge/src/hydrogen-instructions.cc

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Jun 14 07:13:48 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Jun 14 07:14:07 2013
@@ -1151,19 +1151,14 @@

 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) {
   ASSERT(CheckFlag(kFlexibleRepresentation));
-  Representation r;
   HValue* actual_index = index()->ActualValue();
   HValue* actual_length = length()->ActualValue();
   Representation index_rep = actual_index->representation();
-  if (!actual_length->representation().IsSmiOrTagged()) {
-    r = Representation::Integer32();
-  } else if ((index_rep.IsTagged() && actual_index->type().IsSmi()) ||
-      index_rep.IsSmi()) {
-    // If the index is smi, allow the length to be smi, since it is usually
- // already smi from loading it out of the length field of a JSArray. This
-    // allows for direct comparison without untagging.
-    r = Representation::Smi();
-  } else {
+  Representation length_rep = actual_length->representation();
+  if (index_rep.IsTagged()) index_rep = Representation::Smi();
+  if (length_rep.IsTagged()) length_rep = Representation::Smi();
+  Representation r = index_rep.generalize(length_rep);
+  if (r.is_more_general_than(Representation::Integer32())) {
     r = Representation::Integer32();
   }
   UpdateRepresentation(r, h_infer, "boundscheck");

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to