Skip to content

Commit 6516b1c

Browse files
GeorgNeisCommit Bot
authored andcommitted
[turbofan] Harden ReduceJSCreateArray against typing bugs
Bug: chromium:1051017 Change-Id: I597363417d905bc65522d64ebfa2cbf9dde4b98f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2054086 Reviewed-by: Tobias Tebbi <[email protected]> Reviewed-by: Michael Stanton <[email protected]> Commit-Queue: Georg Neis <[email protected]> Cr-Commit-Position: refs/heads/master@{#66255}
1 parent 73f88b5 commit 6516b1c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/compiler/js-create-lowering.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ Reduction JSCreateLowering::ReduceJSCreateArray(Node* node) {
672672
length_type.Max() <= kElementLoopUnrollLimit &&
673673
length_type.Min() == length_type.Max()) {
674674
int capacity = static_cast<int>(length_type.Max());
675+
// Replace length with a constant in order to protect against a potential
676+
// typer bug leading to length > capacity.
677+
length = jsgraph()->Constant(capacity);
675678
return ReduceNewArray(node, length, capacity, *initial_map, elements_kind,
676679
allocation, slack_tracking_prediction);
677680
}

0 commit comments

Comments
 (0)