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

Unified Diff: runtime/vm/megamorphic_cache_table.cc

Issue 1311403009: More precompiled snapshotting. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 5 years, 3 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
Index: runtime/vm/megamorphic_cache_table.cc
diff --git a/runtime/vm/megamorphic_cache_table.cc b/runtime/vm/megamorphic_cache_table.cc
index 3bbc5291fc9fcd925c96c623c6cba1e8adac1b44..42a214f10214bb3e2fd2c0924861ec11cba6fb15 100644
--- a/runtime/vm/megamorphic_cache_table.cc
+++ b/runtime/vm/megamorphic_cache_table.cc
@@ -102,4 +102,40 @@ void MegamorphicCacheTable::PrintSizes() {
length_, size / 1024);
}
+
+void MegamorphicCacheTable::ReadFrom(SnapshotReader* reader) {
+ ASSERT(reader->snapshot_code());
+
+ *reader->FunctionHandle() ^= reader->ReadObject();
+ miss_handler_function_ = reader->FunctionHandle()->raw();
+ miss_handler_code_ = reader->FunctionHandle()->CurrentCode();
+
+ capacity_ = reader->Read<intptr_t>();
+ length_ = capacity_;
+
+ table_ = reinterpret_cast<Entry*>(malloc(length_ * sizeof(*table_)));
+ for (intptr_t i = 0; i < length_; ++i) {
+ *reader->StringHandle() ^= reader->ReadObject();
+ table_[i].name = reader->StringHandle()->raw();
+ *reader->ArrayHandle() ^= reader->ReadObject();
+ table_[i].descriptor = reader->ArrayHandle()->raw();
+ *reader->MegamorphicCacheHandle() ^= reader->ReadObject();
+ table_[i].cache = reader->MegamorphicCacheHandle()->raw();
+ }
+}
+
+
+void MegamorphicCacheTable::WriteTo(SnapshotWriter* writer) {
+ ASSERT(writer->snapshot_code());
+
+ writer->WriteObject(miss_handler_function_);
+ writer->Write<intptr_t>(length_);
+ for (intptr_t i = 0; i < length_; i++) {
+ writer->WriteObject(table_[i].name);
+ writer->WriteObject(table_[i].descriptor);
+ writer->WriteObject(table_[i].cache);
+ }
+}
+
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698