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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ReadObjectImpl(kAsInlinedObject); | 227 ReadObjectImpl(kAsInlinedObject); |
228 (*backward_references_)[i].set_state(kIsDeserialized); | 228 (*backward_references_)[i].set_state(kIsDeserialized); |
229 } | 229 } |
230 } | 230 } |
231 if (kind() != Snapshot::kFull) { | 231 if (kind() != Snapshot::kFull) { |
232 ProcessDeferredCanonicalizations(); | 232 ProcessDeferredCanonicalizations(); |
233 } | 233 } |
234 return obj.raw(); | 234 return obj.raw(); |
235 } else { | 235 } else { |
236 // An error occurred while reading, return the error object. | 236 // An error occurred while reading, return the error object. |
237 const Error& err = Error::Handle(isolate()->object_store()->sticky_error()); | 237 const Error& err = Error::Handle(thread()->sticky_error()); |
238 isolate()->object_store()->clear_sticky_error(); | 238 thread()->clear_sticky_error(); |
239 return err.raw(); | 239 return err.raw(); |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 RawClass* SnapshotReader::ReadClassId(intptr_t object_id) { | 244 RawClass* SnapshotReader::ReadClassId(intptr_t object_id) { |
245 ASSERT(kind_ != Snapshot::kFull); | 245 ASSERT(kind_ != Snapshot::kFull); |
246 // Read the class header information and lookup the class. | 246 // Read the class header information and lookup the class. |
247 intptr_t class_header = Read<int32_t>(); | 247 intptr_t class_header = Read<int32_t>(); |
248 ASSERT((class_header & kSmiTagMask) != kSmiTag); | 248 ASSERT((class_header & kSmiTagMask) != kSmiTag); |
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 if (Object::vm_isolate_snapshot_object_table().At(i) == rawobj) { | 2481 if (Object::vm_isolate_snapshot_object_table().At(i) == rawobj) { |
2482 return (i + kMaxPredefinedObjectIds); | 2482 return (i + kMaxPredefinedObjectIds); |
2483 } | 2483 } |
2484 } | 2484 } |
2485 return kInvalidIndex; | 2485 return kInvalidIndex; |
2486 } | 2486 } |
2487 | 2487 |
2488 | 2488 |
2489 void SnapshotWriter::ThrowException(Exceptions::ExceptionType type, | 2489 void SnapshotWriter::ThrowException(Exceptions::ExceptionType type, |
2490 const char* msg) { | 2490 const char* msg) { |
2491 object_store()->clear_sticky_error(); | 2491 thread()->clear_sticky_error(); |
2492 if (msg != NULL) { | 2492 if (msg != NULL) { |
2493 const String& msg_obj = String::Handle(String::New(msg)); | 2493 const String& msg_obj = String::Handle(String::New(msg)); |
2494 const Array& args = Array::Handle(Array::New(1)); | 2494 const Array& args = Array::Handle(Array::New(1)); |
2495 args.SetAt(0, msg_obj); | 2495 args.SetAt(0, msg_obj); |
2496 Exceptions::ThrowByType(type, args); | 2496 Exceptions::ThrowByType(type, args); |
2497 } else { | 2497 } else { |
2498 Exceptions::ThrowByType(type, Object::empty_array()); | 2498 Exceptions::ThrowByType(type, Object::empty_array()); |
2499 } | 2499 } |
2500 UNREACHABLE(); | 2500 UNREACHABLE(); |
2501 } | 2501 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2601 if (setjmp(*jump.Set()) == 0) { | 2601 if (setjmp(*jump.Set()) == 0) { |
2602 NoSafepointScope no_safepoint; | 2602 NoSafepointScope no_safepoint; |
2603 WriteObject(obj.raw()); | 2603 WriteObject(obj.raw()); |
2604 } else { | 2604 } else { |
2605 ThrowException(exception_type(), exception_msg()); | 2605 ThrowException(exception_type(), exception_msg()); |
2606 } | 2606 } |
2607 } | 2607 } |
2608 | 2608 |
2609 | 2609 |
2610 } // namespace dart | 2610 } // namespace dart |
OLD | NEW |