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 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 RawObject* raw = Object::Allocate(Class::kClassId, | 1727 RawObject* raw = Object::Allocate(Class::kClassId, |
1728 Class::InstanceSize(), | 1728 Class::InstanceSize(), |
1729 Heap::kOld); | 1729 Heap::kOld); |
1730 NoGCScope no_gc; | 1730 NoGCScope no_gc; |
1731 result ^= raw; | 1731 result ^= raw; |
1732 } | 1732 } |
1733 FakeObject fake; | 1733 FakeObject fake; |
1734 result.set_handle_vtable(fake.vtable()); | 1734 result.set_handle_vtable(fake.vtable()); |
1735 result.set_instance_size(FakeObject::InstanceSize()); | 1735 result.set_instance_size(FakeObject::InstanceSize()); |
1736 result.set_next_field_offset(FakeObject::NextFieldOffset()); | 1736 result.set_next_field_offset(FakeObject::NextFieldOffset()); |
1737 ASSERT((FakeObject::kClassId != kInstanceCid)); | 1737 COMPILE_ASSERT((FakeObject::kClassId != kInstanceCid)); |
1738 result.set_id(FakeObject::kClassId); | 1738 result.set_id(FakeObject::kClassId); |
1739 result.set_state_bits(0); | 1739 result.set_state_bits(0); |
1740 if (FakeObject::kClassId < kInstanceCid) { | 1740 if (FakeObject::kClassId < kInstanceCid) { |
1741 // VM internal classes are done. There is no finalization needed or | 1741 // VM internal classes are done. There is no finalization needed or |
1742 // possible in this case. | 1742 // possible in this case. |
1743 result.set_is_finalized(); | 1743 result.set_is_finalized(); |
1744 } else { | 1744 } else { |
1745 // VM backed classes are almost ready: run checks and resolve class | 1745 // VM backed classes are almost ready: run checks and resolve class |
1746 // references, but do not recompute size. | 1746 // references, but do not recompute size. |
1747 result.set_is_prefinalized(); | 1747 result.set_is_prefinalized(); |
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4652 RawObject* raw = Object::Allocate(TypeArguments::kClassId, | 4652 RawObject* raw = Object::Allocate(TypeArguments::kClassId, |
4653 TypeArguments::InstanceSize(len), | 4653 TypeArguments::InstanceSize(len), |
4654 space); | 4654 space); |
4655 NoGCScope no_gc; | 4655 NoGCScope no_gc; |
4656 result ^= raw; | 4656 result ^= raw; |
4657 // Length must be set before we start storing into the array. | 4657 // Length must be set before we start storing into the array. |
4658 result.SetLength(len); | 4658 result.SetLength(len); |
4659 } | 4659 } |
4660 // The zero array should have been initialized. | 4660 // The zero array should have been initialized. |
4661 ASSERT(Object::zero_array().raw() != Array::null()); | 4661 ASSERT(Object::zero_array().raw() != Array::null()); |
4662 COMPILE_ASSERT(StubCode::kNoInstantiator == 0, kNoInstantiator_must_be_zero); | 4662 COMPILE_ASSERT(StubCode::kNoInstantiator == 0); |
4663 result.set_instantiations(Object::zero_array()); | 4663 result.set_instantiations(Object::zero_array()); |
4664 return result.raw(); | 4664 return result.raw(); |
4665 } | 4665 } |
4666 | 4666 |
4667 | 4667 |
4668 | 4668 |
4669 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const { | 4669 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const { |
4670 // TODO(iposva): Determine if we should throw an exception here. | 4670 // TODO(iposva): Determine if we should throw an exception here. |
4671 ASSERT((index >= 0) && (index < Length())); | 4671 ASSERT((index >= 0) && (index < Length())); |
4672 return &raw_ptr()->types_[index]; | 4672 return &raw_ptr()->types_[index]; |
(...skipping 14237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18910 return tag_label.ToCString(); | 18910 return tag_label.ToCString(); |
18911 } | 18911 } |
18912 | 18912 |
18913 | 18913 |
18914 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18914 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
18915 Instance::PrintJSONImpl(stream, ref); | 18915 Instance::PrintJSONImpl(stream, ref); |
18916 } | 18916 } |
18917 | 18917 |
18918 | 18918 |
18919 } // namespace dart | 18919 } // namespace dart |
OLD | NEW |