Commit a4001d93 authored by jgruber's avatar jgruber Committed by Commit Bot

[snapshot] Remove builtins area from startup snapshot

This removes the builtins area from the startup snapshot. It's now
completely contained in the separate builtins blob area.

Bug: v8:6624
Change-Id: Id3c43a177c7e1ed418eec59cf620fa461eb6df81
Reviewed-on: https://chromium-review.googlesource.com/715759
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48636}
parent bff42d35
...@@ -54,6 +54,9 @@ Deserializer<AllocatorT>::~Deserializer() { ...@@ -54,6 +54,9 @@ Deserializer<AllocatorT>::~Deserializer() {
template <class AllocatorT> template <class AllocatorT>
void Deserializer<AllocatorT>::VisitRootPointers(Root root, Object** start, void Deserializer<AllocatorT>::VisitRootPointers(Root root, Object** start,
Object** end) { Object** end) {
// Builtins are deserialized in a separate pass by the BuiltinDeserializer.
if (root == Root::kBuiltins) return;
// The space must be new space. Any other space would cause ReadChunk to try // The space must be new space. Any other space would cause ReadChunk to try
// to update the remembered using nullptr as the address. // to update the remembered using nullptr as the address.
ReadData(start, end, NEW_SPACE, nullptr); ReadData(start, end, NEW_SPACE, nullptr);
...@@ -64,7 +67,6 @@ void Deserializer<AllocatorT>::Synchronize( ...@@ -64,7 +67,6 @@ void Deserializer<AllocatorT>::Synchronize(
VisitorSynchronization::SyncTag tag) { VisitorSynchronization::SyncTag tag) {
static const byte expected = kSynchronize; static const byte expected = kSynchronize;
CHECK_EQ(expected, source_.Get()); CHECK_EQ(expected, source_.Get());
deserializing_builtins_ = (tag == VisitorSynchronization::kHandleScope);
} }
template <class AllocatorT> template <class AllocatorT>
...@@ -217,8 +219,7 @@ HeapObject* Deserializer<AllocatorT>::PostProcessNewObject(HeapObject* obj, ...@@ -217,8 +219,7 @@ HeapObject* Deserializer<AllocatorT>::PostProcessNewObject(HeapObject* obj,
template <class AllocatorT> template <class AllocatorT>
int Deserializer<AllocatorT>::MaybeReplaceWithDeserializeLazy(int builtin_id) { int Deserializer<AllocatorT>::MaybeReplaceWithDeserializeLazy(int builtin_id) {
DCHECK(Builtins::IsBuiltinId(builtin_id)); DCHECK(Builtins::IsBuiltinId(builtin_id));
return (IsLazyDeserializationEnabled() && Builtins::IsLazy(builtin_id) && return IsLazyDeserializationEnabled() && Builtins::IsLazy(builtin_id)
!deserializing_builtins_)
? Builtins::kDeserializeLazy ? Builtins::kDeserializeLazy
: builtin_id; : builtin_id;
} }
......
...@@ -151,10 +151,6 @@ class Deserializer : public SerializerDeserializer { ...@@ -151,10 +151,6 @@ class Deserializer : public SerializerDeserializer {
AllocatorT allocator_; AllocatorT allocator_;
const bool deserializing_user_code_; const bool deserializing_user_code_;
// TODO(jgruber): This workaround will no longer be necessary once builtin
// reference patching has been removed (through advance allocation).
bool deserializing_builtins_ = false;
// TODO(6593): generalize rehashing, and remove this flag. // TODO(6593): generalize rehashing, and remove this flag.
bool can_rehash_; bool can_rehash_;
......
...@@ -91,6 +91,9 @@ bool Serializer<AllocatorT>::MustBeDeferred(HeapObject* object) { ...@@ -91,6 +91,9 @@ bool Serializer<AllocatorT>::MustBeDeferred(HeapObject* object) {
template <class AllocatorT> template <class AllocatorT>
void Serializer<AllocatorT>::VisitRootPointers(Root root, Object** start, void Serializer<AllocatorT>::VisitRootPointers(Root root, Object** start,
Object** end) { Object** end) {
// Builtins are serialized in a separate pass by the BuiltinSerializer.
if (root == Root::kBuiltins) return;
for (Object** current = start; current < end; current++) { for (Object** current = start; current < end; current++) {
if ((*current)->IsSmi()) { if ((*current)->IsSmi()) {
PutSmi(Smi::cast(*current)); PutSmi(Smi::cast(*current));
......
...@@ -17,7 +17,6 @@ StartupSerializer::StartupSerializer( ...@@ -17,7 +17,6 @@ StartupSerializer::StartupSerializer(
: Serializer(isolate), : Serializer(isolate),
clear_function_code_(function_code_handling == clear_function_code_(function_code_handling ==
v8::SnapshotCreator::FunctionCodeHandling::kClear), v8::SnapshotCreator::FunctionCodeHandling::kClear),
serializing_builtins_(false),
can_be_rehashed_(true) { can_be_rehashed_(true) {
InitializeCodeAddressMap(); InitializeCodeAddressMap();
} }
...@@ -36,9 +35,7 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, ...@@ -36,9 +35,7 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
} }
BuiltinReferenceSerializationMode mode = BuiltinReferenceSerializationMode mode =
(clear_function_code() && !serializing_builtins_) clear_function_code() ? kCanonicalizeCompileLazy : kDefault;
? kCanonicalizeCompileLazy
: kDefault;
if (SerializeBuiltinReference(obj, how_to_code, where_to_point, skip, mode)) { if (SerializeBuiltinReference(obj, how_to_code, where_to_point, skip, mode)) {
return; return;
} }
...@@ -107,9 +104,6 @@ int StartupSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) { ...@@ -107,9 +104,6 @@ int StartupSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) {
} }
void StartupSerializer::Synchronize(VisitorSynchronization::SyncTag tag) { void StartupSerializer::Synchronize(VisitorSynchronization::SyncTag tag) {
// We expect the builtins tag after builtins have been serialized.
DCHECK(!serializing_builtins_ || tag == VisitorSynchronization::kBuiltins);
serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope);
sink_.Put(kSynchronize, "Synchronize"); sink_.Put(kSynchronize, "Synchronize");
} }
......
...@@ -78,7 +78,6 @@ class StartupSerializer : public Serializer<> { ...@@ -78,7 +78,6 @@ class StartupSerializer : public Serializer<> {
void CheckRehashability(HeapObject* hashtable); void CheckRehashability(HeapObject* hashtable);
const bool clear_function_code_; const bool clear_function_code_;
bool serializing_builtins_;
bool serializing_immortal_immovables_roots_; bool serializing_immortal_immovables_roots_;
std::bitset<Heap::kStrongRootListLength> root_has_been_serialized_; std::bitset<Heap::kStrongRootListLength> root_has_been_serialized_;
PartialCacheIndexMap partial_cache_index_map_; PartialCacheIndexMap partial_cache_index_map_;
......
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