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/exceptions.h" | 10 #include "vm/exceptions.h" |
11 #include "vm/heap.h" | 11 #include "vm/heap.h" |
12 #include "vm/lockers.h" | 12 #include "vm/lockers.h" |
13 #include "vm/longjump.h" | 13 #include "vm/longjump.h" |
14 #include "vm/object.h" | 14 #include "vm/object.h" |
15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
16 #include "vm/snapshot_ids.h" | 16 #include "vm/snapshot_ids.h" |
17 #include "vm/symbols.h" | 17 #include "vm/symbols.h" |
| 18 #include "vm/verified_memory.h" |
18 #include "vm/version.h" | 19 #include "vm/version.h" |
19 | 20 |
20 namespace dart { | 21 namespace dart { |
21 | 22 |
22 static const int kNumInitialReferencesInFullSnapshot = 160 * KB; | 23 static const int kNumInitialReferencesInFullSnapshot = 160 * KB; |
23 static const int kNumInitialReferences = 64; | 24 static const int kNumInitialReferences = 64; |
24 | 25 |
25 | 26 |
26 static bool IsSingletonClassId(intptr_t class_id) { | 27 static bool IsSingletonClassId(intptr_t class_id) { |
27 // Check if this is a singleton object class which is shared by all isolates. | 28 // Check if this is a singleton object class which is shared by all isolates. |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 uword current = address; | 841 uword current = address; |
841 uword end = address + size; | 842 uword end = address + size; |
842 while (current < end) { | 843 while (current < end) { |
843 *reinterpret_cast<intptr_t*>(current) = kZapUninitializedWord; | 844 *reinterpret_cast<intptr_t*>(current) = kZapUninitializedWord; |
844 current += kWordSize; | 845 current += kWordSize; |
845 } | 846 } |
846 #endif // defined(DBEUG) | 847 #endif // defined(DBEUG) |
847 // Make sure to initialize the last word, as this can be left untouched in | 848 // Make sure to initialize the last word, as this can be left untouched in |
848 // case the object deserialized has an alignment tail. | 849 // case the object deserialized has an alignment tail. |
849 *reinterpret_cast<RawObject**>(address + size - kWordSize) = Object::null(); | 850 *reinterpret_cast<RawObject**>(address + size - kWordSize) = Object::null(); |
| 851 VerifiedMemory::Accept(address, size); |
850 | 852 |
851 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 853 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
852 uword tags = 0; | 854 uword tags = 0; |
853 ASSERT(class_id != kIllegalCid); | 855 ASSERT(class_id != kIllegalCid); |
854 tags = RawObject::ClassIdTag::update(class_id, tags); | 856 tags = RawObject::ClassIdTag::update(class_id, tags); |
855 tags = RawObject::SizeTag::update(size, tags); | 857 tags = RawObject::SizeTag::update(size, tags); |
856 raw_obj->ptr()->tags_ = tags; | 858 raw_obj->ptr()->tags_ = tags; |
857 return raw_obj; | 859 return raw_obj; |
858 } | 860 } |
859 | 861 |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 NoGCScope no_gc; | 1761 NoGCScope no_gc; |
1760 WriteObject(obj.raw()); | 1762 WriteObject(obj.raw()); |
1761 UnmarkAll(); | 1763 UnmarkAll(); |
1762 } else { | 1764 } else { |
1763 ThrowException(exception_type(), exception_msg()); | 1765 ThrowException(exception_type(), exception_msg()); |
1764 } | 1766 } |
1765 } | 1767 } |
1766 | 1768 |
1767 | 1769 |
1768 } // namespace dart | 1770 } // namespace dart |
OLD | NEW |