Revision: 18078
Author:   [email protected]
Date:     Tue Nov 26 13:52:44 2013 UTC
Log:      Range info propagation through HBoundsCheck.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Nov 25 14:41:46 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Nov 26 13:52:44 2013 UTC
@@ -945,6 +945,25 @@
   }
   UpdateRepresentation(r, h_infer, "boundscheck");
 }
+
+
+Range* HBoundsCheck::InferRange(Zone* zone) {
+  Representation r = representation();
+  if (r.IsSmiOrInteger32() && length()->HasRange()) {
+    int upper = length()->range()->upper() - (allow_equality() ? 0 : 1);
+    int lower = 0;
+
+    Range* result = new(zone) Range(lower, upper);
+    if (index()->HasRange()) {
+      result->Intersect(index()->range());
+    }
+
+    // In case of Smi representation, clamp result to Smi::kMaxValue.
+    if (r.IsSmi()) result->ClampToSmi();
+    return result;
+  }
+  return HValue::InferRange(zone);
+}


 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Mon Nov 25 14:41:46 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Tue Nov 26 13:52:44 2013 UTC
@@ -4029,6 +4029,8 @@
  protected:
   friend class HBoundsCheckBaseIndexInformation;

+  virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
+
   virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
   bool skip_check_;
   HValue* base_;

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