Revision: 13820
Author:   [email protected]
Date:     Tue Mar  5 01:14:28 2013
Log: Fixed HCheckSmiOrInt <-> HBoundsCheck interaction wrt. representations

BUG=v8:2556

Review URL: https://codereview.chromium.org/12321165
http://code.google.com/p/v8/source/detail?r=13820

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Thu Feb 28 09:03:34 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Mar 5 01:14:28 2013
@@ -930,12 +930,14 @@
 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
@@ -2566,8 +2568,9 @@

 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");
 }

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Mar 1 08:06:34 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Tue Mar 5 01:14:28 2013
@@ -2868,7 +2868,7 @@
   }

   virtual HValue* Canonicalize() {
-    if (representation().IsTagged() && !type().IsSmi()) {
+    if (representation().IsTagged() && !value()->type().IsSmi()) {
       return this;
     } else {
       return value();

--
--
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