Commit 263aa3ed authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[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: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51535}
parent 9f9550ef
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment