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 <weiliang.lin@intel.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20385 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2014-04-01 10:32:25 +00:00
parent 4da732e321
commit a99050d40e
2 changed files with 3 additions and 1 deletions

View File

@ -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");

View File

@ -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);
}