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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/become.h" | 10 #include "vm/become.h" |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 ASSERT(isolate == Dart::vm_isolate()); | 1021 ASSERT(isolate == Dart::vm_isolate()); |
1022 WritableVMIsolateScope scope(Thread::Current()); | 1022 WritableVMIsolateScope scope(Thread::Current()); |
1023 PremarkingVisitor premarker; | 1023 PremarkingVisitor premarker; |
1024 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); | 1024 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); |
1025 isolate->heap()->IterateOldObjectsNoEmbedderPages(&premarker); | 1025 isolate->heap()->IterateOldObjectsNoEmbedderPages(&premarker); |
1026 // Make the VM isolate read-only again after setting all objects as marked. | 1026 // Make the VM isolate read-only again after setting all objects as marked. |
1027 } | 1027 } |
1028 } | 1028 } |
1029 | 1029 |
1030 | 1030 |
1031 void Object::InitVmIsolateSnapshotObjectTable(intptr_t len) { | 1031 void Object::set_vm_isolate_snapshot_object_table(const Array& table) { |
1032 ASSERT(Isolate::Current() == Dart::vm_isolate()); | 1032 ASSERT(Isolate::Current() == Dart::vm_isolate()); |
1033 *vm_isolate_snapshot_object_table_ = Array::New(len, Heap::kOld); | 1033 *vm_isolate_snapshot_object_table_ = table.raw(); |
1034 } | 1034 } |
1035 | 1035 |
1036 | 1036 |
1037 // Make unused space in an object whose type has been transformed safe | 1037 // Make unused space in an object whose type has been transformed safe |
1038 // for traversing during GC. | 1038 // for traversing during GC. |
1039 // The unused part of the transformed object is marked as an TypedDataInt8Array | 1039 // The unused part of the transformed object is marked as an TypedDataInt8Array |
1040 // object. | 1040 // object. |
1041 void Object::MakeUnusedSpaceTraversable(const Object& obj, | 1041 void Object::MakeUnusedSpaceTraversable(const Object& obj, |
1042 intptr_t original_size, | 1042 intptr_t original_size, |
1043 intptr_t used_size) { | 1043 intptr_t used_size) { |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 cls = Class::New<Float64x2>(); | 1684 cls = Class::New<Float64x2>(); |
1685 object_store->set_float64x2_class(cls); | 1685 object_store->set_float64x2_class(cls); |
1686 | 1686 |
1687 #define REGISTER_TYPED_DATA_CLASS(clazz) \ | 1687 #define REGISTER_TYPED_DATA_CLASS(clazz) \ |
1688 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); | 1688 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); |
1689 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); | 1689 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); |
1690 #undef REGISTER_TYPED_DATA_CLASS | 1690 #undef REGISTER_TYPED_DATA_CLASS |
1691 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ | 1691 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ |
1692 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); | 1692 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); |
1693 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); | 1693 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); |
| 1694 #undef REGISTER_TYPED_DATA_VIEW_CLASS |
1694 cls = Class::NewTypedDataViewClass(kByteDataViewCid); | 1695 cls = Class::NewTypedDataViewClass(kByteDataViewCid); |
1695 #undef REGISTER_TYPED_DATA_VIEW_CLASS | |
1696 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ | 1696 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ |
1697 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); | 1697 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); |
1698 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); | 1698 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); |
1699 #undef REGISTER_EXT_TYPED_DATA_CLASS | 1699 #undef REGISTER_EXT_TYPED_DATA_CLASS |
1700 | 1700 |
1701 cls = Class::New<Instance>(kByteBufferCid); | 1701 cls = Class::New<Instance>(kByteBufferCid); |
1702 | 1702 |
1703 cls = Class::New<Integer>(); | 1703 cls = Class::New<Integer>(); |
1704 object_store->set_integer_implementation_class(cls); | 1704 object_store->set_integer_implementation_class(cls); |
1705 | 1705 |
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4441 const Array& old_constants = Array::Handle(zone, constants()); | 4441 const Array& old_constants = Array::Handle(zone, constants()); |
4442 if (old_constants.Length() == 0) return; | 4442 if (old_constants.Length() == 0) return; |
4443 | 4443 |
4444 set_constants(Object::empty_array()); | 4444 set_constants(Object::empty_array()); |
4445 CanonicalInstancesSet set(zone, old_constants.raw()); | 4445 CanonicalInstancesSet set(zone, old_constants.raw()); |
4446 Instance& constant = Instance::Handle(zone); | 4446 Instance& constant = Instance::Handle(zone); |
4447 CanonicalInstancesSet::Iterator it(&set); | 4447 CanonicalInstancesSet::Iterator it(&set); |
4448 while (it.MoveNext()) { | 4448 while (it.MoveNext()) { |
4449 constant ^= set.GetKey(it.Current()); | 4449 constant ^= set.GetKey(it.Current()); |
4450 ASSERT(!constant.IsNull()); | 4450 ASSERT(!constant.IsNull()); |
| 4451 ASSERT(constant.IsCanonical()); |
4451 InsertCanonicalConstant(zone, constant); | 4452 InsertCanonicalConstant(zone, constant); |
4452 } | 4453 } |
4453 set.Release(); | 4454 set.Release(); |
4454 } | 4455 } |
4455 | 4456 |
4456 | 4457 |
4457 RawUnresolvedClass* UnresolvedClass::New(const LibraryPrefix& library_prefix, | 4458 RawUnresolvedClass* UnresolvedClass::New(const LibraryPrefix& library_prefix, |
4458 const String& ident, | 4459 const String& ident, |
4459 TokenPosition token_pos) { | 4460 TokenPosition token_pos) { |
4460 const UnresolvedClass& type = UnresolvedClass::Handle(UnresolvedClass::New()); | 4461 const UnresolvedClass& type = UnresolvedClass::Handle(UnresolvedClass::New()); |
(...skipping 17550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22011 return isolate->object_store()->empty_uint32_array(); | 22012 return isolate->object_store()->empty_uint32_array(); |
22012 } | 22013 } |
22013 const TypedData& array = TypedData::Handle(thread->zone(), | 22014 const TypedData& array = TypedData::Handle(thread->zone(), |
22014 TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld)); | 22015 TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld)); |
22015 isolate->object_store()->set_empty_uint32_array(array); | 22016 isolate->object_store()->set_empty_uint32_array(array); |
22016 return array.raw(); | 22017 return array.raw(); |
22017 } | 22018 } |
22018 | 22019 |
22019 | 22020 |
22020 const char* TypedData::ToCString() const { | 22021 const char* TypedData::ToCString() const { |
| 22022 switch (GetClassId()) { |
| 22023 #define CASE_TYPED_DATA_CLASS(clazz) \ |
| 22024 case kTypedData##clazz##Cid: return #clazz; |
| 22025 CLASS_LIST_TYPED_DATA(CASE_TYPED_DATA_CLASS); |
| 22026 #undef CASE_TYPED_DATA_CLASS |
| 22027 } |
22021 return "TypedData"; | 22028 return "TypedData"; |
22022 } | 22029 } |
22023 | 22030 |
22024 | 22031 |
22025 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( | 22032 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( |
22026 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { | 22033 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { |
22027 return dart::AddFinalizer(*this, peer, callback); | 22034 return dart::AddFinalizer(*this, peer, callback); |
22028 } | 22035 } |
22029 | 22036 |
22030 | 22037 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22667 return UserTag::null(); | 22674 return UserTag::null(); |
22668 } | 22675 } |
22669 | 22676 |
22670 | 22677 |
22671 const char* UserTag::ToCString() const { | 22678 const char* UserTag::ToCString() const { |
22672 const String& tag_label = String::Handle(label()); | 22679 const String& tag_label = String::Handle(label()); |
22673 return tag_label.ToCString(); | 22680 return tag_label.ToCString(); |
22674 } | 22681 } |
22675 | 22682 |
22676 } // namespace dart | 22683 } // namespace dart |
OLD | NEW |