| 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/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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 str_ ^= ReadObjectImpl(class_header, kAsInlinedObject, kInvalidPatchIndex, 0); | 253 str_ ^= ReadObjectImpl(class_header, kAsInlinedObject, kInvalidPatchIndex, 0); |
| 254 library_ = Library::LookupLibrary(str_); | 254 library_ = Library::LookupLibrary(str_); |
| 255 if (library_.IsNull() || !library_.Loaded()) { | 255 if (library_.IsNull() || !library_.Loaded()) { |
| 256 SetReadException("Invalid object found in message."); | 256 SetReadException("Invalid object found in message."); |
| 257 } | 257 } |
| 258 str_ ^= ReadObjectImpl(kAsInlinedObject); | 258 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 259 cls = library_.LookupClass(str_); | 259 cls = library_.LookupClass(str_); |
| 260 if (cls.IsNull()) { | 260 if (cls.IsNull()) { |
| 261 SetReadException("Invalid object found in message."); | 261 SetReadException("Invalid object found in message."); |
| 262 } | 262 } |
| 263 cls.EnsureIsFinalized(isolate()); | 263 cls.EnsureIsFinalized(thread()); |
| 264 return cls.raw(); | 264 return cls.raw(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 | 267 |
| 268 RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) { | 268 RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) { |
| 269 ASSERT(kind_ == Snapshot::kScript); | 269 ASSERT(kind_ == Snapshot::kScript); |
| 270 // Read the function header information and lookup the function. | 270 // Read the function header information and lookup the function. |
| 271 intptr_t func_header = Read<int32_t>(); | 271 intptr_t func_header = Read<int32_t>(); |
| 272 ASSERT((func_header & kSmiTagMask) != kSmiTag); | 272 ASSERT((func_header & kSmiTagMask) != kSmiTag); |
| 273 ASSERT(!IsVMIsolateObject(func_header) || | 273 ASSERT(!IsVMIsolateObject(func_header) || |
| (...skipping 10 matching lines...) Expand all Loading... |
| 284 } | 284 } |
| 285 str_ ^= ReadObjectImpl(kAsInlinedObject); | 285 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 286 if (str_.Equals(Symbols::TopLevel(), 0, Symbols::TopLevel().Length())) { | 286 if (str_.Equals(Symbols::TopLevel(), 0, Symbols::TopLevel().Length())) { |
| 287 str_ ^= ReadObjectImpl(kAsInlinedObject); | 287 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 288 func ^= library_.LookupLocalFunction(str_); | 288 func ^= library_.LookupLocalFunction(str_); |
| 289 } else { | 289 } else { |
| 290 cls_ = library_.LookupClass(str_); | 290 cls_ = library_.LookupClass(str_); |
| 291 if (cls_.IsNull()) { | 291 if (cls_.IsNull()) { |
| 292 SetReadException("Expected a class name, but found an invalid name."); | 292 SetReadException("Expected a class name, but found an invalid name."); |
| 293 } | 293 } |
| 294 cls_.EnsureIsFinalized(isolate()); | 294 cls_.EnsureIsFinalized(thread()); |
| 295 str_ ^= ReadObjectImpl(kAsInlinedObject); | 295 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 296 func ^= cls_.LookupFunctionAllowPrivate(str_); | 296 func ^= cls_.LookupFunctionAllowPrivate(str_); |
| 297 } | 297 } |
| 298 if (func.IsNull()) { | 298 if (func.IsNull()) { |
| 299 SetReadException("Expected a function name, but found an invalid name."); | 299 SetReadException("Expected a function name, but found an invalid name."); |
| 300 } | 300 } |
| 301 return func.raw(); | 301 return func.raw(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 | 304 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 321 str_ ^= ReadObjectImpl(kAsInlinedObject); | 321 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 322 if (str_.Equals(Symbols::TopLevel())) { | 322 if (str_.Equals(Symbols::TopLevel())) { |
| 323 str_ ^= ReadObjectImpl(kAsInlinedObject); | 323 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 324 func = library_.LookupFunctionAllowPrivate(str_); | 324 func = library_.LookupFunctionAllowPrivate(str_); |
| 325 } else { | 325 } else { |
| 326 cls_ = library_.LookupClassAllowPrivate(str_); | 326 cls_ = library_.LookupClassAllowPrivate(str_); |
| 327 if (cls_.IsNull()) { | 327 if (cls_.IsNull()) { |
| 328 OS::Print("Name of class not found %s\n", str_.ToCString()); | 328 OS::Print("Name of class not found %s\n", str_.ToCString()); |
| 329 SetReadException("Invalid Class object found in message."); | 329 SetReadException("Invalid Class object found in message."); |
| 330 } | 330 } |
| 331 cls_.EnsureIsFinalized(isolate()); | 331 cls_.EnsureIsFinalized(thread()); |
| 332 str_ ^= ReadObjectImpl(kAsInlinedObject); | 332 str_ ^= ReadObjectImpl(kAsInlinedObject); |
| 333 func = cls_.LookupFunctionAllowPrivate(str_); | 333 func = cls_.LookupFunctionAllowPrivate(str_); |
| 334 } | 334 } |
| 335 if (func.IsNull()) { | 335 if (func.IsNull()) { |
| 336 SetReadException("Invalid function object found in message."); | 336 SetReadException("Invalid function object found in message."); |
| 337 } | 337 } |
| 338 func = func.ImplicitClosureFunction(); | 338 func = func.ImplicitClosureFunction(); |
| 339 ASSERT(!func.IsNull()); | 339 ASSERT(!func.IsNull()); |
| 340 | 340 |
| 341 // Return the associated implicit static closure. | 341 // Return the associated implicit static closure. |
| (...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 NoSafepointScope no_safepoint; | 2825 NoSafepointScope no_safepoint; |
| 2826 WriteObject(obj.raw()); | 2826 WriteObject(obj.raw()); |
| 2827 UnmarkAll(); | 2827 UnmarkAll(); |
| 2828 } else { | 2828 } else { |
| 2829 ThrowException(exception_type(), exception_msg()); | 2829 ThrowException(exception_type(), exception_msg()); |
| 2830 } | 2830 } |
| 2831 } | 2831 } |
| 2832 | 2832 |
| 2833 | 2833 |
| 2834 } // namespace dart | 2834 } // namespace dart |
| OLD | NEW |