Revision: 11041
Author:   [email protected]
Date:     Wed Mar 14 05:59:49 2012
Log: Don't take UnkownOSRValues into account when infering Phi's representation.

For DIV with uninitialized result assume double result representation.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Mar 12 05:49:41 2012 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Mar 14 05:59:49 2012
@@ -2255,6 +2255,38 @@
   stream->Add(" ");
   object()->PrintNameTo(stream);
 }
+
+
+Representation HPhi::InferredRepresentation() {
+  bool double_occurred = false;
+  bool int32_occurred = false;
+  for (int i = 0; i < OperandCount(); ++i) {
+    HValue* value = OperandAt(i);
+    if (value->IsUnknownOSRValue()) continue;
+    if (value->representation().IsDouble()) double_occurred = true;
+    if (value->representation().IsInteger32()) int32_occurred = true;
+    if (value->representation().IsTagged()) {
+      if (value->IsConstant()) {
+        HConstant* constant = HConstant::cast(value);
+        if (constant->IsConvertibleToInteger()) {
+          int32_occurred = true;
+        } else if (constant->HasNumberValue()) {
+          double_occurred = true;
+        } else {
+          return Representation::Tagged();
+        }
+      } else {
+        return Representation::Tagged();
+      }
+    }
+  }
+
+  if (double_occurred) return Representation::Double();
+
+  if (int32_occurred) return Representation::Integer32();
+
+  return Representation::None();
+}


 // Node-specific verification code is only included in debug mode.
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Mon Mar 12 05:49:41 2012 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Mar 14 05:59:49 2012
@@ -2261,20 +2261,7 @@
     SetFlag(kFlexibleRepresentation);
   }

-  virtual Representation InferredRepresentation() {
-    bool double_occurred = false;
-    bool int32_occurred = false;
-    for (int i = 0; i < OperandCount(); ++i) {
-      HValue* value = OperandAt(i);
-      if (value->representation().IsDouble()) double_occurred = true;
-      if (value->representation().IsInteger32()) int32_occurred = true;
- if (value->representation().IsTagged()) return Representation::Tagged();
-    }
-
-    if (double_occurred) return Representation::Double();
-    if (int32_occurred) return Representation::Integer32();
-    return Representation::None();
-  }
+  virtual Representation InferredRepresentation();

   virtual Range* InferRange(Zone* zone);
   virtual Representation RequiredInputRepresentation(int index) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Tue Mar 13 07:45:03 2012
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Mar 14 05:59:49 2012
@@ -1766,6 +1766,12 @@
   ASSERT(current->CheckFlag(HValue::kFlexibleRepresentation));
   Representation inferred = current->InferredRepresentation();
   if (inferred.IsSpecialization()) {
+    if (FLAG_trace_representation) {
+      PrintF("Changing #%d representation %s -> %s based on inputs\n",
+             current->id(),
+             r.Mnemonic(),
+             inferred.Mnemonic());
+    }
     current->ChangeRepresentation(inferred);
     AddDependantsToWorklist(current);
   }
@@ -1793,6 +1799,12 @@
   Representation new_rep = TryChange(value);
   if (!new_rep.IsNone()) {
     if (!value->representation().Equals(new_rep)) {
+      if (FLAG_trace_representation) {
+        PrintF("Changing #%d representation %s -> %s based on uses\n",
+               value->id(),
+               r.Mnemonic(),
+               new_rep.Mnemonic());
+      }
       value->ChangeRepresentation(new_rep);
       AddDependantsToWorklist(value);
     }
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Mar 12 07:56:04 2012
+++ /branches/bleeding_edge/src/runtime.cc      Wed Mar 14 05:59:49 2012
@@ -13324,6 +13324,7 @@
     if (isolate->heap()->new_space()->AddFreshPage()) {
       return;
     }
+
     // Try to do a garbage collection; ignore it if it fails. The C
     // entry stub will throw an out-of-memory exception in that case.
     isolate->heap()->CollectGarbage(failure->allocation_space(),
=======================================
--- /branches/bleeding_edge/src/type-info.cc    Tue Mar 13 05:11:46 2012
+++ /branches/bleeding_edge/src/type-info.cc    Wed Mar 14 05:59:49 2012
@@ -382,6 +382,10 @@
       case BinaryOpIC::SMI:
         switch (result_type) {
           case BinaryOpIC::UNINITIALIZED:
+            if (expr->op() == Token::DIV) {
+              return TypeInfo::Double();
+            }
+            return TypeInfo::Smi();
           case BinaryOpIC::SMI:
             return TypeInfo::Smi();
           case BinaryOpIC::INT32:

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

Reply via email to