Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: src/snapshot/serialize.cc

Issue 1667693002: [interpreter] do not serialize bytecode for snapshot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: turn flag off Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index 38297646302b3c16224df2615e2e38352dd5d2d2..3cb8552dbf655764c744769ab30e55cfc96533cd 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -1680,9 +1680,10 @@ bool Serializer::SerializeKnownObject(HeapObject* obj, HowToCode how_to_code,
return false;
}
-
StartupSerializer::StartupSerializer(Isolate* isolate, SnapshotByteSink* sink)
- : Serializer(isolate, sink), root_index_wave_front_(0) {
+ : Serializer(isolate, sink),
+ root_index_wave_front_(0),
+ serializing_builtins_(false) {
// Clear the cache of objects used by the partial snapshot. After the
// strong roots have been serialized we can create a partial snapshot
// which will repopulate the cache with objects needed by that partial
@@ -1696,6 +1697,19 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
WhereToPoint where_to_point, int skip) {
DCHECK(!obj->IsJSFunction());
+ if (obj->IsCode()) {
+ Code* code = Code::cast(obj);
+ // If the function code is compiled (either as native code or bytecode),
+ // replace it with lazy-compile builtin. Only exception is when we are
+ // serializing the canonical interpreter-entry-trampoline builtin.
+ if (code->kind() == Code::FUNCTION ||
+ (!serializing_builtins_ && code->is_interpreter_entry_trampoline())) {
+ obj = isolate()->builtins()->builtin(Builtins::kCompileLazy);
+ }
+ } else if (obj->IsBytecodeArray()) {
+ obj = isolate()->heap()->undefined_value();
+ }
+
int root_index = root_index_map_.Lookup(obj);
// We can only encode roots as such if it has already been serialized.
// That applies to root indices below the wave front.
@@ -1705,10 +1719,6 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
return;
}
- if (obj->IsCode() && Code::cast(obj)->kind() == Code::FUNCTION) {
- obj = isolate()->builtins()->builtin(Builtins::kCompileLazy);
- }
-
if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return;
FlushSkip(skip);
@@ -1733,6 +1743,11 @@ void StartupSerializer::SerializeWeakReferencesAndDeferred() {
Pad();
}
+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);
+}
void Serializer::PutRoot(int root_index,
HeapObject* object,
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698