Commit 7a8d20a7 authored by yangguo's avatar yangguo Committed by Commit bot

[snapshot] encode resource before serializing.

Before serializing an external string for a native source, we replace
its resource field with the type and index of the native source. Upon
deserialization, we restore the resource.

This change also removes the native source caches with a more straight-
forward mechanism to find the resource type and index.

R=ulan@chromium.org

Review-Url: https://codereview.chromium.org/2807023003
Cr-Commit-Position: refs/heads/master@{#44545}
parent 7aa84189
...@@ -35,33 +35,16 @@ Bootstrapper::Bootstrapper(Isolate* isolate) ...@@ -35,33 +35,16 @@ Bootstrapper::Bootstrapper(Isolate* isolate)
nesting_(0), nesting_(0),
extensions_cache_(Script::TYPE_EXTENSION) {} extensions_cache_(Script::TYPE_EXTENSION) {}
template <class Source> Handle<String> Bootstrapper::GetNativeSource(NativeType type, int index) {
Handle<String> Bootstrapper::SourceLookup(int index) {
DCHECK(0 <= index && index < Source::GetBuiltinsCount());
Heap* heap = isolate_->heap();
if (Source::GetSourceCache(heap)->get(index)->IsUndefined(isolate_)) {
// We can use external strings for the natives.
Vector<const char> source = Source::GetScriptSource(index);
NativesExternalStringResource* resource = NativesExternalStringResource* resource =
new NativesExternalStringResource(source.start(), source.length()); new NativesExternalStringResource(type, index);
Handle<ExternalOneByteString> source_code = Handle<ExternalOneByteString> source_code =
isolate_->factory()->NewNativeSourceString(resource); isolate_->factory()->NewNativeSourceString(resource);
// Mark this external string with a special map. isolate_->heap()->RegisterExternalString(*source_code);
DCHECK(source_code->is_short()); DCHECK(source_code->is_short());
Source::GetSourceCache(heap)->set(index, *source_code); return source_code;
}
Handle<Object> cached_source(Source::GetSourceCache(heap)->get(index),
isolate_);
return Handle<String>::cast(cached_source);
} }
template Handle<String> Bootstrapper::SourceLookup<Natives>(int index);
template Handle<String> Bootstrapper::SourceLookup<ExperimentalExtraNatives>(
int index);
template Handle<String> Bootstrapper::SourceLookup<ExtraNatives>(int index);
void Bootstrapper::Initialize(bool create_heap_objects) { void Bootstrapper::Initialize(bool create_heap_objects) {
extensions_cache_.Initialize(isolate_, create_heap_objects); extensions_cache_.Initialize(isolate_, create_heap_objects);
} }
...@@ -111,30 +94,7 @@ void Bootstrapper::TearDownExtensions() { ...@@ -111,30 +94,7 @@ void Bootstrapper::TearDownExtensions() {
ignition_statistics_extension_ = NULL; ignition_statistics_extension_ = NULL;
} }
void DeleteNativeSources(Object* maybe_array) {
if (maybe_array->IsFixedArray()) {
FixedArray* array = FixedArray::cast(maybe_array);
Isolate* isolate = array->GetIsolate();
for (int i = 0; i < array->length(); i++) {
Object* natives_source = array->get(i);
if (!natives_source->IsUndefined(isolate)) {
const NativesExternalStringResource* resource =
reinterpret_cast<const NativesExternalStringResource*>(
ExternalOneByteString::cast(natives_source)->resource());
delete resource;
}
}
}
}
void Bootstrapper::TearDown() { void Bootstrapper::TearDown() {
DeleteNativeSources(Natives::GetSourceCache(isolate_->heap()));
DeleteNativeSources(ExtraNatives::GetSourceCache(isolate_->heap()));
DeleteNativeSources(
ExperimentalExtraNatives::GetSourceCache(isolate_->heap()));
extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical
} }
...@@ -3225,7 +3185,7 @@ void Genesis::InitializeExperimentalGlobal() { ...@@ -3225,7 +3185,7 @@ void Genesis::InitializeExperimentalGlobal() {
bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) {
Vector<const char> name = Natives::GetScriptName(index); Vector<const char> name = Natives::GetScriptName(index);
Handle<String> source_code = Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<Natives>(index); isolate->bootstrapper()->GetNativeSource(CORE, index);
// We pass in extras_utils so that builtin code can set it up for later use // We pass in extras_utils so that builtin code can set it up for later use
// by actual extras code, compiled with CompileExtraBuiltin. // by actual extras code, compiled with CompileExtraBuiltin.
...@@ -3243,7 +3203,7 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { ...@@ -3243,7 +3203,7 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
HandleScope scope(isolate); HandleScope scope(isolate);
Vector<const char> name = ExtraNatives::GetScriptName(index); Vector<const char> name = ExtraNatives::GetScriptName(index);
Handle<String> source_code = Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); isolate->bootstrapper()->GetNativeSource(EXTRAS, index);
Handle<Object> global = isolate->global_object(); Handle<Object> global = isolate->global_object();
Handle<Object> binding = isolate->extras_binding_object(); Handle<Object> binding = isolate->extras_binding_object();
Handle<Object> extras_utils = isolate->extras_utils_object(); Handle<Object> extras_utils = isolate->extras_utils_object();
...@@ -3258,7 +3218,7 @@ bool Bootstrapper::CompileExperimentalExtraBuiltin(Isolate* isolate, ...@@ -3258,7 +3218,7 @@ bool Bootstrapper::CompileExperimentalExtraBuiltin(Isolate* isolate,
HandleScope scope(isolate); HandleScope scope(isolate);
Vector<const char> name = ExperimentalExtraNatives::GetScriptName(index); Vector<const char> name = ExperimentalExtraNatives::GetScriptName(index);
Handle<String> source_code = Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<ExperimentalExtraNatives>(index); isolate->bootstrapper()->GetNativeSource(EXPERIMENTAL_EXTRAS, index);
Handle<Object> global = isolate->global_object(); Handle<Object> global = isolate->global_object();
Handle<Object> binding = isolate->extras_binding_object(); Handle<Object> binding = isolate->extras_binding_object();
Handle<Object> extras_utils = isolate->extras_utils_object(); Handle<Object> extras_utils = isolate->extras_utils_object();
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define V8_BOOTSTRAPPER_H_ #define V8_BOOTSTRAPPER_H_
#include "src/factory.h" #include "src/factory.h"
#include "src/snapshot/natives.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -96,8 +97,7 @@ class Bootstrapper final { ...@@ -96,8 +97,7 @@ class Bootstrapper final {
void Iterate(ObjectVisitor* v); void Iterate(ObjectVisitor* v);
// Accessor for the native scripts source code. // Accessor for the native scripts source code.
template <class Source> Handle<String> GetNativeSource(NativeType type, int index);
Handle<String> SourceLookup(int index);
// Tells whether bootstrapping is active. // Tells whether bootstrapping is active.
bool IsActive() const { return nesting_ != 0; } bool IsActive() const { return nesting_ != 0; }
...@@ -163,20 +163,6 @@ class BootstrapperActive final BASE_EMBEDDED { ...@@ -163,20 +163,6 @@ class BootstrapperActive final BASE_EMBEDDED {
DISALLOW_COPY_AND_ASSIGN(BootstrapperActive); DISALLOW_COPY_AND_ASSIGN(BootstrapperActive);
}; };
class NativesExternalStringResource final
: public v8::String::ExternalOneByteStringResource {
public:
NativesExternalStringResource(const char* source, size_t length)
: data_(source), length_(length) {}
const char* data() const override { return data_; }
size_t length() const override { return length_; }
private:
const char* data_;
size_t length_;
};
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -2782,16 +2782,6 @@ void Heap::CreateInitialObjects() { ...@@ -2782,16 +2782,6 @@ void Heap::CreateInitialObjects() {
set_regexp_multiple_cache(*factory->NewFixedArray( set_regexp_multiple_cache(*factory->NewFixedArray(
RegExpResultsCache::kRegExpResultsCacheSize, TENURED)); RegExpResultsCache::kRegExpResultsCacheSize, TENURED));
// Allocate cache for external strings pointing to native source code.
set_natives_source_cache(
*factory->NewFixedArray(Natives::GetBuiltinsCount()));
set_extra_natives_source_cache(
*factory->NewFixedArray(ExtraNatives::GetBuiltinsCount()));
set_experimental_extra_natives_source_cache(
*factory->NewFixedArray(ExperimentalExtraNatives::GetBuiltinsCount()));
set_undefined_cell(*factory->NewCell(factory->undefined_value())); set_undefined_cell(*factory->NewCell(factory->undefined_value()));
// Microtask queue uses the empty fixed array as a sentinel for "empty". // Microtask queue uses the empty fixed array as a sentinel for "empty".
......
...@@ -178,10 +178,6 @@ using v8::MemoryPressureLevel; ...@@ -178,10 +178,6 @@ using v8::MemoryPressureLevel;
V(Object, instanceof_cache_function, InstanceofCacheFunction) \ V(Object, instanceof_cache_function, InstanceofCacheFunction) \
V(Object, instanceof_cache_map, InstanceofCacheMap) \ V(Object, instanceof_cache_map, InstanceofCacheMap) \
V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \
V(FixedArray, natives_source_cache, NativesSourceCache) \
V(FixedArray, extra_natives_source_cache, ExtraNativesSourceCache) \
V(FixedArray, experimental_extra_natives_source_cache, \
ExperimentalExtraNativesSourceCache) \
/* Lists and dictionaries */ \ /* Lists and dictionaries */ \
V(NameDictionary, empty_properties_dictionary, EmptyPropertiesDictionary) \ V(NameDictionary, empty_properties_dictionary, EmptyPropertiesDictionary) \
V(NameDictionary, public_symbol_table, PublicSymbolTable) \ V(NameDictionary, public_symbol_table, PublicSymbolTable) \
......
...@@ -356,6 +356,14 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) { ...@@ -356,6 +356,14 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
if (isolate_->external_reference_redirector()) { if (isolate_->external_reference_redirector()) {
accessor_infos_.Add(AccessorInfo::cast(obj)); accessor_infos_.Add(AccessorInfo::cast(obj));
} }
} else if (obj->IsExternalOneByteString()) {
DCHECK(obj->map() == isolate_->heap()->native_source_string_map());
ExternalOneByteString* string = ExternalOneByteString::cast(obj);
DCHECK(string->is_short());
string->set_resource(
NativesExternalStringResource::DecodeForDeserialization(
string->resource()));
isolate_->heap()->RegisterExternalString(string);
} }
// Check alignment. // Check alignment.
DCHECK_EQ(0, Heap::GetFillToAlign(obj->address(), obj->RequiredAlignment())); DCHECK_EQ(0, Heap::GetFillToAlign(obj->address(), obj->RequiredAlignment()));
...@@ -502,16 +510,6 @@ Address Deserializer::Allocate(int space_index, int size) { ...@@ -502,16 +510,6 @@ Address Deserializer::Allocate(int space_index, int size) {
} }
} }
Object** Deserializer::CopyInNativesSource(Vector<const char> source_vector,
Object** current) {
DCHECK(!isolate_->heap()->deserialization_complete());
NativesExternalStringResource* resource = new NativesExternalStringResource(
source_vector.start(), source_vector.length());
Object* resource_obj = reinterpret_cast<Object*>(resource);
UnalignedCopy(current++, &resource_obj);
return current;
}
bool Deserializer::ReadData(Object** current, Object** limit, int source_space, bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
Address current_object_address) { Address current_object_address) {
Isolate* const isolate = isolate_; Isolate* const isolate = isolate_;
...@@ -814,16 +812,6 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space, ...@@ -814,16 +812,6 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
CHECK(false); CHECK(false);
break; break;
case kNativesStringResource:
current = CopyInNativesSource(Natives::GetScriptSource(source_.Get()),
current);
break;
case kExtraNativesStringResource:
current = CopyInNativesSource(
ExtraNatives::GetScriptSource(source_.Get()), current);
break;
// Deserialize raw data of variable length. // Deserialize raw data of variable length.
case kVariableRawData: { case kVariableRawData: {
int size_in_bytes = source_.GetInt(); int size_in_bytes = source_.GetInt();
......
...@@ -117,9 +117,6 @@ class Deserializer : public SerializerDeserializer { ...@@ -117,9 +117,6 @@ class Deserializer : public SerializerDeserializer {
// snapshot by chunk index and offset. // snapshot by chunk index and offset.
HeapObject* GetBackReferencedObject(int space); HeapObject* GetBackReferencedObject(int space);
Object** CopyInNativesSource(Vector<const char> source_vector,
Object** current);
// Cached current isolate. // Cached current isolate.
Isolate* isolate_; Isolate* isolate_;
......
...@@ -11,21 +11,29 @@ ...@@ -11,21 +11,29 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
template <> NativesExternalStringResource::NativesExternalStringResource(NativeType type,
FixedArray* NativesCollection<CORE>::GetSourceCache(Heap* heap) { int index)
return heap->natives_source_cache(); : type_(type), index_(index) {
} Vector<const char> source;
DCHECK(0 <= index);
switch (type_) {
template <> case CORE:
FixedArray* NativesCollection<EXTRAS>::GetSourceCache(Heap* heap) { DCHECK(index < Natives::GetBuiltinsCount());
return heap->extra_natives_source_cache(); source = Natives::GetScriptSource(index);
} break;
case EXTRAS:
DCHECK(index < ExtraNatives::GetBuiltinsCount());
template <> source = ExtraNatives::GetScriptSource(index);
FixedArray* NativesCollection<EXPERIMENTAL_EXTRAS>::GetSourceCache(Heap* heap) { break;
return heap->experimental_extra_natives_source_cache(); case EXPERIMENTAL_EXTRAS:
DCHECK(index < ExperimentalExtraNatives::GetBuiltinsCount());
source = ExperimentalExtraNatives::GetScriptSource(index);
break;
default:
UNREACHABLE();
}
data_ = source.start();
length_ = source.length();
} }
} // namespace internal } // namespace internal
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef V8_SNAPSHOT_NATIVES_H_ #ifndef V8_SNAPSHOT_NATIVES_H_
#define V8_SNAPSHOT_NATIVES_H_ #define V8_SNAPSHOT_NATIVES_H_
#include "include/v8.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/vector.h" #include "src/vector.h"
...@@ -46,10 +47,6 @@ class V8_EXPORT_PRIVATE NativesCollection { ...@@ -46,10 +47,6 @@ class V8_EXPORT_PRIVATE NativesCollection {
static Vector<const char> GetScriptSource(int index); static Vector<const char> GetScriptSource(int index);
static Vector<const char> GetScriptName(int index); static Vector<const char> GetScriptName(int index);
static Vector<const char> GetScriptsSource(); static Vector<const char> GetScriptsSource();
// The following methods are implemented in natives-common.cc:
static FixedArray* GetSourceCache(Heap* heap);
}; };
typedef NativesCollection<CORE> Natives; typedef NativesCollection<CORE> Natives;
...@@ -64,6 +61,37 @@ void ReadNatives(); ...@@ -64,6 +61,37 @@ void ReadNatives();
void DisposeNatives(); void DisposeNatives();
#endif #endif
class NativesExternalStringResource final
: public v8::String::ExternalOneByteStringResource {
public:
NativesExternalStringResource(NativeType type, int index);
const char* data() const override { return data_; }
size_t length() const override { return length_; }
v8::String::ExternalOneByteStringResource* EncodeForSerialization() const {
DCHECK(type_ == CORE || type_ == EXTRAS);
intptr_t val = (index_ << 1) | ((type_ == CORE) ? 0 : 1);
val = val << kPointerSizeLog2; // Pointer align.
return reinterpret_cast<v8::String::ExternalOneByteStringResource*>(val);
}
// Decode from serialization.
static NativesExternalStringResource* DecodeForDeserialization(
const v8::String::ExternalOneByteStringResource* encoded) {
intptr_t val = reinterpret_cast<intptr_t>(encoded) >> kPointerSizeLog2;
NativeType type = (val & 1) ? EXTRAS : CORE;
int index = static_cast<int>(val >> 1);
return new NativesExternalStringResource(type, index);
}
private:
const char* data_;
size_t length_;
NativeType type_;
int index_;
};
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -166,12 +166,9 @@ class SerializerDeserializer : public ObjectVisitor { ...@@ -166,12 +166,9 @@ class SerializerDeserializer : public ObjectVisitor {
// Internal reference encoded as offsets of pc and target from code entry. // Internal reference encoded as offsets of pc and target from code entry.
static const int kInternalReference = 0x1b; static const int kInternalReference = 0x1b;
static const int kInternalReferenceEncoded = 0x1c; static const int kInternalReferenceEncoded = 0x1c;
// Used for the source code of the natives, which is in the executable, but // Used to encode deoptimizer entry code.
// is referred to from external strings in the snapshot. static const int kDeoptimizerEntryPlain = 0x1d;
static const int kNativesStringResource = 0x1d; static const int kDeoptimizerEntryFromCode = 0x1e;
// Used for the source code for compiled stubs, which is in the executable,
// but is referred to from external strings in the snapshot.
static const int kExtraNativesStringResource = 0x1e;
// Used for embedder-provided serialization data for embedder fields. // Used for embedder-provided serialization data for embedder fields.
static const int kEmbedderFieldsData = 0x1f; static const int kEmbedderFieldsData = 0x1f;
...@@ -184,10 +181,7 @@ class SerializerDeserializer : public ObjectVisitor { ...@@ -184,10 +181,7 @@ class SerializerDeserializer : public ObjectVisitor {
static const int kHotObjectWithSkip = 0x58; static const int kHotObjectWithSkip = 0x58;
static const int kHotObjectMask = 0x07; static const int kHotObjectMask = 0x07;
static const int kDeoptimizerEntryPlain = 0x35; // 0x35..0x37, 0x55..0x57, 0x75..0x7f unused.
static const int kDeoptimizerEntryFromCode = 0x36;
// 0x37, 0x55..0x57, 0x75..0x7f unused.
// ---------- byte code range 0x80..0xff ---------- // ---------- byte code range 0x80..0xff ----------
// First 32 root array items. // First 32 root array items.
......
...@@ -410,59 +410,19 @@ void Serializer::ObjectSerializer::SerializeExternalString() { ...@@ -410,59 +410,19 @@ void Serializer::ObjectSerializer::SerializeExternalString() {
// their resources. // their resources.
SerializeExternalStringAsSequentialString(); SerializeExternalStringAsSequentialString();
} else { } else {
DCHECK(object_->IsExternalOneByteString()); ExternalOneByteString* string = ExternalOneByteString::cast(object_);
DCHECK(ExternalOneByteString::cast(object_)->is_short()); DCHECK(string->is_short());
int size = object_->Size(); const NativesExternalStringResource* resource =
Map* map = object_->map(); reinterpret_cast<const NativesExternalStringResource*>(
AllocationSpace space = string->resource());
MemoryChunk::FromAddress(object_->address())->owner()->identity(); // Replace the resource field with the type and index of the native source.
SerializePrologue(space, size, map); string->set_resource(resource->EncodeForSerialization());
// Serialize the rest of the object. SerializeContent();
CHECK_EQ(0, bytes_processed_so_far_); // Restore the resource field.
bytes_processed_so_far_ = kPointerSize; string->set_resource(resource);
typedef v8::String::ExternalOneByteStringResource Resource;
Resource** resource_pointer = reinterpret_cast<Resource**>(
HeapObject::RawField(object_, ExternalString::kResourceOffset));
Address references_start = reinterpret_cast<Address>(resource_pointer);
OutputRawData(references_start);
if (!SerializeExternalNativeSourceString(
Natives::GetBuiltinsCount(), resource_pointer,
Natives::GetSourceCache(heap), kNativesStringResource)) {
bool result = SerializeExternalNativeSourceString(
ExtraNatives::GetBuiltinsCount(), resource_pointer,
ExtraNatives::GetSourceCache(heap), kExtraNativesStringResource);
// One of the strings in the natives cache should match the resource. We
// don't expect any other kinds of external strings here.
USE(result);
DCHECK(result);
}
OutputRawData(object_->address() + size);
} }
} }
bool Serializer::ObjectSerializer::SerializeExternalNativeSourceString(
int builtin_count,
v8::String::ExternalOneByteStringResource** resource_pointer,
FixedArray* source_cache, int resource_index) {
Isolate* isolate = serializer_->isolate();
for (int i = 0; i < builtin_count; i++) {
Object* source = source_cache->get(i);
if (!source->IsUndefined(isolate)) {
ExternalOneByteString* string = ExternalOneByteString::cast(source);
typedef v8::String::ExternalOneByteStringResource Resource;
const Resource* resource = string->resource();
if (resource == *resource_pointer) {
sink_->Put(resource_index, "NativesStringResource");
sink_->PutSection(i, "NativesStringResourceEnd");
bytes_processed_so_far_ += sizeof(resource);
return true;
}
}
}
return false;
}
void Serializer::ObjectSerializer::SerializeExternalStringAsSequentialString() { void Serializer::ObjectSerializer::SerializeExternalStringAsSequentialString() {
// Instead of serializing this as an external string, we serialize // Instead of serializing this as an external string, we serialize
// an imaginary sequential string with the same content. // an imaginary sequential string with the same content.
...@@ -566,7 +526,9 @@ void Serializer::ObjectSerializer::Serialize() { ...@@ -566,7 +526,9 @@ void Serializer::ObjectSerializer::Serialize() {
if (object_->IsExternalString()) { if (object_->IsExternalString()) {
SerializeExternalString(); SerializeExternalString();
} else { return;
}
// We cannot serialize typed array objects correctly. // We cannot serialize typed array objects correctly.
DCHECK(!object_->IsJSTypedArray()); DCHECK(!object_->IsJSTypedArray());
...@@ -579,6 +541,10 @@ void Serializer::ObjectSerializer::Serialize() { ...@@ -579,6 +541,10 @@ void Serializer::ObjectSerializer::Serialize() {
Script::cast(object_)->set_line_ends(undefined); Script::cast(object_)->set_line_ends(undefined);
} }
SerializeContent();
}
void Serializer::ObjectSerializer::SerializeContent() {
int size = object_->Size(); int size = object_->Size();
Map* map = object_->map(); Map* map = object_->map();
AllocationSpace space = AllocationSpace space =
...@@ -602,7 +568,6 @@ void Serializer::ObjectSerializer::Serialize() { ...@@ -602,7 +568,6 @@ void Serializer::ObjectSerializer::Serialize() {
object_->IterateBody(map->instance_type(), size, this); object_->IterateBody(map->instance_type(), size, this);
OutputRawData(object_->address() + size); OutputRawData(object_->address() + size);
}
} }
void Serializer::ObjectSerializer::SerializeDeferred() { void Serializer::ObjectSerializer::SerializeDeferred() {
......
...@@ -280,6 +280,7 @@ class Serializer::ObjectSerializer : public ObjectVisitor { ...@@ -280,6 +280,7 @@ class Serializer::ObjectSerializer : public ObjectVisitor {
code_has_been_output_(false) {} code_has_been_output_(false) {}
~ObjectSerializer() override {} ~ObjectSerializer() override {}
void Serialize(); void Serialize();
void SerializeContent();
void SerializeDeferred(); void SerializeDeferred();
void VisitPointers(Object** start, Object** end) override; void VisitPointers(Object** start, Object** end) override;
void VisitEmbeddedPointer(RelocInfo* target) override; void VisitEmbeddedPointer(RelocInfo* target) override;
...@@ -305,10 +306,6 @@ class Serializer::ObjectSerializer : public ObjectVisitor { ...@@ -305,10 +306,6 @@ class Serializer::ObjectSerializer : public ObjectVisitor {
int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn); int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn);
void SerializeExternalString(); void SerializeExternalString();
void SerializeExternalStringAsSequentialString(); void SerializeExternalStringAsSequentialString();
bool SerializeExternalNativeSourceString(
int builtin_count,
v8::String::ExternalOneByteStringResource** resource_pointer,
FixedArray* source_cache, int resource_index);
Address PrepareCode(); Address PrepareCode();
......
...@@ -271,13 +271,6 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out, ...@@ -271,13 +271,6 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out,
v8::HandleScope handle_scope(v8_isolate); v8::HandleScope handle_scope(v8_isolate);
v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
} }
// Make sure all builtin scripts are cached.
{
HandleScope scope(isolate);
for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
isolate->bootstrapper()->SourceLookup<Natives>(i);
}
}
heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting);
heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting);
...@@ -378,13 +371,6 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, ...@@ -378,13 +371,6 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out,
v8::HandleScope handle_scope(v8_isolate); v8::HandleScope handle_scope(v8_isolate);
v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
} }
// Make sure all builtin scripts are cached.
{
HandleScope scope(isolate);
for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
isolate->bootstrapper()->SourceLookup<Natives>(i);
}
}
// If we don't do this then we end up with a stray root pointing at the // If we don't do this then we end up with a stray root pointing at the
// context even after we have disposed of env. // context even after we have disposed of env.
...@@ -503,13 +489,6 @@ static void PartiallySerializeCustomContext( ...@@ -503,13 +489,6 @@ static void PartiallySerializeCustomContext(
CompileRun(source_str.ToLocalChecked()); CompileRun(source_str.ToLocalChecked());
source.Dispose(); source.Dispose();
} }
// Make sure all builtin scripts are cached.
{
HandleScope scope(isolate);
for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
isolate->bootstrapper()->SourceLookup<Natives>(i);
}
}
// If we don't do this then we end up with a stray root pointing at the // If we don't do this then we end up with a stray root pointing at the
// context even after we have disposed of env. // context even after we have disposed of env.
isolate->heap()->CollectAllAvailableGarbage( isolate->heap()->CollectAllAvailableGarbage(
......
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