Commit 843a3ce3 authored by Darius M's avatar Darius M Committed by V8 LUCI CQ

[compiler] Replace String.fromCharCode().length by 1

Change-Id: I35d52bb53379023123a1c5cd25f8e7f6fe21a3f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3906215Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83358}
parent 1861ab7e
......@@ -580,6 +580,11 @@ Reduction TypedOptimization::ReduceStringLength(Node* node) {
// The first value input to the {input} is the resulting length.
return Replace(input->InputAt(0));
}
case IrOpcode::kStringFromSingleCharCode: {
// Note that this isn't valid for StringFromCodePointAt, since it the
// string it returns can be 1 or 2 characters long.
return Replace(jsgraph()->Constant(1));
}
default:
break;
}
......
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