Commit 17967c07 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[turbofan] Use switch in ReduceJSCreateArguments

We can make sure we exhaustively test all CreateArgumentsTypes by using
a switch rather than if-else.

Change-Id: Id00094eeb4cb0af212f5c939314aec72a30a3ee0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2128054Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66919}
parent 093019ee
...@@ -256,10 +256,12 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) { ...@@ -256,10 +256,12 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
} }
} }
UNREACHABLE(); UNREACHABLE();
} else if (outer_state->opcode() == IrOpcode::kFrameState) { }
// Use inline allocation for all mapped arguments objects within inlined // Use inline allocation for all mapped arguments objects within inlined
// (i.e. non-outermost) frames, independent of the object size. // (i.e. non-outermost) frames, independent of the object size.
if (type == CreateArgumentsType::kMappedArguments) { DCHECK_EQ(outer_state->opcode(), IrOpcode::kFrameState);
switch (type) {
case CreateArgumentsType::kMappedArguments: {
Node* const callee = NodeProperties::GetValueInput(node, 0); Node* const callee = NodeProperties::GetValueInput(node, 0);
Node* const context = NodeProperties::GetContextInput(node); Node* const context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
...@@ -300,7 +302,8 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) { ...@@ -300,7 +302,8 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
RelaxControls(node); RelaxControls(node);
a.FinishAndChange(node); a.FinishAndChange(node);
return Changed(node); return Changed(node);
} else if (type == CreateArgumentsType::kUnmappedArguments) { }
case CreateArgumentsType::kUnmappedArguments: {
// Use inline allocation for all unmapped arguments objects within inlined // Use inline allocation for all unmapped arguments objects within inlined
// (i.e. non-outermost) frames, independent of the object size. // (i.e. non-outermost) frames, independent of the object size.
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
...@@ -335,7 +338,8 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) { ...@@ -335,7 +338,8 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
RelaxControls(node); RelaxControls(node);
a.FinishAndChange(node); a.FinishAndChange(node);
return Changed(node); return Changed(node);
} else if (type == CreateArgumentsType::kRestParameter) { }
case CreateArgumentsType::kRestParameter: {
int start_index = shared.internal_formal_parameter_count(); int start_index = shared.internal_formal_parameter_count();
// Use inline allocation for all unmapped arguments objects within inlined // Use inline allocation for all unmapped arguments objects within inlined
// (i.e. non-outermost) frames, independent of the object size. // (i.e. non-outermost) frames, independent of the object size.
...@@ -378,8 +382,7 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) { ...@@ -378,8 +382,7 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
return Changed(node); return Changed(node);
} }
} }
UNREACHABLE();
return NoChange();
} }
Reduction JSCreateLowering::ReduceJSCreateGeneratorObject(Node* node) { Reduction JSCreateLowering::ReduceJSCreateGeneratorObject(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