Reviewers: Vyacheslav Egorov,

Description:
Add range information to external array loads.

Please review this at http://codereview.chromium.org/9226014/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/hydrogen-instructions.h
  M     src/hydrogen-instructions.cc


Index: src/hydrogen-instructions.cc
===================================================================
--- src/hydrogen-instructions.cc        (revision 10454)
+++ src/hydrogen-instructions.cc        (working copy)
@@ -1339,7 +1339,24 @@
 }


+Range* HLoadKeyedSpecializedArrayElement::InferRange() {
+  switch (elements_kind()) {
+    case EXTERNAL_PIXEL_ELEMENTS:
+      return new Range(0, 255);
+    case EXTERNAL_BYTE_ELEMENTS:
+      return new Range(-128, 127);
+    case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+      return new Range(0, 255);
+    case EXTERNAL_SHORT_ELEMENTS:
+      return new Range(-32768, 32767);
+    case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+      return new Range(0, 65535);
+    default:
+      return HValue::InferRange();
+  }
+}

+
 void HCompareGeneric::PrintDataTo(StringStream* stream) {
   stream->Add(Token::Name(token()));
   stream->Add(" ");
Index: src/hydrogen-instructions.h
===================================================================
--- src/hydrogen-instructions.h (revision 10454)
+++ src/hydrogen-instructions.h (working copy)
@@ -3816,6 +3816,8 @@
   HValue* key() { return OperandAt(1); }
   ElementsKind elements_kind() const { return elements_kind_; }

+  virtual Range* InferRange();
+
   DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement)

  protected:


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to