Commit 2797a14c authored by jgruber's avatar jgruber Committed by Commit Bot

[snapshot] Deserialize eagerly if serializer is active

When setting up an isolate for serialization, we need to disable lazy
deserialization to avoid replacing lazy builtins with DeserializeLazy.

Bug: v8:6624
Change-Id: I3e10e262f6dd856f92fd83e5e475127e8ca3f3bf
Reviewed-on: https://chromium-review.googlesource.com/655161Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47885}
parent d450441d
......@@ -52,7 +52,7 @@ void BuiltinDeserializer::DeserializeEagerBuiltins() {
Builtins* builtins = isolate()->builtins();
for (int i = 0; i < Builtins::builtin_count; i++) {
if (FLAG_lazy_deserialization && Builtins::IsLazy(i)) {
if (IsLazyDeserializationEnabled() && Builtins::IsLazy(i)) {
// Do nothing. These builtins have been replaced by DeserializeLazy in
// InitializeBuiltinsTable.
DCHECK_EQ(builtins->builtin(Builtins::kDeserializeLazy),
......@@ -148,7 +148,7 @@ Heap::Reservation BuiltinDeserializer::CreateReservationsForEagerBuiltins() {
// Skip lazy builtins. These will be replaced by the DeserializeLazy code
// object in InitializeBuiltinsTable and thus require no reserved space.
if (FLAG_lazy_deserialization && Builtins::IsLazy(i)) continue;
if (IsLazyDeserializationEnabled() && Builtins::IsLazy(i)) continue;
uint32_t builtin_size = ExtractBuiltinSize(i);
DCHECK_LE(builtin_size, MemoryAllocator::PageAreaSize(CODE_SPACE));
......@@ -189,7 +189,7 @@ void BuiltinDeserializer::InitializeBuiltinsTable(
for (int i = 0; i < Builtins::builtin_count; i++) {
if (i == Builtins::kDeserializeLazy) continue;
if (FLAG_lazy_deserialization && Builtins::IsLazy(i)) {
if (IsLazyDeserializationEnabled() && Builtins::IsLazy(i)) {
builtins->set_builtin(i, deserialize_lazy);
} else {
InitializeBuiltinFromReservation(reservation[reservation_index], i);
......
......@@ -159,6 +159,10 @@ void Deserializer::SortMapDescriptors() {
}
}
bool Deserializer::IsLazyDeserializationEnabled() const {
return FLAG_lazy_deserialization && !isolate()->serializer_enabled();
}
Deserializer::~Deserializer() {
#ifdef DEBUG
// Do not perform checks if we aborted deserialization.
......@@ -332,7 +336,7 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
int Deserializer::MaybeReplaceWithDeserializeLazy(int builtin_id) {
DCHECK(Builtins::IsBuiltinId(builtin_id));
return (FLAG_lazy_deserialization && Builtins::IsLazy(builtin_id) &&
return (IsLazyDeserializationEnabled() && Builtins::IsLazy(builtin_id) &&
!deserializing_builtins_)
? Builtins::kDeserializeLazy
: builtin_id;
......
......@@ -105,6 +105,8 @@ class Deserializer : public SerializerDeserializer {
bool deserializing_user_code() const { return deserializing_user_code_; }
bool can_rehash() const { return can_rehash_; }
bool IsLazyDeserializationEnabled() const;
private:
void VisitRootPointers(Root root, Object** start, Object** end) override;
......
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