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
This commit is contained in:
verwaest@chromium.org 2013-06-07 09:11:33 +00:00
parent cb3645fee9
commit a3dccd15b0
2 changed files with 11 additions and 0 deletions

View File

@ -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() { HType HStringCharFromCode::CalculateInferredType() {
return HType::String(); return HType::String();
} }

View File

@ -2651,6 +2651,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
virtual Range* InferRange(Zone* zone); virtual Range* InferRange(Zone* zone);
virtual HValue* Canonicalize(); virtual HValue* Canonicalize();
virtual Representation RepresentationFromInputs();
BuiltinFunctionId op() const { return op_; } BuiltinFunctionId op() const { return op_; }
const char* OpName() const; const char* OpName() const;