Commit f8ded112 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Eliminate redundant CheckString based on types.

If the input to a CheckString is already a String, then the check
is redundant.

R=epertoso@chromium.org

Review-Url: https://codereview.chromium.org/2190833002
Cr-Commit-Position: refs/heads/master@{#38118}
parent 37b20704
......@@ -1889,6 +1889,17 @@ Reduction JSTypedLowering::ReduceSelect(Node* node) {
return NoChange();
}
Reduction JSTypedLowering::ReduceCheckString(Node* node) {
// TODO(bmeurer): Find a better home for this thing!
Node* const input = NodeProperties::GetValueInput(node, 0);
Type* const input_type = NodeProperties::GetType(input);
if (input_type->Is(Type::String())) {
ReplaceWithValue(node, input);
return Replace(input);
}
return NoChange();
}
Reduction JSTypedLowering::ReduceNumberRoundop(Node* node) {
// TODO(bmeurer): Find a better home for this thing!
Node* const input = NodeProperties::GetValueInput(node, 0);
......@@ -2019,6 +2030,8 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSGeneratorRestoreRegister(node);
case IrOpcode::kSelect:
return ReduceSelect(node);
case IrOpcode::kCheckString:
return ReduceCheckString(node);
case IrOpcode::kNumberCeil:
case IrOpcode::kNumberFloor:
case IrOpcode::kNumberRound:
......
......@@ -78,6 +78,7 @@ class JSTypedLowering final : public AdvancedReducer {
Reduction ReduceJSGeneratorStore(Node* node);
Reduction ReduceJSGeneratorRestoreContinuation(Node* node);
Reduction ReduceJSGeneratorRestoreRegister(Node* node);
Reduction ReduceCheckString(Node* node);
Reduction ReduceNumberRoundop(Node* node);
Reduction ReduceSelect(Node* node);
Reduction ReduceJSSubtract(Node* node);
......
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