Commit 026d47e9 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Improve TypedOptimization more

This CL improves typed optimization more:
ChangePlainPrimitiveToNumber is only omitted if it is not required.

Change-Id: I5d81537a046c5a5a0c730fcd1e17bbdfda887687
Bug: v8:910562
Reviewed-on: https://chromium-review.googlesource.com/c/1357058Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58009}
parent a6669bdc
......@@ -722,10 +722,8 @@ Reduction TypedOptimization::ReduceSpeculativeNumberAdd(Node* node) {
NeitherCanBe(lhs_type, rhs_type, Type::StringOrReceiver())) {
// SpeculativeNumberAdd(x:-string, y:-string) =>
// NumberAdd(ToNumber(x), ToNumber(y))
Node* const toNum_lhs =
graph()->NewNode(simplified()->PlainPrimitiveToNumber(), lhs);
Node* const toNum_rhs =
graph()->NewNode(simplified()->PlainPrimitiveToNumber(), rhs);
Node* const toNum_lhs = ConvertPlainPrimitiveToNumber(lhs);
Node* const toNum_rhs = ConvertPlainPrimitiveToNumber(rhs);
Node* const value =
graph()->NewNode(simplified()->NumberAdd(), toNum_lhs, toNum_rhs);
ReplaceWithValue(node, value);
......
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