[snapshot] Deoptimize all in --stress-snapshot mode

We don't yet support serialization of optimized code, so whenever the
serializer encounters an 'unexpected' Code object, it aborts.

Snapshot::ClearReconstructableDataForSerialization does not clear
weak links created through compilation dependencies. These links
make Code objects reachable even though recompilable data has been
cleared from JSFunctions/SFIs/JSRegExps.

Forcing a full deopt of the entire isolate is the simple of way of
solving this until serialization support for optimized code has been
implemented.

Bug: v8:10416,v8:10500,v8:10518
Change-Id: Ie1386cc9fa983b435825afa15441df38409bff98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2196122
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67737}
This commit is contained in:
Jakob Gruber 2020-05-12 10:57:39 +02:00 committed by Commit Bot
parent d0dbee4772
commit 6888d68b5f

View File

@ -3054,6 +3054,9 @@ int Shell::RunMain(Isolate* isolate, bool last_run) {
static constexpr bool kClearRecompilableData = true;
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::Context> i_context = Utils::OpenHandle(*context);
// TODO(jgruber,v8:10500): Don't deoptimize once we support serialization
// of optimized code.
i::Deoptimizer::DeoptimizeAll(i_isolate);
i::Snapshot::ClearReconstructableDataForSerialization(
i_isolate, kClearRecompilableData);
i::Snapshot::SerializeDeserializeAndVerifyForTesting(i_isolate,