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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 1412633007: Save the native name on the function instead of finding it in the token stream for lazily-linked na… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index ab1eb9728053a117f71d95fd2a6b09538cb387f2..a81335f35545fb23c35efa94fbbdbf2a82ffb034 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -984,18 +984,23 @@ RawScript* Script::ReadFrom(SnapshotReader* reader,
script.StoreNonPointer(&script.raw_ptr()->kind_,
reader->Read<int8_t>());
+ *reader->StringHandle() ^= String::null();
+ script.set_source(*reader->StringHandle());
+ *reader->StreamHandle() ^= TokenStream::null();
+ script.set_tokens(*reader->StreamHandle());
+
// Set all the object fields.
// TODO(5411462): Need to assert No GC can happen here, even though
// allocations may happen.
- intptr_t num_flds = (script.raw()->to_snapshot() - script.raw()->from());
+ RawObject** toobj = reader->snapshot_code()
+ ? script.raw()->to_precompiled_snapshot()
+ : script.raw()->to_snapshot();
+ intptr_t num_flds = (toobj - script.raw()->from());
for (intptr_t i = 0; i <= num_flds; i++) {
(*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference);
script.StorePointer((script.raw()->from() + i),
reader->PassiveObjectHandle()->raw());
}
- // Script wasn't allocated with nulls?
- *reader->StringHandle() ^= String::null();
- script.set_source(*reader->StringHandle());
return script.raw();
}
@@ -1023,7 +1028,9 @@ void RawScript::WriteTo(SnapshotWriter* writer,
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer, kAsReference);
- visitor.VisitPointers(from(), to_snapshot());
+ RawObject** toobj = writer->snapshot_code() ? to_precompiled_snapshot()
+ : to_snapshot();
+ visitor.VisitPointers(from(), toobj);
}
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698