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 |
649 // Store a range of pointers [from, from + count) into [to, to + count). | 654 // Store a range of pointers [from, from + count) into [to, to + count). |
650 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. | 655 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. |
651 void StorePointers(RawObject* const* to, | 656 void StorePointers(RawObject* const* to, |
652 RawObject* const* from, | 657 RawObject* const* from, |
653 intptr_t count) { | 658 intptr_t count) { |
654 ASSERT(Contains(reinterpret_cast<uword>(to))); | 659 ASSERT(Contains(reinterpret_cast<uword>(to))); |
655 if (raw()->IsNewObject()) { | 660 if (raw()->IsNewObject()) { |
656 memmove(const_cast<RawObject**>(to), from, count * kWordSize); | 661 memmove(const_cast<RawObject**>(to), from, count * kWordSize); |
657 } else { | 662 } else { |
658 for (intptr_t i = 0; i < count; ++i) { | 663 for (intptr_t i = 0; i < count; ++i) { |
(...skipping 7999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8658 | 8663 |
8659 inline void TypeArguments::SetHash(intptr_t value) const { | 8664 inline void TypeArguments::SetHash(intptr_t value) const { |
8660 // This is only safe because we create a new Smi, which does not cause | 8665 // This is only safe because we create a new Smi, which does not cause |
8661 // heap allocation. | 8666 // heap allocation. |
8662 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8667 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8663 } | 8668 } |
8664 | 8669 |
8665 } // namespace dart | 8670 } // namespace dart |
8666 | 8671 |
8667 #endif // VM_OBJECT_H_ | 8672 #endif // VM_OBJECT_H_ |
OLD | NEW |