[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/+/3013357 Reviewed-by: Maya 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}
This commit is contained in:
parent
4666e18206
commit
f35048cf99
@ -5039,6 +5039,10 @@ 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}.
|
||||||
|
if (target == new_target) {
|
||||||
|
node->ReplaceInput(n.NewTargetIndex(),
|
||||||
|
jsgraph()->Constant(*bound_target_function));
|
||||||
|
} else {
|
||||||
node->ReplaceInput(
|
node->ReplaceInput(
|
||||||
n.NewTargetIndex(),
|
n.NewTargetIndex(),
|
||||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||||
@ -5046,6 +5050,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
|
|||||||
target, new_target),
|
target, new_target),
|
||||||
jsgraph()->Constant(*bound_target_function),
|
jsgraph()->Constant(*bound_target_function),
|
||||||
new_target));
|
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) {
|
|||||||
|
|
||||||
// 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}.
|
||||||
|
if (target == new_target) {
|
||||||
|
node->ReplaceInput(n.NewTargetIndex(), bound_target_function);
|
||||||
|
} else {
|
||||||
node->ReplaceInput(
|
node->ReplaceInput(
|
||||||
n.NewTargetIndex(),
|
n.NewTargetIndex(),
|
||||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||||
graph()->NewNode(simplified()->ReferenceEqual(),
|
graph()->NewNode(simplified()->ReferenceEqual(),
|
||||||
target, new_target),
|
target, new_target),
|
||||||
bound_target_function, 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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user