From a99050d40e8797ef3ca8abcb032b28af5b8d749f Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Tue, 1 Apr 2014 10:32:25 +0000 Subject: [PATCH] Set kTruncatingToSmi for HChange only when To rep is Smi BUG= R=verwaest@chromium.org Review URL: https://codereview.chromium.org/218613002 Patch from Weiliang Lin . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20385 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen-instructions.cc | 1 + src/hydrogen-instructions.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 84dcb18..d12d47e 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -1561,6 +1561,7 @@ void HChange::PrintDataTo(StringStream* stream) { HUnaryOperation::PrintDataTo(stream); stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); + if (CanTruncateToSmi()) stream->Add(" truncating-smi"); if (CanTruncateToInt32()) stream->Add(" truncating-int32"); if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); if (CheckFlag(kAllowUndefinedAsNaN)) stream->Add(" allow-undefined-as-nan"); diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 335b73f..a6a1f86 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -1263,6 +1263,7 @@ class HInstruction : public HValue { position_.set_operand_position(index, pos); } + bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; @@ -1733,7 +1734,7 @@ class HChange V8_FINAL : public HUnaryOperation { set_representation(to); SetFlag(kUseGVN); SetFlag(kCanOverflow); - if (is_truncating_to_smi) { + if (is_truncating_to_smi && to.IsSmi()) { SetFlag(kTruncatingToSmi); SetFlag(kTruncatingToInt32); } -- 2.7.4