[turbofan] The PlainPrimitiveToNumber operator cannot have side effects.

An invocation of the ToNumber builtin resulting from lowering the
PlainPrimitiveToNumber cannot have any observable side effects and
thus the builtin call itself is eliminatable.

R=yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2239923004
Cr-Commit-Position: refs/heads/master@{#38593}
This commit is contained in:
bmeurer 2016-08-11 22:08:19 -07:00 committed by Commit bot
parent 6f435614fe
commit 63dd16849f

View File

@ -2524,7 +2524,7 @@ EffectControlLinearizer::LowerPlainPrimitiveToNumber(Node* node, Node* effect,
Node* value = node->InputAt(0);
Node* result = effect =
graph()->NewNode(ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(),
value, jsgraph()->NoContextConstant(), effect, control);
value, jsgraph()->NoContextConstant(), effect);
return ValueEffectControl(result, effect, control);
}
@ -2547,7 +2547,7 @@ EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node, Node* effect,
{
vfalse0 = efalse0 = graph()->NewNode(
ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value,
jsgraph()->NoContextConstant(), efalse0, if_false0);
jsgraph()->NoContextConstant(), efalse0);
Node* check1 = ObjectIsSmi(vfalse0);
Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
@ -2603,7 +2603,7 @@ EffectControlLinearizer::LowerPlainPrimitiveToFloat64(Node* node, Node* effect,
{
vfalse0 = efalse0 = graph()->NewNode(
ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value,
jsgraph()->NoContextConstant(), efalse0, if_false0);
jsgraph()->NoContextConstant(), efalse0);
Node* check1 = ObjectIsSmi(vfalse0);
Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
@ -3307,7 +3307,7 @@ Operator const* EffectControlLinearizer::ToNumberOperator() {
CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
isolate(), graph()->zone(), callable.descriptor(), 0, flags,
Operator::kNoThrow);
Operator::kEliminatable);
to_number_operator_.set(common()->Call(desc));
}
return to_number_operator_.get();