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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 | 1754 |
1755 RawString* Object::DictionaryName() const { | 1755 RawString* Object::DictionaryName() const { |
1756 return String::null(); | 1756 return String::null(); |
1757 } | 1757 } |
1758 | 1758 |
1759 | 1759 |
1760 void Object::InitializeObject(uword address, | 1760 void Object::InitializeObject(uword address, |
1761 intptr_t class_id, | 1761 intptr_t class_id, |
1762 intptr_t size, | 1762 intptr_t size, |
1763 bool is_vm_object) { | 1763 bool is_vm_object) { |
1764 uword initial_value = (class_id == kInstructionsCid) | 1764 const uword break_instruction_value = Assembler::GetBreakInstructionFiller(); |
1765 ? Assembler::GetBreakInstructionFiller() : reinterpret_cast<uword>(null_); | 1765 const uword null_value = reinterpret_cast<uword>(null_); |
| 1766 const bool is_instructions = class_id == kInstructionsCid; |
| 1767 uword initial_value = |
| 1768 is_instructions ? break_instruction_value : null_value; |
1766 uword cur = address; | 1769 uword cur = address; |
1767 uword end = address + size; | 1770 uword end = address + size; |
| 1771 if (is_instructions) { |
| 1772 // Fill the header with null. The remainder of the Instructions object will |
| 1773 // be filled with the break_instruction_value. |
| 1774 uword header_end = address + Instructions::HeaderSize(); |
| 1775 while (cur < header_end) { |
| 1776 *reinterpret_cast<uword*>(cur) = null_value; |
| 1777 cur += kWordSize; |
| 1778 } |
| 1779 } |
1768 while (cur < end) { | 1780 while (cur < end) { |
1769 *reinterpret_cast<uword*>(cur) = initial_value; | 1781 *reinterpret_cast<uword*>(cur) = initial_value; |
1770 cur += kWordSize; | 1782 cur += kWordSize; |
1771 } | 1783 } |
1772 uword tags = 0; | 1784 uword tags = 0; |
1773 ASSERT(class_id != kIllegalCid); | 1785 ASSERT(class_id != kIllegalCid); |
1774 tags = RawObject::ClassIdTag::update(class_id, tags); | 1786 tags = RawObject::ClassIdTag::update(class_id, tags); |
1775 tags = RawObject::SizeTag::update(size, tags); | 1787 tags = RawObject::SizeTag::update(size, tags); |
1776 tags = RawObject::VMHeapObjectTag::update(is_vm_object, tags); | 1788 tags = RawObject::VMHeapObjectTag::update(is_vm_object, tags); |
1777 reinterpret_cast<RawObject*>(address)->tags_ = tags; | 1789 reinterpret_cast<RawObject*>(address)->tags_ = tags; |
(...skipping 19677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21455 return tag_label.ToCString(); | 21467 return tag_label.ToCString(); |
21456 } | 21468 } |
21457 | 21469 |
21458 | 21470 |
21459 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21471 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21460 Instance::PrintJSONImpl(stream, ref); | 21472 Instance::PrintJSONImpl(stream, ref); |
21461 } | 21473 } |
21462 | 21474 |
21463 | 21475 |
21464 } // namespace dart | 21476 } // namespace dart |
OLD | NEW |