Reviewers: Jakob,

Message:
PTAL

Description:
Don't ignore the actual input representation in UnaryMathOperations

Please review this at https://chromiumcodereview.appspot.com/16035014/

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

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


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index d3f1a9e09024c8f1643eb53bddc3b595b3953d3e..e3bee986b5a6edf2a3447862315f51fb795955e2 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -3068,6 +3068,19 @@ HType HUnaryMathOperation::CalculateInferredType() {
 }


+Representation HUnaryMathOperation::RepresentationFromInputs() {
+  // Determine the worst case of observed input representations and
+  // the currently assumed output representation.
+  Representation rep = representation();
+  rep = rep.generalize(observed_input_representation(1));
+  // If any of the actual input representation is more general than what we
+  // have so far but not Tagged, use that representation instead.
+  Representation input_rep = value()->representation();
+  if (!input_rep.IsTagged()) rep = rep.generalize(input_rep);
+  return rep;
+}
+
+
 HType HStringCharFromCode::CalculateInferredType() {
   return HType::String();
 }
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 4a8a406eb3befbc126c4f0f6aa15119892ef316f..01dc8dfaee5e1cb41ca0c66281c0f1f45893080d 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2645,6 +2645,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
   }

   virtual HValue* Canonicalize();
+  virtual Representation RepresentationFromInputs();

   BuiltinFunctionId op() const { return op_; }
   const char* OpName() const;


--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to