[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/+/2128054
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66919}
This commit is contained in:
Leszek Swirski 2020-03-31 11:11:26 +02:00 committed by Commit Bot
parent 093019ee1a
commit 17967c0773

View File

@ -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) {
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) {
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) {
return Changed(node); return Changed(node);
} }
} }
UNREACHABLE();
return NoChange();
} }
Reduction JSCreateLowering::ReduceJSCreateGeneratorObject(Node* node) { Reduction JSCreateLowering::ReduceJSCreateGeneratorObject(Node* node) {