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

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

Issue 2955923002: [vm] Fix reading a named reference to a top-level class. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 !IsObjectStoreClassId(SerializedHeaderData::decode(class_header))); 269 !IsObjectStoreClassId(SerializedHeaderData::decode(class_header)));
270 Class& cls = Class::ZoneHandle(zone(), Class::null()); 270 Class& cls = Class::ZoneHandle(zone(), Class::null());
271 AddBackRef(object_id, &cls, kIsDeserialized); 271 AddBackRef(object_id, &cls, kIsDeserialized);
272 // Read the library/class information and lookup the class. 272 // Read the library/class information and lookup the class.
273 str_ ^= ReadObjectImpl(class_header, kAsInlinedObject, kInvalidPatchIndex, 0); 273 str_ ^= ReadObjectImpl(class_header, kAsInlinedObject, kInvalidPatchIndex, 0);
274 library_ = Library::LookupLibrary(thread(), str_); 274 library_ = Library::LookupLibrary(thread(), str_);
275 if (library_.IsNull() || !library_.Loaded()) { 275 if (library_.IsNull() || !library_.Loaded()) {
276 SetReadException("Invalid object found in message."); 276 SetReadException("Invalid object found in message.");
277 } 277 }
278 str_ ^= ReadObjectImpl(kAsInlinedObject); 278 str_ ^= ReadObjectImpl(kAsInlinedObject);
279 cls = library_.LookupClassAllowPrivate(str_); 279 if (str_.raw() == Symbols::TopLevel().raw()) {
280 cls = library_.toplevel_class();
281 } else {
282 cls = library_.LookupClassAllowPrivate(str_);
siva 2017/06/26 20:36:45 Would it be beneficial to add this login into Look
rmacnak 2017/06/26 20:51:45 I'm not sure. I don't think we can generally treat
283 }
280 if (cls.IsNull()) { 284 if (cls.IsNull()) {
281 SetReadException("Invalid object found in message."); 285 SetReadException("Invalid object found in message.");
282 } 286 }
283 cls.EnsureIsFinalized(thread()); 287 cls.EnsureIsFinalized(thread());
284 return cls.raw(); 288 return cls.raw();
285 } 289 }
286 290
287 291
288 RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) { 292 RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) {
289 ASSERT(kind_ == Snapshot::kScript); 293 ASSERT(kind_ == Snapshot::kScript);
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 *buffer_len_ = BytesWritten(); 2055 *buffer_len_ = BytesWritten();
2052 } 2056 }
2053 } else { 2057 } else {
2054 FreeBuffer(); 2058 FreeBuffer();
2055 ThrowException(exception_type(), exception_msg()); 2059 ThrowException(exception_type(), exception_msg());
2056 } 2060 }
2057 } 2061 }
2058 2062
2059 2063
2060 } // namespace dart 2064 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698