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

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 1686773002: Precompilation: drop unused types and type arguments and empty classes and libraries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/native_entry.h" 5 #include "vm/native_entry.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Write out the boolean is_in_fullsnapshot first as this will 108 // Write out the boolean is_in_fullsnapshot first as this will
109 // help the reader decide how the rest of the information needs 109 // help the reader decide how the rest of the information needs
110 // to be interpreted. 110 // to be interpreted.
111 writer->Write<bool>(is_in_fullsnapshot); 111 writer->Write<bool>(is_in_fullsnapshot);
112 112
113 if ((kind == Snapshot::kFull) || 113 if ((kind == Snapshot::kFull) ||
114 (kind == Snapshot::kScript && !is_in_fullsnapshot)) { 114 (kind == Snapshot::kScript && !is_in_fullsnapshot)) {
115 // Write out all the non object pointer fields. 115 // Write out all the non object pointer fields.
116 // NOTE: cpp_vtable_ is not written. 116 // NOTE: cpp_vtable_ is not written.
117 classid_t class_id = ptr()->id_; 117 classid_t class_id = ptr()->id_;
118 ASSERT(class_id != kIllegalCid);
118 writer->Write<classid_t>(class_id); 119 writer->Write<classid_t>(class_id);
119 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { 120 if (!RawObject::IsInternalVMdefinedClassId(class_id)) {
120 // We don't write the instance size of VM defined classes as they 121 // We don't write the instance size of VM defined classes as they
121 // are already setup during initialization as part of pre populating 122 // are already setup during initialization as part of pre populating
122 // the class table. 123 // the class table.
123 writer->Write<int32_t>(ptr()->instance_size_in_words_); 124 writer->Write<int32_t>(ptr()->instance_size_in_words_);
124 writer->Write<int32_t>(ptr()->next_field_offset_in_words_); 125 writer->Write<int32_t>(ptr()->next_field_offset_in_words_);
125 } 126 }
126 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_); 127 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_);
127 writer->Write<uint16_t>(ptr()->num_type_arguments_); 128 writer->Write<uint16_t>(ptr()->num_type_arguments_);
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 // help the reader decide how the rest of the information needs 1284 // help the reader decide how the rest of the information needs
1284 // to be interpreted. 1285 // to be interpreted.
1285 writer->Write<bool>(ptr()->is_in_fullsnapshot_); 1286 writer->Write<bool>(ptr()->is_in_fullsnapshot_);
1286 1287
1287 if ((kind == Snapshot::kScript) && ptr()->is_in_fullsnapshot_) { 1288 if ((kind == Snapshot::kScript) && ptr()->is_in_fullsnapshot_) {
1288 // Write out library URL so that it can be looked up when reading. 1289 // Write out library URL so that it can be looked up when reading.
1289 writer->WriteObjectImpl(ptr()->url_, kAsInlinedObject); 1290 writer->WriteObjectImpl(ptr()->url_, kAsInlinedObject);
1290 } else { 1291 } else {
1291 ASSERT((kind == Snapshot::kFull) || !ptr()->is_in_fullsnapshot_); 1292 ASSERT((kind == Snapshot::kFull) || !ptr()->is_in_fullsnapshot_);
1292 // Write out all non object fields. 1293 // Write out all non object fields.
1294 // TODO(rmacnak): ASSERT(ptr()->index_ != static_cast<classid_t>(-1));
regis 2016/02/19 20:54:07 Is this ASSERT not yet valid?
rmacnak 2016/02/20 01:35:39 I put it back in locally but forgot to reupload th
1293 writer->WriteClassIDValue(ptr()->index_); 1295 writer->WriteClassIDValue(ptr()->index_);
1294 writer->Write<uint16_t>(ptr()->num_imports_); 1296 writer->Write<uint16_t>(ptr()->num_imports_);
1295 writer->Write<int8_t>(ptr()->load_state_); 1297 writer->Write<int8_t>(ptr()->load_state_);
1296 writer->Write<bool>(ptr()->corelib_imported_); 1298 writer->Write<bool>(ptr()->corelib_imported_);
1297 writer->Write<bool>(ptr()->is_dart_scheme_); 1299 writer->Write<bool>(ptr()->is_dart_scheme_);
1298 writer->Write<bool>(ptr()->debuggable_); 1300 writer->Write<bool>(ptr()->debuggable_);
1299 // We do not serialize the native resolver or symbolizer. These need to be 1301 // We do not serialize the native resolver or symbolizer. These need to be
1300 // explicitly set after deserialization. 1302 // explicitly set after deserialization.
1301 1303
1302 // We do not write the loaded_scripts_ and resolved_names_ caches to the 1304 // We do not write the loaded_scripts_ and resolved_names_ caches to the
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 result.set_deopt_id(reader->Read<int32_t>()); 1998 result.set_deopt_id(reader->Read<int32_t>());
1997 result.set_state_bits(reader->Read<uint32_t>()); 1999 result.set_state_bits(reader->Read<uint32_t>());
1998 2000
1999 // Set all the object fields. 2001 // Set all the object fields.
2000 RawObject** toobj = reader->snapshot_code() 2002 RawObject** toobj = reader->snapshot_code()
2001 ? result.raw()->to_precompiled_snapshot() 2003 ? result.raw()->to_precompiled_snapshot()
2002 : result.raw()->to(); 2004 : result.raw()->to();
2003 READ_OBJECT_FIELDS(result, 2005 READ_OBJECT_FIELDS(result,
2004 result.raw()->from(), toobj, 2006 result.raw()->from(), toobj,
2005 kAsReference); 2007 kAsReference);
2008 if (reader->snapshot_code()) {
2009 result.set_owner(Function::Handle(reader->zone()));
2010 }
2006 2011
2007 return result.raw(); 2012 return result.raw();
2008 } 2013 }
2009 2014
2010 2015
2011 void RawICData::WriteTo(SnapshotWriter* writer, 2016 void RawICData::WriteTo(SnapshotWriter* writer,
2012 intptr_t object_id, 2017 intptr_t object_id,
2013 Snapshot::Kind kind, 2018 Snapshot::Kind kind,
2014 bool as_reference) { 2019 bool as_reference) {
2015 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); 2020 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull));
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 // We do not allow objects with native fields in an isolate message. 3704 // We do not allow objects with native fields in an isolate message.
3700 writer->SetWriteException(Exceptions::kArgument, 3705 writer->SetWriteException(Exceptions::kArgument,
3701 "Illegal argument in isolate message" 3706 "Illegal argument in isolate message"
3702 " : (object is a UserTag)"); 3707 " : (object is a UserTag)");
3703 } else { 3708 } else {
3704 UNREACHABLE(); 3709 UNREACHABLE();
3705 } 3710 }
3706 } 3711 }
3707 3712
3708 } // namespace dart 3713 } // namespace dart
OLDNEW
« runtime/vm/precompiler.cc ('K') | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698