From a3dccd15b0dbb2479f11cd5f6a50cd962b375910 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Fri, 7 Jun 2013 09:11:33 +0000 Subject: [PATCH] Don't ignore the actual input representation in UnaryMathOperations R=jkummerow@chromium.org Review URL: https://chromiumcodereview.appspot.com/16035014 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14997 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen-instructions.cc | 10 ++++++++++ src/hydrogen-instructions.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index d6a3f99..ff0791b 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -3092,6 +3092,16 @@ HType HUnaryMathOperation::CalculateInferredType() { } +Representation HUnaryMathOperation::RepresentationFromInputs() { + Representation rep = representation(); + // 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(); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 73c075e..ee87024 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -2651,6 +2651,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> { virtual Range* InferRange(Zone* zone); virtual HValue* Canonicalize(); + virtual Representation RepresentationFromInputs(); BuiltinFunctionId op() const { return op_; } const char* OpName() const; -- 2.7.4