[cleanup] Avoid redundant TaggedIsSmi checks in CSA

`CodeStubAssembler::ToInteger_Inline` performs a `TaggedIsSmi` check,
and calls `ToInteger` with the appropriate truncation mode if the
input is not a Smi.

When we already know we’re dealing with something that’s not a Smi,
this check is redundant, and we can use
`CallBuiltin(Builtins::kToInteger*)` directly.

Bug: v8:7310
Change-Id: If538e39bcb738014bd03f10edd0051dac72b7ea3
Reviewed-on: https://chromium-review.googlesource.com/934901
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51535}
This commit is contained in:
Mathias Bynens 2018-02-23 12:34:33 -08:00 committed by Commit Bot
parent 9f9550ef79
commit 263aa3edd0

View File

@ -6119,8 +6119,8 @@ TNode<Smi> CodeStubAssembler::ToSmiIndex(TNode<Object> input,
Branch(IsUndefined(input), &return_zero, &defined);
BIND(&defined);
TNode<Object> integer_input =
ToInteger_Inline(context, input, CodeStubAssembler::kTruncateMinusZero);
TNode<Number> integer_input =
CAST(CallBuiltin(Builtins::kToInteger_TruncateMinusZero, context, input));
GotoIfNot(TaggedIsSmi(integer_input), range_error);
result = CAST(integer_input);
Goto(&negative_check);
@ -6149,8 +6149,8 @@ TNode<Smi> CodeStubAssembler::ToSmiLength(TNode<Object> input,
BIND(&to_integer);
{
TNode<Number> integer_input =
ToInteger_Inline(context, input, CodeStubAssembler::kTruncateMinusZero);
TNode<Number> integer_input = CAST(
CallBuiltin(Builtins::kToInteger_TruncateMinusZero, context, input));
GotoIfNot(TaggedIsSmi(integer_input), &heap_number_negative_check);
result = CAST(integer_input);
Goto(&negative_check);