Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1990 bool as_reference) { | 1990 bool as_reference) { |
| 1991 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 1991 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
| 1992 | 1992 |
| 1993 ICData& result = ICData::ZoneHandle(reader->zone(), NEW_OBJECT(ICData)); | 1993 ICData& result = ICData::ZoneHandle(reader->zone(), NEW_OBJECT(ICData)); |
| 1994 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1994 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 1995 | 1995 |
| 1996 result.set_deopt_id(reader->Read<int32_t>()); | 1996 result.set_deopt_id(reader->Read<int32_t>()); |
| 1997 result.set_state_bits(reader->Read<uint32_t>()); | 1997 result.set_state_bits(reader->Read<uint32_t>()); |
| 1998 | 1998 |
| 1999 // Set all the object fields. | 1999 // Set all the object fields. |
| 2000 RawObject** toobj = reader->snapshot_code() | |
| 2001 ? result.raw()->to_precompiled_snapshot() | |
| 2002 : result.raw()->to(); | |
| 2000 READ_OBJECT_FIELDS(result, | 2003 READ_OBJECT_FIELDS(result, |
| 2001 result.raw()->from(), result.raw()->to(), | 2004 result.raw()->from(), toobj, |
| 2002 kAsReference); | 2005 kAsReference); |
| 2003 | 2006 |
| 2004 return result.raw(); | 2007 return result.raw(); |
| 2005 } | 2008 } |
| 2006 | 2009 |
| 2007 | 2010 |
| 2008 void RawICData::WriteTo(SnapshotWriter* writer, | 2011 void RawICData::WriteTo(SnapshotWriter* writer, |
| 2009 intptr_t object_id, | 2012 intptr_t object_id, |
| 2010 Snapshot::Kind kind, | 2013 Snapshot::Kind kind, |
| 2011 bool as_reference) { | 2014 bool as_reference) { |
| 2012 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 2015 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
| 2013 | 2016 |
| 2014 // Write out the serialization header value for this object. | 2017 // Write out the serialization header value for this object. |
| 2015 writer->WriteInlinedObjectHeader(object_id); | 2018 writer->WriteInlinedObjectHeader(object_id); |
| 2016 | 2019 |
| 2017 // Write out the class and tags information. | 2020 // Write out the class and tags information. |
| 2018 writer->WriteVMIsolateObject(kICDataCid); | 2021 writer->WriteVMIsolateObject(kICDataCid); |
| 2019 writer->WriteTags(writer->GetObjectTags(this)); | 2022 writer->WriteTags(writer->GetObjectTags(this)); |
| 2020 | 2023 |
| 2021 // Write out all the non object fields. | 2024 // Write out all the non object fields. |
| 2022 writer->Write<int32_t>(ptr()->deopt_id_); | 2025 writer->Write<int32_t>(ptr()->deopt_id_); |
| 2023 writer->Write<uint32_t>(ptr()->state_bits_); | 2026 writer->Write<uint32_t>(ptr()->state_bits_); |
| 2024 | 2027 |
| 2025 // Write out all the object pointer fields. | 2028 // Write out all the object pointer fields. |
| 2029 // In precompiled snapshots, omit the owner field. The owner field may | |
| 2030 // refer to a function which was always inlined and no longer need. | |
|
srdjan
2016/02/16 20:36:42
s/need/needed/
rmacnak
2016/02/16 21:39:17
Done.
| |
| 2026 SnapshotWriterVisitor visitor(writer, kAsReference); | 2031 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 2027 visitor.VisitPointers(from(), to()); | 2032 RawObject** toobj = writer->snapshot_code() ? to_precompiled_snapshot() |
| 2033 : to(); | |
| 2034 visitor.VisitPointers(from(), toobj); | |
| 2028 } | 2035 } |
| 2029 | 2036 |
| 2030 | 2037 |
| 2031 RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, | 2038 RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, |
| 2032 intptr_t object_id, | 2039 intptr_t object_id, |
| 2033 intptr_t tags, | 2040 intptr_t tags, |
| 2034 Snapshot::Kind kind, | 2041 Snapshot::Kind kind, |
| 2035 bool as_reference) { | 2042 bool as_reference) { |
| 2036 ASSERT(reader->snapshot_code()); | 2043 ASSERT(reader->snapshot_code()); |
| 2037 ASSERT(kind == Snapshot::kFull); | 2044 ASSERT(kind == Snapshot::kFull); |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3692 // We do not allow objects with native fields in an isolate message. | 3699 // We do not allow objects with native fields in an isolate message. |
| 3693 writer->SetWriteException(Exceptions::kArgument, | 3700 writer->SetWriteException(Exceptions::kArgument, |
| 3694 "Illegal argument in isolate message" | 3701 "Illegal argument in isolate message" |
| 3695 " : (object is a UserTag)"); | 3702 " : (object is a UserTag)"); |
| 3696 } else { | 3703 } else { |
| 3697 UNREACHABLE(); | 3704 UNREACHABLE(); |
| 3698 } | 3705 } |
| 3699 } | 3706 } |
| 3700 | 3707 |
| 3701 } // namespace dart | 3708 } // namespace dart |
| OLD | NEW |