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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // | 639 // |
640 // All writes to heap objects should ultimately pass through one of the | 640 // All writes to heap objects should ultimately pass through one of the |
641 // methods below or their counterparts in RawObject, to ensure that the | 641 // methods below or their counterparts in RawObject, to ensure that the |
642 // write barrier is correctly applied. | 642 // write barrier is correctly applied. |
643 | 643 |
644 template<typename type> | 644 template<typename type> |
645 void StorePointer(type const* addr, type value) const { | 645 void StorePointer(type const* addr, type value) const { |
646 raw()->StorePointer(addr, value); | 646 raw()->StorePointer(addr, value); |
647 } | 647 } |
648 | 648 |
649 template<typename type> | |
650 void AtomicStorePointer(type const* addr, type value) const { | |
651 raw()->AtomicStorePointer(addr, value); | |
652 } | |
653 | |
654 // Store a range of pointers [from, from + count) into [to, to + count). | 649 // Store a range of pointers [from, from + count) into [to, to + count). |
655 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. | 650 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. |
656 void StorePointers(RawObject* const* to, | 651 void StorePointers(RawObject* const* to, |
657 RawObject* const* from, | 652 RawObject* const* from, |
658 intptr_t count) { | 653 intptr_t count) { |
659 ASSERT(Contains(reinterpret_cast<uword>(to))); | 654 ASSERT(Contains(reinterpret_cast<uword>(to))); |
660 if (raw()->IsNewObject()) { | 655 if (raw()->IsNewObject()) { |
661 memmove(const_cast<RawObject**>(to), from, count * kWordSize); | 656 memmove(const_cast<RawObject**>(to), from, count * kWordSize); |
662 } else { | 657 } else { |
663 for (intptr_t i = 0; i < count; ++i) { | 658 for (intptr_t i = 0; i < count; ++i) { |
(...skipping 7999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8663 | 8658 |
8664 inline void TypeArguments::SetHash(intptr_t value) const { | 8659 inline void TypeArguments::SetHash(intptr_t value) const { |
8665 // This is only safe because we create a new Smi, which does not cause | 8660 // This is only safe because we create a new Smi, which does not cause |
8666 // heap allocation. | 8661 // heap allocation. |
8667 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8662 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8668 } | 8663 } |
8669 | 8664 |
8670 } // namespace dart | 8665 } // namespace dart |
8671 | 8666 |
8672 #endif // VM_OBJECT_H_ | 8667 #endif // VM_OBJECT_H_ |
OLD | NEW |