Commit f35048cf authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[compiler] Avoid unnecessarily large graph for deeply nested bound function

Bug: chromium:1226264
Change-Id: I270f09d33cd7a3bb795b79bae6ff1dbf41d11217
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3013357Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Auto-Submit: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75635}
parent 4666e182
...@@ -5039,13 +5039,18 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) { ...@@ -5039,13 +5039,18 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
// Patch {node} to use [[BoundTargetFunction]] // Patch {node} to use [[BoundTargetFunction]]
// as new.target if {new_target} equals {target}. // as new.target if {new_target} equals {target}.
node->ReplaceInput( if (target == new_target) {
n.NewTargetIndex(), node->ReplaceInput(n.NewTargetIndex(),
graph()->NewNode(common()->Select(MachineRepresentation::kTagged), jsgraph()->Constant(*bound_target_function));
graph()->NewNode(simplified()->ReferenceEqual(), } else {
target, new_target), node->ReplaceInput(
jsgraph()->Constant(*bound_target_function), n.NewTargetIndex(),
new_target)); graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
graph()->NewNode(simplified()->ReferenceEqual(),
target, new_target),
jsgraph()->Constant(*bound_target_function),
new_target));
}
// Insert the [[BoundArguments]] for {node}. // Insert the [[BoundArguments]] for {node}.
for (int i = 0; i < bound_arguments_length; ++i) { for (int i = 0; i < bound_arguments_length; ++i) {
...@@ -5078,12 +5083,16 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) { ...@@ -5078,12 +5083,16 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
// Patch {node} to use [[BoundTargetFunction]] // Patch {node} to use [[BoundTargetFunction]]
// as new.target if {new_target} equals {target}. // as new.target if {new_target} equals {target}.
node->ReplaceInput( if (target == new_target) {
n.NewTargetIndex(), node->ReplaceInput(n.NewTargetIndex(), bound_target_function);
graph()->NewNode(common()->Select(MachineRepresentation::kTagged), } else {
graph()->NewNode(simplified()->ReferenceEqual(), node->ReplaceInput(
target, new_target), n.NewTargetIndex(),
bound_target_function, new_target)); graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
graph()->NewNode(simplified()->ReferenceEqual(),
target, new_target),
bound_target_function, new_target));
}
// Insert the [[BoundArguments]] for {node}. // Insert the [[BoundArguments]] for {node}.
for (int i = 0; i < bound_arguments_length; ++i) { for (int i = 0; i < bound_arguments_length; ++i) {
......
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