[maglev] Drop values flowing into resumable loops
All IFS values of resumable loops are loop phis, so values from before the loop can safely be dropped. In fact, if we don't drop them we might not be able to restore them and crash in a safety check. Eagerly dropping the values allows us to keep the safety check. Bug: v8:7700 Change-Id: I99ef80e35db5aba965dc1c5c9d78f1d085e589fb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4110940 Commit-Queue: Victor Gomes <victorgomes@chromium.org> Auto-Submit: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Victor Gomes <victorgomes@chromium.org> Commit-Queue: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/main@{#84943}
This commit is contained in:
parent
0621c2d553
commit
ea1bac5386
@ -141,6 +141,10 @@ bool IsLiveAtTarget(ValueNode* node, ControlNode* source, BasicBlock* target) {
|
||||
// Gap moves may already be inserted in the target, so skip over those.
|
||||
return node->id() < target->FirstNonGapMoveId();
|
||||
}
|
||||
|
||||
// Drop all values on resumable loop headers.
|
||||
if (target->has_state() && target->state()->is_resumable_loop()) return false;
|
||||
|
||||
// TODO(verwaest): This should be true but isn't because we don't yet
|
||||
// eliminate dead code.
|
||||
// DCHECK_GT(node->next_use, source->id());
|
||||
|
17
test/mjsunit/maglev/resumable.js
Normal file
17
test/mjsunit/maglev/resumable.js
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2022 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// Flags: --allow-natives-syntax --maglev
|
||||
|
||||
(function () {
|
||||
async function foo() {
|
||||
for (let i = 0; i == 1; i++) {
|
||||
780109, { get: function() { } }; await 7;
|
||||
}
|
||||
}
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
foo();
|
||||
%OptimizeMaglevOnNextCall(foo);
|
||||
foo();
|
||||
})();
|
Loading…
Reference in New Issue
Block a user