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

Unified Diff: src/serialize.cc

Issue 825933004: Use back reference map to find references to global proxy. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index 8d6d5508252450a24ef5810b414fa59f5c66fc84..1f85ae5b37f7c62a8911b817ac04737441e7f7d7 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -1405,7 +1405,7 @@ void PartialSerializer::Serialize(Object** o) {
if ((*o)->IsContext()) {
Context* context = Context::cast(*o);
global_object_ = context->global_object();
- global_proxy_ = context->global_proxy();
+ back_reference_map()->AddGlobalProxy(context->global_proxy());
}
VisitPointer(o);
SerializeOutdatedContextsAsFixedArray();
@@ -1562,8 +1562,14 @@ bool Serializer::SerializeKnownObject(HeapObject* obj, HowToCode how_to_code,
FlushSkip(skip);
if (FLAG_trace_serializer) PrintF(" Encoding source object\n");
DCHECK(how_to_code == kPlain && where_to_point == kStartOfObject);
- sink_->Put(kAttachedReference + how_to_code + where_to_point, "Source");
- sink_->PutInt(kSourceObjectReference, "kSourceObjectIndex");
+ sink_->Put(kAttachedReference + kPlain + kStartOfObject, "Source");
+ sink_->PutInt(kSourceObjectReference, "kSourceObjectReference");
+ } else if (back_reference.is_global_proxy()) {
+ FlushSkip(skip);
+ if (FLAG_trace_serializer) PrintF(" Encoding global proxy\n");
+ DCHECK(how_to_code == kPlain && where_to_point == kStartOfObject);
+ sink_->Put(kAttachedReference + kPlain + kStartOfObject, "Global Proxy");
+ sink_->PutInt(kGlobalProxyReference, "kGlobalProxyReference");
} else {
if (FLAG_trace_serializer) {
PrintF(" Encoding back reference to: ");
@@ -1696,14 +1702,6 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
FlushSkip(skip);
- if (obj == global_proxy_) {
- FlushSkip(skip);
- DCHECK(how_to_code == kPlain && where_to_point == kStartOfObject);
- sink_->Put(kAttachedReference + how_to_code + where_to_point, "Reference");
- sink_->PutInt(kGlobalProxyReference, "kGlobalProxyReferenceIndex");
- return;
- }
-
// Object has not yet been serialized. Serialize it here.
ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point);
serializer.Serialize();
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698