| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 ASSERT(background_compilation_error_->IsLanguageError()); | 901 ASSERT(background_compilation_error_->IsLanguageError()); |
| 902 ASSERT(!vm_isolate_snapshot_object_table_->IsSmi()); | 902 ASSERT(!vm_isolate_snapshot_object_table_->IsSmi()); |
| 903 ASSERT(vm_isolate_snapshot_object_table_->IsArray()); | 903 ASSERT(vm_isolate_snapshot_object_table_->IsArray()); |
| 904 } | 904 } |
| 905 | 905 |
| 906 | 906 |
| 907 // An object visitor which will mark all visited objects. This is used to | 907 // An object visitor which will mark all visited objects. This is used to |
| 908 // premark all objects in the vm_isolate_ heap. | 908 // premark all objects in the vm_isolate_ heap. |
| 909 class PremarkingVisitor : public ObjectVisitor { | 909 class PremarkingVisitor : public ObjectVisitor { |
| 910 public: | 910 public: |
| 911 explicit PremarkingVisitor(Isolate* isolate) : ObjectVisitor(isolate) {} | 911 PremarkingVisitor() { } |
| 912 | 912 |
| 913 void VisitObject(RawObject* obj) { | 913 void VisitObject(RawObject* obj) { |
| 914 // Free list elements should never be marked. | 914 // Free list elements should never be marked. |
| 915 if (!obj->IsFreeListElement()) { | 915 if (!obj->IsFreeListElement()) { |
| 916 ASSERT(obj->IsVMHeapObject()); | 916 ASSERT(obj->IsVMHeapObject()); |
| 917 if (obj->IsMarked()) { | 917 if (obj->IsMarked()) { |
| 918 // Precompiled objects are loaded pre-marked. | 918 // Precompiled objects are loaded pre-marked. |
| 919 ASSERT(Dart::IsRunningPrecompiledCode()); | 919 ASSERT(Dart::IsRunningPrecompiledCode()); |
| 920 ASSERT(obj->IsInstructions() || | 920 ASSERT(obj->IsInstructions() || |
| 921 obj->IsPcDescriptors() || | 921 obj->IsPcDescriptors() || |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 // pre-allocated in the vm isolate also. | 989 // pre-allocated in the vm isolate also. |
| 990 cls = isolate->object_store()->array_class(); | 990 cls = isolate->object_store()->array_class(); |
| 991 cls.set_name(Symbols::_List()); | 991 cls.set_name(Symbols::_List()); |
| 992 cls = isolate->object_store()->one_byte_string_class(); | 992 cls = isolate->object_store()->one_byte_string_class(); |
| 993 cls.set_name(Symbols::OneByteString()); | 993 cls.set_name(Symbols::OneByteString()); |
| 994 | 994 |
| 995 { | 995 { |
| 996 ASSERT(isolate == Dart::vm_isolate()); | 996 ASSERT(isolate == Dart::vm_isolate()); |
| 997 bool include_code_pages = !Dart::IsRunningPrecompiledCode(); | 997 bool include_code_pages = !Dart::IsRunningPrecompiledCode(); |
| 998 WritableVMIsolateScope scope(Thread::Current(), include_code_pages); | 998 WritableVMIsolateScope scope(Thread::Current(), include_code_pages); |
| 999 PremarkingVisitor premarker(isolate); | 999 PremarkingVisitor premarker; |
| 1000 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); | 1000 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); |
| 1001 isolate->heap()->IterateOldObjects(&premarker); | 1001 isolate->heap()->IterateOldObjects(&premarker); |
| 1002 // Make the VM isolate read-only again after setting all objects as marked. | 1002 // Make the VM isolate read-only again after setting all objects as marked. |
| 1003 } | 1003 } |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 | 1006 |
| 1007 void Object::InitVmIsolateSnapshotObjectTable(intptr_t len) { | 1007 void Object::InitVmIsolateSnapshotObjectTable(intptr_t len) { |
| 1008 ASSERT(Isolate::Current() == Dart::vm_isolate()); | 1008 ASSERT(Isolate::Current() == Dart::vm_isolate()); |
| 1009 *vm_isolate_snapshot_object_table_ = Array::New(len, Heap::kOld); | 1009 *vm_isolate_snapshot_object_table_ = Array::New(len, Heap::kOld); |
| (...skipping 20772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21782 return UserTag::null(); | 21782 return UserTag::null(); |
| 21783 } | 21783 } |
| 21784 | 21784 |
| 21785 | 21785 |
| 21786 const char* UserTag::ToCString() const { | 21786 const char* UserTag::ToCString() const { |
| 21787 const String& tag_label = String::Handle(label()); | 21787 const String& tag_label = String::Handle(label()); |
| 21788 return tag_label.ToCString(); | 21788 return tag_label.ToCString(); |
| 21789 } | 21789 } |
| 21790 | 21790 |
| 21791 } // namespace dart | 21791 } // namespace dart |
| OLD | NEW |